A premium, GPS‑based attendance tracking system for educational assistants. It features real‑time location validation, a sleek admin dashboard, and a PWA assistant interface..
- Node.js (v14 or higher) – Download
- MySQL (v5.7 or higher) – Download
- Git (optional, for cloning) – Download
- OpenSSL (optional, for generating self‑signed certificates) – included with Git‑Bash or can be installed separately.
- Create an
.envfile in thebackend/folder.If no example is present, create the file manually with the following keys:cp backend/.env.example backend/.env # if an example existsPORT=5000 # Port for the server (default 5000) DB_HOST=localhost # MySQL host DB_PORT=3306 # MySQL port DB_USER=root # MySQL user (change as needed) DB_PASSWORD=your_password DB_NAME=assistant_attendance JWT_SECRET=your_jwt_secret # long random string NODE_ENV=development
Tip: Use a password manager to generate a strong
JWT_SECRET.
The project ships with a schema, migration scripts, and seed data.
- Run the batch script – this will create the database, apply migrations, and insert seed data:
The script internally executes the following SQL files (found in
setup-database.bat
database/):schema.sql– creates the initial tables.migrations/*.sql– incremental schema changes.seed.sql– sample data for quick testing.
- Verify the database was created:
You should see a few rows from the seed file.
SELECT * FROM assistants LIMIT 5;
- Generate a self‑signed certificate (or use your own):
openssl req -nodes -new -x509 -keyout backend/key.pem -out backend/cert.pem -days 365
- Place
key.pemandcert.peminbackend/. The server will automatically start in HTTPS mode when the files are present; otherwise it falls back to HTTP.
Two convenient batch scripts are provided:
| Script | Description |
|---|---|
start-app.bat |
Starts the MySQL service (if needed), launches the backend server and serves the frontend files. |
stop-app.bat |
Gracefully stops the backend server and any related processes. |
start-app.bat # launch everythingOnce running, open your browser:
- Admin Dashboard:
http://localhost:5000/admin/ - Assistant PWA:
http://localhost:5000/assistant/
- Hot‑reload – The backend uses
nodemon(installed vianpm install). Run manually withnpm run devinsidebackend/if you prefer. - Run unit tests (if any):
cd backend && npm test
- Linting –
npm run lintwill check code style.
| Issue | Fix |
|---|---|
| Database connection error | Ensure MySQL is running, the credentials in .env are correct, and the assistant_attendance database exists. |
| SSL certificate not found | Either generate key.pem/cert.pem as described above or ignore – the server will start over HTTP. |
| Port already in use | Change PORT in .env or stop the conflicting process. |
| Missing environment variables | Double‑check the .env file; all keys listed in the Environment Setup section are required. |
- Issues: Open a GitHub issue with a clear description and steps to reproduce.
- Pull Requests: Fork the repo, make your changes, and submit a PR. Ensure the CI pipeline passes.
- Documentation: The project no longer relies on a separate
docs/folder; all essential information is now in this README.
This project is licensed under the MIT License.
- Configure production environment – set
NODE_ENV=production, obtain a valid SSL certificate, and configure a reverse proxy (e.g., Nginx). - Deploy to a cloud provider – Dockerize the app or use a PaaS like Heroku, Render, or Azure App Service.
- Enable CI/CD – automate tests, linting, and deployments.
- Extend functionality – add role‑based dashboards, email notifications, or mobile‑native wrappers.
Built with ❤️ using HTML, CSS, JavaScript, Node.js, Express, MySQL, and OpenStreetMap.
A GPS-based attendance tracking system for educational assistants with real-time location validation.
-
Setup Database:
setup-database.bat
-
Start Application:
start-app.bat
-
Access the System:
- Admin Dashboard: http://localhost:5000/frontend/admin/
- Assistant PWA: http://localhost:5000/frontend/assistant/
-
Stop Application:
stop-app.bat
- ✅ Real-time location tracking with OpenStreetMap
- ✅ Installable as Progressive Web App (PWA)
- ✅ Offline support with service worker
- ✅ Dashboard with statistics
- ✅ Manage centers (CRUD with map)
- ✅ Manage assistants and sessions
- ✅ View attendance reports
- ✅ Export data to CSV
- ✅ RESTful API with JWT authentication
- ✅ MySQL database with proper relationships
- ✅ Role-based access control
- ✅ Haversine formula for distance calculation
- ✅ OpenStreetMap (free, no API key needed)
asist web/
├── backend/ # Node.js + Express API
│ ├── config/ # Database & JWT config
│ ├── controllers/ # Business logic
│ ├── middleware/ # Auth & role checking
│ ├── models/ # Database queries
│ ├── routes/ # API routes
│ └── server.js # Main server file
│
├── frontend/
│ ├── admin/ # Admin dashboard
│ ├── assistant/ # Assistant PWA
│ └── shared/ # Shared resources
│
├── database/
│ ├── schema.sql # Database structure
│ └── seed.sql # Sample data
│
├── docs/ # 📚 All documentation
│
├── setup-database.bat # Database setup script
├── start-app.bat # Start all servers
└── stop-app.bat # Stop all servers
Email: admin@attendance.com
Password: Admin@2024
Email: assistant1@attendance.com
Password: Assistant@2024
See docs/CREDENTIALS.md for all test accounts.
| Component | Technology |
|---|---|
| Backend | Node.js, Express.js |
| Database | MySQL |
| Authentication | JWT (JSON Web Tokens) |
| Frontend | HTML5, CSS3, JavaScript (Vanilla) |
| Maps | Leaflet.js + OpenStreetMap |
| PWA | Service Workers, Web Manifest |
| GPS | Geolocation API + Haversine Formula |
Having issues? Check the Troubleshooting Guide for common problems and solutions.
Common issues:
- Database connection errors
- CORS issues
- GPS not working
- Server startup problems
- 📖 Documentation: docs/
- 🐛 Issues: Check TROUBLESHOOTING.md
- 📧 Questions: See documentation files for detailed guides
This project is licensed under the MIT License.
- ✅ Run
setup-database.batto create the database - ✅ Edit
backend\.envwith your MySQL password - ✅ Run
start-app.batto start the application - ✅ Login with test credentials
- ✅ Explore the system!
For detailed instructions, see docs/BATCH_SCRIPTS_GUIDE.md
Built with ❤️ using HTML, CSS, JavaScript, Node.js, Express, MySQL, and OpenStreetMap