A MERN-stack smart attendance system featuring real-time facial recognition (face-api.js) and Gemini AI-driven anomaly detection to eliminate proxy attendance and automate student analytics.
- π€ Real-time Facial Recognition: Uses face-api.js for accurate face detection and recognition
- π€ AI-Powered Anomaly Detection: Integrates Google Gemini AI to detect suspicious attendance patterns
- π‘οΈ Proxy Attendance Prevention: Eliminates buddy punching through biometric verification
- πΉ Live Attendance Scanning: Real-time camera-based attendance marking
- π¨βπ« Student & Teacher Dashboards: Role-based interfaces for different users
- π Analytics Dashboard: Comprehensive attendance analytics with visual charts
- β‘ Real-time Updates: Socket.io integration for live data synchronization
- π± PWA Support: Progressive Web App capabilities for offline access
- π₯ Export Records: Download attendance records as CSV files
- π¨ Responsive Design: Modern UI built with TailwindCSS and Framer Motion
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database with Mongoose ODM
- Socket.io - Real-time bidirectional communication
- JWT - Authentication
- bcryptjs - Password hashing
- Google Generative AI - AI-powered anomaly detection
- json2csv - CSV export functionality
- React 18 - UI library
- Vite - Build tool
- TailwindCSS - Styling
- React Router - Client-side routing
- face-api.js - Face recognition
- Socket.io Client - Real-time updates
- Recharts - Data visualization
- Framer Motion - Animations
- Lucide React - Icons
- Axios - HTTP client
Attendly-AI/
βββ backend/
β βββ config/ # Database configuration
β βββ controllers/ # Route controllers
β βββ middleware/ # Custom middleware (auth, error handling)
β βββ models/ # Mongoose models
β βββ routes/ # API routes
β βββ utils/ # Utility functions
β βββ server.js # Entry point
β βββ seed.js # Database seeding
β βββ reset.js # Database reset
βββ frontend/
β βββ public/
β β βββ models/ # Face-api.js models
β βββ src/
β β βββ components/ # Reusable components
β β βββ context/ # React context
β β βββ face-api.js/ # Face recognition utilities
β β βββ hooks/ # Custom hooks
β β βββ pages/ # Page components
β β βββ services/ # API services
β β βββ utils/ # Utility functions
β β βββ App.jsx # Main app component
β β βββ main.jsx # Entry point
β βββ index.html
βββ README.md
- Node.js (v18 or higher)
- MongoDB (local or Atlas)
- Google Gemini API Key
- Navigate to the backend directory:
cd backend- Install dependencies:
npm install- Create a
.envfile in the backend directory:
PORT=5000
MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/attendly-ai
JWT_SECRET=your-secret-key-here
GEMINI_API_KEY=your-gemini-api-key
FRONTEND_URL=http://localhost:5173- Start the development server:
npm run devThe backend will run on http://localhost:5000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Start the development server:
npm run devThe frontend will run on http://localhost:5173
To seed the database with sample data:
cd backend
npm run seedTo reset the database:
npm run resetPOST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user
POST /api/attendance/mark- Mark attendanceGET /api/attendance/session/:id- Get attendance sessionGET /api/attendance/history- Get attendance history
GET /api/students- Get all studentsPOST /api/students- Add new studentPUT /api/students/:id- Update studentDELETE /api/students/:id- Delete student
GET /api/records- Get attendance recordsGET /api/records/export- Export records as CSV
POST /api/scan/start- Start live scan sessionPOST /api/scan/stop- Stop scan sessionPOST /api/scan/verify- Verify face
GET /api/settings- Get system settingsPUT /api/settings- Update settings
GET /api/analytics/overview- Get attendance overviewGET /api/analytics/trends- Get attendance trends
- Login: User authentication with JWT
- Register: New user registration with role selection (Teacher/Student)
- Overview of attendance statistics
- Quick access to main features
- Recent activity feed
- Personal attendance overview
- Attendance history
- Profile management
- Real-time camera feed
- Face detection and recognition
- Automatic attendance marking
- Anomaly detection alerts
- View all attendance records
- Filter by date, student, or status
- Export to CSV
- Manage student database
- Add/edit/delete students
- Register facial data
- Visual charts and graphs
- Attendance trends
- Anomaly detection reports
- Export analytics data
- System configuration
- API key management
- Attendance parameters
- Notification settings
| Variable | Description | Required |
|---|---|---|
PORT |
Backend server port | Yes |
MONGODB_URI |
MongoDB connection string | Yes |
JWT_SECRET |
Secret key for JWT tokens | Yes |
GEMINI_API_KEY |
Google Gemini API key | Yes |
FRONTEND_URL |
Frontend application URL | Yes |
- π¨βπ« Register as a Teacher: Create an account with teacher role
- β Add Students: Register students and capture their facial data
- πΉ Start Live Scan: Begin an attendance session with camera
- β Mark Attendance: Students are automatically marked when their face is recognized
- π View Analytics: Monitor attendance patterns and detect anomalies
- π₯ Export Records: Download attendance data for reporting
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
- face-api.js for facial recognition capabilities
- Google Gemini AI for anomaly detection
- The open-source community for the amazing tools and libraries