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