This project is a Minimum Viable Prototype (MVP) for an automated student entry and exit logging system designed for university hostels. It features a geolocation-secured gate terminal, role-based access control, and a real-time tracking admin dashboard, all wrapped in a modern, premium Glassmorphism UI.
- Students: Secure login with ID and password. First-time login requires users to reset their password and configure a recovery PIN.
- Admin: Dedicated admin portal to monitor hostel activity, export reports, and resolve alerts.
- Passwords: Securely hashed using PBKDF2 with SHA256 (
werkzeug.security).
To prevent proxy attendance or remote entries, the system ensures the student is physically present at the gate before allowing a scan.
- Implementation: The frontend captures the user's current GPS location (Latitude & Longitude) and sends it with the scan request.
- Algorithm: The backend uses the Haversine Formula to calculate the distance between the user's coordinates and the fixed gate coordinates.
- Distance Threshold: 50 meters. If the distance is > 50 meters, the API returns a
403 Forbiddenerror.
The system intelligently switches between "Entry" and "Exit" actions without requiring the user to specify their intent.
- Implementation: When a valid scan hits the
/api/scanendpoint, the system checks the student's current status (InsideorOutside). - Logic:
- If
Inside➔ Marks asOutsideand logs as Exit. - If
Outside➔ Marks asInsideand logs as Entry.
- If
The admin panel offers live monitoring of the hostel occupancy without needing page refreshes.
- Implementation: The dashboard utilizes frontend JavaScript polling to continuously fetch updates from the
/api/dashboardREST endpoint. - Data Provided:
- Live Occupancy Counter: Real-time count of students currently inside the hostel.
- Activity Feed: Recent entries and exits with formatted timestamps.
- Curfew Alerts: Automated flagging of movements during curfew hours (10:00 PM to 6:00 AM). Admins can resolve alerts with custom remarks.
- CSV Exports: Admins can export detailed activity logs and violation reports between specific dates.
A lightweight SQLite database (hostel.db) handles data persistence. The backend (app.py) automatically initializes and prepopulates this database on first run if it doesn't exist.
To provide a highly polished, aesthetic user experience, the system utilizes a unified modern CSS design.
- Implementation: Uses a dynamic mesh gradient background and semi-transparent 'glass' containers using CSS
backdrop-filter: blur(16px).
- Backend: Python 3, Flask
- Database: SQLite3
- Frontend: HTML5, Vanilla JavaScript, CSS3
- Security: Werkzeug Security (Password Hashing)
- Make sure you have Python 3 installed.
- Install the required dependencies:
pip install -r requirements.txt
- (Optional) Reset the admin account password to the default if you are locked out:
python reset_admin.py
- Run the application:
python app.py
- Endpoints accessible at port
5001:- Login Flow:
http://localhost:5001/login - Gate Terminal:
http://localhost:5001/gate - Admin Dashboard:
http://localhost:5001/admin
- Login Flow:
(Note: To successfully test a scan on localhost, you may need to either be physically close to the hardcoded coordinates, spoof your browser's geolocation, or temporarily modify GATE_LAT and GATE_LON in app.py to match your actual location.)