Feature
Description
AI Attendance
Upload a classroom photo β YOLO detects faces β ArcFace identifies students β attendance is auto-recorded
Real-Time Updates
Socket.IO pushes live notifications so dashboards refresh instantly
Role-Based Access
Separate dashboards and permissions for students and teachers
Appeal System
Students can appeal incorrect attendance marks; teachers approve or reject with notes
π¨βπ« Teacher Portal
Class Management β Create, delete, and manage courses with schedules and semesters
Student Roster β Add or remove students from classes by student ID
Attendance Analytics β Per-class and per-student attendance statistics with at-risk detection (< 75%)
Session History β View every attendance session with recognized faces and confidence scores
Announcements β Post and manage class announcements
Appeal Resolution β Review, approve, or reject student attendance appeals
Dashboard β Overview of enrollment, attendance rates, and upcoming classes
Course View β Browse enrolled courses in grid or list layout
Attendance Summary β Detailed attendance history per course with status breakdowns
Join/Leave Classes β Self-enroll into classes using class codes
Submit Appeals β Contest absent marks with a reason (one appeal per record)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend β
β React 19 Β· Vite 8 Β· Tailwind CSS 4 β
β Axios Β· React Router Β· Socket.IO Client β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β REST API + WebSocket β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Backend β
β Express.js Β· Mongoose Β· JWT Β· Socket.IO β
β Helmet Β· Multer Β· express-validator β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Data Layer β
β MongoDB Atlas β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β AI Recognition Service β
β YOLO (Detection) + ArcFace (Recognition) β
β External FastAPI / Modal β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Teacher uploads photo
β
βΌ
Image saved to /uploads
β
βΌ
Sent to YOLO + ArcFace API βββΊ Detects & identifies faces
β
βΌ
Identity suffixes matched to enrolled students
β
βΌ
Present / Absent records created
β
βΌ
Socket.IO emits "refresh-data" βββΊ All dashboards update live
Tool
Version
Node.js
18 or higher
npm
9+
MongoDB
Atlas cluster (or local instance)
Face Recognition API
YOLO + ArcFace service running (e.g., via FastAPI)
git clone https://github.com/XGNoir95/Sentry.git
cd Sentry
Create a .env file from the example:
Configure the environment variables:
PORT = 5000
MONGODB_URI = mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/sentry?retryWrites=true&w=majority
JWT_SECRET = change_this_to_a_long_random_secret_string_42
JWT_EXPIRES_IN = 7d
FACE_RECOGNITION_API_URL = http://localhost:8000/face-recognition
UPLOAD_DIR = uploads
Start the backend server:
# Development (with auto-reload)
npm run dev
# Production
npm start
The API will be available at http://localhost:5000
Optionally create a .env file to override the API URL:
VITE_API_URL = http://localhost:5000/api
Note: In development, the Vite dev server proxies /api requests to localhost:5000 automatically, so this is only needed for production builds or non-default setups.
Start the frontend dev server:
The app will be available at http://localhost:5173
4. Seed Sample Data (Optional)
All endpoints are prefixed with /api. Protected routes require a Bearer token in the Authorization header.
Method
Endpoint
Description
Auth
POST
/api/auth/signup
Register a new user
β
POST
/api/auth/login
Login and receive JWT
β
POST
/api/auth/logout
Logout (client-side)
β
GET
/api/auth/me
Get current user profile
β
Method
Endpoint
Description
Auth
GET
/api/student/dashboard
Dashboard overview
β
GET
/api/student/courses
List enrolled courses
β
GET
/api/student/attendance
All attendance records
β
GET
/api/student/attendance/:classId
Attendance for a class
β
POST
/api/student/join-class
Join a class by code
β
POST
/api/student/leave-class
Leave a class
β
POST
/api/student/appeal
Submit an attendance appeal
β
GET
/api/student/appeals
List submitted appeals
β
Method
Endpoint
Description
Auth
GET
/api/teacher/stats
Dashboard statistics
β
GET
/api/teacher/classes
List owned classes
β
POST
/api/teacher/classes
Create a new class
β
DELETE
/api/teacher/classes/:classId
Delete a class
β
POST
/api/teacher/classes/:classId/students
Add students to class
β
DELETE
/api/teacher/classes/:classId/students/:studentId
Remove a student
β
GET
/api/teacher/attendance/:classId
Class attendance records
β
GET
/api/teacher/session/:sessionId
Session detail & results
β
GET
/api/teacher/appeals
List all pending appeals
β
PATCH
/api/teacher/appeals/:appealId
Approve/reject an appeal
β
POST
/api/teacher/classes/:classId/announcements
Post announcement
β
DELETE
/api/teacher/classes/:classId/announcements/:id
Delete announcement
β
Method
Endpoint
Description
Auth
POST
/api/attendance/upload
Upload classroom image (multipart/form-data)
β
Method
Endpoint
Description
Auth
GET
/api/health
API health status
β
Sentry/
βββ Backend/
β βββ config/
β β βββ db.js # MongoDB connection
β βββ controllers/
β β βββ authController.js # Signup, login, profile
β β βββ attendanceController.js # Image upload & processing
β β βββ studentController.js # Student dashboard & actions
β β βββ teacherController.js # Teacher dashboard & management
β βββ middlewares/
β β βββ auth.js # JWT verification & role guard
β β βββ upload.js # Multer file upload config
β β βββ validate.js # express-validator runner
β βββ models/
β β βββ Appeal.js # Attendance appeal schema
β β βββ AttendanceRecord.js # Per-student attendance entry
β β βββ AttendanceSession.js # Photo session metadata
β β βββ Class.js # Course/class schema
β β βββ Student.js # Student profile schema
β β βββ Teacher.js # Teacher profile schema
β β βββ User.js # Base user (auth) schema
β βββ routes/
β β βββ auth.js # Auth endpoints
β β βββ attendance.js # Upload endpoints
β β βββ student.js # Student endpoints
β β βββ teacher.js # Teacher endpoints
β βββ services/
β β βββ attendanceService.js # Attendance processing logic
β β βββ faceRecognitionService.js# YOLO + ArcFace API client
β βββ utils/
β β βββ ApiError.js # Custom error class
β β βββ apiResponse.js # Standardized JSON responses
β β βββ catchAsync.js # Async error wrapper
β β βββ seed.js # Database seeder
β β βββ socket.js # Socket.IO initialization
β βββ .env.example # Environment template
β βββ package.json
β βββ run_task.js # Data migration script
β βββ server.js # App entry point
β
βββ Frontend/
β βββ public/ # Static assets
β βββ src/
β β βββ components/
β β β βββ AuthLeftPanel.jsx # Login/register branding panel
β β β βββ Footer.jsx # App footer
β β β βββ MobileAuthBrand.jsx # Mobile auth branding
β β β βββ Navbar.jsx # Student navigation bar
β β β βββ ProtectedRoute.jsx # Route guard by role
β β β βββ TeacherNavbar.jsx # Teacher navigation bar
β β βββ context/
β β β βββ AuthContext.jsx # Auth state provider
β β β βββ NavContext.jsx # Student nav state
β β β βββ TeacherNavContext.jsx # Teacher nav state
β β βββ Layouts/
β β β βββ DashboardLayout.jsx # Student layout shell
β β β βββ TeacherDashboardLayout.jsx # Teacher layout shell
β β βββ pages/
β β β βββ LoginPage.jsx # Login form
β β β βββ RegisterPage.jsx # Registration form
β β β βββ student/
β β β β βββ StudentDashboard.jsx # Student overview
β β β β βββ StudentCourses.jsx # Course listings
β β β β βββ StudentSummary.jsx # Attendance summary
β β β βββ teacher/
β β β βββ TeacherPage.jsx # Teacher shell
β β β βββ TeacherDashboard.jsx # Stats & overview
β β β βββ TeacherCourses.jsx # Course management
β β β βββ TeacherCourseDetails.jsx # Detailed class view
β β β βββ TeacherAppeals.jsx # Appeal management
β β βββ services/
β β β βββ api.js # Axios instance & API methods
β β β βββ socket.js # Socket.IO client
β β βββ App.jsx # Root component & routing
β β βββ main.jsx # App entry point
β β βββ index.css # Global styles
β βββ index.html
β βββ vite.config.js # Vite + Tailwind + proxy config
β βββ vercel.json # Vercel SPA routing
β βββ package.json
β
βββ README.md
Technology
Purpose
React 19
UI component library
Vite 8
Build tool & dev server
Tailwind CSS 4
Utility-first styling
React Router 7
Client-side routing
Axios
HTTP client
Socket.IO Client
Real-time WebSocket communication
Lucide React
Icon library
Technology
Purpose
Express.js 4
REST API framework
Mongoose 8
MongoDB ODM
JSON Web Tokens
Stateless authentication
Socket.IO 4
Real-time event broadcasting
Multer
File upload handling
Helmet
HTTP security headers
bcryptjs
Password hashing (12 salt rounds)
express-validator
Request validation
Technology
Purpose
YOLOv8
Face detection in classroom images
ArcFace
Face embedding & identity matching
FastAPI
Model serving (external microservice)
Service
Purpose
MongoDB Atlas
Cloud database
Vercel
Frontend deployment
Modal
AI model hosting (optional)
π§ Environment Variables
Variable
Description
Default
PORT
Server port
5000
MONGODB_URI
MongoDB connection string
β
JWT_SECRET
Secret key for signing JWTs
β
JWT_EXPIRES_IN
Token expiration duration
7d
FACE_RECOGNITION_API_URL
URL to the YOLO + ArcFace API
β
UPLOAD_DIR
Directory for uploaded images
uploads
Variable
Description
Default
VITE_API_URL
Backend API base URL
/api (proxied)
User βββ¬ββ Student ββββ AttendanceRecord ββββ Appeal
β β
βββ Teacher β
β β
Class βββββββ AttendanceSession
β
Announcements
Model
Key Fields
User
name, email, password, role (student/teacher/admin), student_id, department
Student
student_id, name, linked User
Teacher
teacher_id, name, department, linked User
Class
class_name, class_code, teacher, students[], schedule, scheduleDays[], announcements[]
AttendanceSession
class, teacher, image_uploaded, recognized_students[], status
AttendanceRecord
student, class, session, date, status (present/absent), confidence_score
Appeal
student, class, attendanceRecord, date, reason, status (pending/approved/rejected), teacherNote
Fork the repository
Create a feature branch: git checkout -b feature/my-feature
Commit your changes: git commit -m "feat: add my feature"
Push to the branch: git push origin feature/my-feature
Open a Pull Request
This project is open source and available under the MIT License .