Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ Attendly AI - Smart Attendance System

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.

✨ Features

  • πŸ‘€ 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

πŸ› οΈ Tech Stack

πŸ”§ Backend

  • 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

βš›οΈ Frontend

  • 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

Project Structure

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

πŸš€ Installation

πŸ“‹ Prerequisites

  • Node.js (v18 or higher)
  • MongoDB (local or Atlas)
  • Google Gemini API Key

πŸ”™ Backend Setup

  1. Navigate to the backend directory:
cd backend
  1. Install dependencies:
npm install
  1. Create a .env file 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
  1. Start the development server:
npm run dev

The backend will run on http://localhost:5000

πŸ”œ Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev

The frontend will run on http://localhost:5173

πŸ—„οΈ Database Seeding

To seed the database with sample data:

cd backend
npm run seed

To reset the database:

npm run reset

πŸ”Œ API Endpoints

πŸ” Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • GET /api/auth/me - Get current user

πŸ“‹ Attendance

  • POST /api/attendance/mark - Mark attendance
  • GET /api/attendance/session/:id - Get attendance session
  • GET /api/attendance/history - Get attendance history

πŸ‘¨β€πŸŽ“ Students

  • GET /api/students - Get all students
  • POST /api/students - Add new student
  • PUT /api/students/:id - Update student
  • DELETE /api/students/:id - Delete student

πŸ“ Records

  • GET /api/records - Get attendance records
  • GET /api/records/export - Export records as CSV

πŸ“· Scan

  • POST /api/scan/start - Start live scan session
  • POST /api/scan/stop - Stop scan session
  • POST /api/scan/verify - Verify face

βš™οΈ Settings

  • GET /api/settings - Get system settings
  • PUT /api/settings - Update settings

πŸ“ˆ Analytics

  • GET /api/analytics/overview - Get attendance overview
  • GET /api/analytics/trends - Get attendance trends

πŸ“„ Pages & Features

πŸ”‘ Authentication

  • Login: User authentication with JWT
  • Register: New user registration with role selection (Teacher/Student)

πŸ‘¨β€πŸ« Teacher Dashboard

  • Overview of attendance statistics
  • Quick access to main features
  • Recent activity feed

πŸ‘¨β€πŸŽ“ Student Dashboard

  • Personal attendance overview
  • Attendance history
  • Profile management

πŸ“Ή Live Scan

  • Real-time camera feed
  • Face detection and recognition
  • Automatic attendance marking
  • Anomaly detection alerts

πŸ“‹ Records

  • View all attendance records
  • Filter by date, student, or status
  • Export to CSV

πŸ‘₯ Students

  • Manage student database
  • Add/edit/delete students
  • Register facial data

πŸ“Š Attendance Analytics

  • Visual charts and graphs
  • Attendance trends
  • Anomaly detection reports
  • Export analytics data

βš™οΈ Settings

  • System configuration
  • API key management
  • Attendance parameters
  • Notification settings

πŸ”‘ Environment Variables

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

πŸ’‘ Usage

  1. πŸ‘¨β€πŸ« Register as a Teacher: Create an account with teacher role
  2. βž• Add Students: Register students and capture their facial data
  3. πŸ“Ή Start Live Scan: Begin an attendance session with camera
  4. βœ… Mark Attendance: Students are automatically marked when their face is recognized
  5. πŸ“Š View Analytics: Monitor attendance patterns and detect anomalies
  6. πŸ“₯ Export Records: Download attendance data for reporting

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“œ License

This project is licensed under the MIT License.

πŸ™ Acknowledgments

  • face-api.js for facial recognition capabilities
  • Google Gemini AI for anomaly detection
  • The open-source community for the amazing tools and libraries

About

Attendly AI : 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.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages