A Node.js-based web application for recording and managing classroom attendance with geolocation validation. An old project I built in sem 1 of my bachelor degree DEMO VIDEO
- Student Attendance Submission: Students can submit their attendance via a web form, which validates their location using the browser's Geolocation API.
- Duplicate Submission Prevention: The server tracks IP addresses and session IDs to prevent multiple submissions from the same user.
- CSV Record Storage: Attendance records are stored in subject-wise CSV files.
- Admin/Instructor Portal: (Planned/Partial) Includes basic HTML templates for student and recruiter portals.
- Bootstrap UI: Modern, responsive UI using Bootstrap.
- Session Management: Uses
express-sessionfor session tracking and duplicate prevention. - Customizable Server Settings: Startup prompts allow configuration of session duration, reset time, and server port.
.
├── app.js # Main server application
├── startup_prompt.js # Startup prompt for server configuration
├── public/ # Static files served to clients
│ ├── index.html # Main attendance form
│ ├── code.js # Client-side logic (geolocation, form submission)
│ ├── code.css # Styles for attendance form
│ ├── error.html # 403 Unauthorized error page
│ ├── violation.html # Duplicate attempt/violation page
│ └── ... # Other static assets (images, etc.)
├── btechmtech_2023-2028_*.csv # Attendance records per subject
├── package.json # Project dependencies
└── Notes.txt # Developer notes and references
-
Startup:
Runnode app.js. You will be prompted for session duration, reset time, and port. -
Attendance Submission:
- Students open the web form (public/index.html).
- They enter their email, name, and select a subject.
- The browser requests their geolocation and validates if they are within the classroom polygon.
- If valid, a POST request is sent to
/apiwith the attendance data. - The server checks for duplicate submissions using IP and session ID.
- If accepted, the record is appended to the appropriate CSV file.
-
Duplicate/Violation Handling:
- If a duplicate attempt is detected, the user is redirected to public/violation.html.
-
Install dependencies:
npm install
-
Run the server:
node app.js
-
Access the app:
Open your browser athttp://localhost:<PORT>(as set during startup).
-
Subjects and Timetable:
Edit the CSV files (e.g.,btechmtech_2023-2028_time_table.csv) to match your subjects and schedule. -
Geolocation Polygon:
The classroom polygon is defined in public/code.js in thevalidatePosition()function. -
Session Settings:
Change session duration and reset time via the startup prompt or modify defaults in app.js.
- See Notes.txt for implementation details, troubleshooting, and useful links.
- The project uses only server-side CSV storage; there is no database integration.
- Static files are served from the
publicdirectory.
- express
- express-session
- body-parser
- prompt-sync
- readline-sync
- bootstrap (for UI)
ISC
Developed by Sumit Gupta (steosumit@gmail.com)