A location-aware mobile attendance system that uses GPS Geofencing to automatically verify whether a student is physically present within an authorized zone before marking attendance. Built with Node.js + Express backend and Expo (React Native + TypeScript) frontend.
- 📡 GPS-Based Geofencing — Attendance is only marked when the user is within a predefined geographic radius
- 🔐 Role-Based Access Control — Separate dashboards for Admins, Teachers, and Students
- 🕐 Real-Time Attendance Tracking — Live status updates with timestamps
- 📊 Attendance Reports — View attendance history by date, user, or department
- 🔔 Push Notifications — Alerts for attendance windows opening/closing
- 🌐 RESTful API Backend — Clean, documented API endpoints for all operations
- 📱 Cross-Platform Mobile App — Works on both Android and iOS via Expo
| Layer | Technology |
|---|---|
| Frontend | React Native + Expo (TypeScript) |
| Routing | Expo Router (file-based) |
| Backend | Node.js + Express.js |
| Database | MongoDB + Mongoose |
| Auth | JWT (JSON Web Tokens) |
| Location | Expo Location API |
| Geofencing | Haversine Formula |
| Language | TypeScript (frontend), JavaScript (backend) |
MOBILE-APP/
├── attendance-backend/
│ ├── controllers/
│ │ ├── authController.js
│ │ ├── attendanceController.js
│ │ └── userController.js
│ ├── models/
│ │ ├── User.js
│ │ ├── Attendance.js
│ │ └── Zone.js
│ ├── routes/
│ │ ├── auth.js
│ │ ├── attendance.js
│ │ └── user.js
│ ├── middleware/
│ │ └── authMiddleware.js
│ ├── utils/
│ │ └── geofence.js
│ └── server.js
│
├── attendance-frontend/
│ ├── app/
│ │ ├── (student-tabs)/ # Student tab navigation
│ │ ├── teacher/ # Teacher screens
│ │ ├── _layout.tsx
│ │ ├── all-students.tsx
│ │ ├── edit-profile.tsx
│ │ ├── index.tsx
│ │ ├── login.tsx
│ │ └── register.tsx
│ ├── assets/
│ ├── components/
│ ├── constants/
│ │ └── api.ts # API base URL config
│ ├── context/
│ ├── hooks/
│ ├── scripts/
│ ├── app.json
│ ├── expo-env.d.ts
│ └── package.json
│
└── README.md
- Node.js v18+
- MongoDB (local or Atlas)
- Expo CLI:
npm install -g expo-cli - Expo Go app on your phone or Android Studio / Xcode for emulator
git clone https://github.com/singh5679/Mobile-Attendance-App.git
cd Mobile-Attendance-Appcd attendance-backend
npm installCreate a .env file:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
GEOFENCE_RADIUS_METERS=100Start the server:
npm run devcd attendance-frontend
npm installUpdate the API base URL in constants/api.ts:
export const API_URL = "http://<your-local-ip>:5000";
⚠️ Use your machine's local IP (e.g.,192.168.x.x), notlocalhost, so the mobile device/emulator can reach the backend.
Start the Expo app:
npx expo startScan the QR code with Expo Go on your phone, or press a for Android emulator / i for iOS simulator.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /register |
Register a new user | No |
| POST | /login |
Login and get JWT token | No |
| GET | /me |
Get current user profile | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /mark |
Mark attendance (with GPS validation) | Yes |
| GET | /my |
Get current user's attendance history | Yes |
| GET | /report/:userId |
Get attendance report for a user | Admin/Teacher |
| GET | /today |
Get today's attendance list | Admin/Teacher |
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Get all users |
| PUT | /:id |
Update user info |
| DELETE | /:id |
Delete a user |
| Feature | Student | Teacher |
|---|---|---|
| Mark Attendance | ✅ | ✅ |
| View Own History | ✅ | ✅ |
| View All Attendance | ❌ | ✅ |
| View All Students | ❌ | ✅ |
| Manage Users | ❌ | ❌ |
| Define Geofence Zones | ❌ | ❌ |
| Export Reports | ❌ | ✅ |
- Admin defines an authorized zone with a center coordinate (lat/lng) and a radius in meters.
- When a user taps "Mark Attendance", the app captures their current GPS coordinates via Expo Location API.
- The backend calculates the Haversine distance between the user's location and the zone center.
- If the distance is within the allowed radius → attendance marked ✅; otherwise rejected ❌.
Distance = 2R × arcsin(√(sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlng/2)))
Add screenshots of Login, Mark Attendance, Student Dashboard, and Teacher Panel here.
- Fork the repository
- Create your feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/your-feature - Open a Pull Request
This project is licensed under the MIT License — see the LICENSE file for details.
Himanshu Singh
B.Tech CSE | Integral University, Lucknow
🔗 GitHub • LinkedIn
⭐ If you found this project useful, please consider giving it a star!