AI-powered online exam proctoring β real-time webcam analysis, browser lockdown, audio monitoring, violation logging, and admin review dashboards.
Features Β· Demo Β· Installation Β· Usage Β· API Β· Architecture Β· Contributing
Repository: github.com/Sathvik257/AI-Anti-Cheating-System
AI Anti-Cheating System is a full-stack exam integrity platform for schools and online assessments. Students take proctored exams in the browser (or optional Electron desktop app); the system detects suspicious behavior with TensorFlow.js (face + object detection), logs violations to MongoDB, and gives admins tools to review evidence and AI-generated risk summaries.
| Component | Path | Default |
|---|---|---|
| Frontend | AI-Exam/ |
http://localhost:8080 |
| Backend API | AI-Exam/backend-code/ |
http://localhost:3000 |
| Database | MongoDB | Port 27018 (local) or Atlas |
| Feature | Description |
|---|---|
| Auth | Register, JWT login, protected exam routes |
| Pre-exam wizard | Rules β device checks β calibration β blocked apps β start |
| AI proctoring | BlazeFace (faces/gaze) + COCO-SSD (phones, books, etc.) |
| Audio monitor | Mic level tracking, loud-noise violations (20% threshold) |
| Browser lockdown | Blocks tab switch, copy/paste, DevTools, right-click, screenshots |
| Identity check | Face enrollment + continuous verification during exam |
| Exam timer | Countdown with auto-submit on critical violations |
| Dashboard | History, scores, violation counts at /dashboard |
| AI assistant | In-exam coach, accessibility (large text, contrast, voice hints) |
| Feature | Description |
|---|---|
| Admin dashboard | All violations & sessions β /admin |
| Analytics | Charts & trends β /analytics |
| Violation review | Mark as benign (false positive) or confirmed |
| AI session summary | Risk score, flags, evidence timeline (OpenAI-compatible API) |
| User management | List users and exams via REST API |
- Session video recording on submit
- Multi-exam types (quiz, coding, essay, mixed)
- Optional Electron shell for real OS process scanning (Teams, Zoom, Discord, etc.)
Add screenshots or a screen recording after deployment and place them here.
| Screen | Description |
|---|---|
| Landing | Home page with login/register |
| Pre-exam setup | 5-step wizard with calibration |
| Live exam | Webcam + violation log + timer |
| Admin dashboard | Violations and session review |
Suggested assets (add to repo later):
docs/screenshots/landing.png
docs/screenshots/exam.png
docs/screenshots/admin.png
Frontend React 18 Β· TypeScript Β· Vite Β· Tailwind CSS Β· shadcn/ui
AI/ML TensorFlow.js Β· BlazeFace Β· COCO-SSD
Backend Node.js Β· Express Β· Mongoose Β· JWT Β· bcrypt
Database MongoDB (local or Atlas)
Desktop Electron 35 (optional)
Testing Vitest Β· Testing Library
- Node.js 18+
- MongoDB (local) or MongoDB Atlas
- Webcam & microphone
- Chrome, Edge, or Firefox (HTTPS required in production)
git clone https://github.com/Sathvik257/AI-Anti-Cheating-System.git
cd AI-Anti-Cheating-System/AI-Exam# Frontend
npm install
# Backend
cd backend-code
npm install
cd ..Never commit .env files. Add them to .gitignore (already recommended).
AI-Exam/backend-code/.env
MONGODB_URI=mongodb://localhost:27018/anticheating_exam
JWT_SECRET=replace-with-a-long-random-secret
PORT=3000
JWT_EXPIRES_IN=1h
FRONTEND_URL=http://localhost:8080
# Optional β admin AI summaries
OPENAI_API_KEY=
OPENAI_BASE_URL=https://api.openai.com
OPENAI_MODEL=gpt-4o-miniAI-Exam/.env (optional in dev)
VITE_API_URL=http://localhost:3000/apiIn development, Vite proxies /api β http://127.0.0.1:3000, so you can skip VITE_API_URL.
MongoDB Atlas:
MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/anticheating_examTerminal 1 β MongoDB (Windows)
cd AI-Exam
.\start-mongodb-27018.batTerminal 2 β Backend
cd AI-Exam/backend-code
npm run devTerminal 3 β Frontend
cd AI-Exam
npm run devcd AI-Exam/backend-code
node create-admin.js| Field | Default |
|---|---|
admin@example.com |
|
| Password | admin123 |
Change these before production.
| Route | Role | Purpose |
|---|---|---|
/ |
Public | Landing |
/login |
Public | Login |
/register |
Public | Student signup |
/exam/setup |
Student | Pre-exam wizard |
/exam |
Student | Live proctored exam |
/dashboard |
Student | Exam history |
/admin |
Admin | Violations & sessions |
/analytics |
Admin | Statistics & charts |
Browser only β fastest setup; blocked apps use manual student confirmation.
# MongoDB + backend + frontend (see Installation)Electron + OS process scan β detects Teams, Zoom, Discord, Slack, AnyDesk, TeamViewer, Webex.
cd AI-Exam
npm run dev # Terminal A
npm run electron:open # Terminal B (or npm run electron:dev for both)Frontend only β UI works; login/API will fail without backend.
- Accept integrity rules
- Check internet, webcam, microphone
- Calibrate lighting, face position, mic baseline
- Close blocked messaging/remote apps (
ProhibitedAppsGate) - Review summary β Start exam
| Layer | What it does |
|---|---|
| OS (Electron) | Scans running processes before exam |
| Browser | Tab switch, clipboard, DevTools, fullscreen, Print Screen |
| Audio | Loud noise above 20%, 5s cooldown |
| AI vision | Face count, gaze, obscured face, prohibited objects (~2s interval) |
| Violations | Timestamps, optional face screenshots, admin review workflow |
Auto-submit triggers (examples): multiple faces, tab switch (per exam policy).
flowchart LR
A[Student UI] --> B[Vite :8080]
B -->|/api proxy| C[Express :3000]
C --> D[(MongoDB)]
A --> E[TensorFlow.js]
A --> F[Electron optional]
F --> G[OS Process Scan]
Project structure
AI-Anti-Cheating-System/
βββ AI-Exam/
βββ electron/ # Desktop shell (process scan)
βββ backend-code/ # Express API
β βββ server.js
β βββ routes/
β βββ controllers/
β βββ models/
β βββ middleware/
βββ src/
β βββ pages/
β βββ components/
β βββ hooks/ # useAIProctoring, useWebcam, β¦
β βββ contexts/
β βββ lib/api.ts
βββ vite.config.ts
βββ package.json
Deep dive: AI-Exam/ARCHITECTURE.md
Base URL: http://localhost:3000/api
Auth header: Authorization: Bearer <token> (from login, stored as auth_token)
GET /api/health| Method | Endpoint | Auth |
|---|---|---|
| POST | /api/auth/register |
No |
| POST | /api/auth/login |
No |
| GET | /api/auth/me |
Yes |
| POST | /api/auth/logout |
Yes |
Register example:
{
"name": "Jane Student",
"email": "jane@school.edu",
"password": "securepass123",
"studentId": "STU-001"
}| Method | Endpoint |
|---|---|
| POST | /api/violations |
| GET | /api/violations |
| Method | Endpoint |
|---|---|
| POST | /api/exams |
| GET | /api/exams/active |
| GET | /api/exams/:id |
| POST | /api/exams/sessions/start |
| POST | /api/exams/sessions/submit |
| GET | /api/exams/sessions/history |
| GET | /api/exams/sessions/:id |
| Method | Endpoint |
|---|---|
| GET | /api/analytics/violations |
| GET | /api/analytics/sessions |
| Method | Endpoint |
|---|---|
| GET | /api/admin/violations |
| GET | /api/admin/violations/:id |
| PATCH | /api/admin/violations/:id/review |
| GET | /api/admin/sessions |
| GET | /api/admin/sessions/:id/ai-summary |
| GET | /api/admin/users |
| GET | /api/admin/exams |
| Collection | Stores |
|---|---|
users |
Students & admins |
exams |
Exam definitions |
examsessions |
Sessions, scores, recordings |
violations |
Events + review status |
| Command | Description |
|---|---|
npm run dev |
Dev server β :8080 |
npm run build |
Production build β dist/ |
npm run preview |
Preview production build |
npm run lint |
ESLint |
npm test |
Vitest |
npm run electron:dev |
Vite + Electron |
npm run electron:open |
Electron only |
| Command | Description |
|---|---|
npm run dev |
Nodemon β :3000 |
npm start |
Production server |
node create-admin.js |
Seed admin user |
- Build frontend:
cd AI-Exam && npm run build - Host
dist/behind HTTPS (required for camera/microphone) - Deploy backend with production
MONGODB_URI,JWT_SECRET,FRONTEND_URL - Set
VITE_API_URLto your public API URL - Rotate default admin password
- Do not commit secrets; use environment variables on your host (Railway, Render, VPS, etc.)
| Resource | Approximate |
|---|---|
| Bundle + models | ~2β3 MB |
| Model load time | 5β10 s |
| Detection interval | ~2 s |
| RAM (with models) | 100β200 MB |
| Issue | Fix |
|---|---|
Cannot connect to server |
Run npm run dev in backend-code |
| MongoDB error | Start start-mongodb-27018.bat or fix MONGODB_URI |
| CORS / Failed to fetch | Use dev proxy (/api) or match FRONTEND_URL |
| No admin menu | Run create-admin.js, re-login, check role: "admin" |
| Camera blocked | Allow permissions; use HTTPS in prod |
| AI models slow | Wait for first download; check network |
| Blocked apps stuck | Use Electron or confirm each app manually |
More guides:
Contributions are welcome.
- Fork the repository
- Create a branch:
git checkout -b feature/your-feature - Commit changes:
git commit -m "Add your feature" - Push:
git push origin feature/your-feature - Open a Pull Request against
main
Please do not commit .env, credentials, or API keys.
- Exam monitoring requires explicit student consent (rules step)
- Violation screenshots are face-focused evidence for review
- JWT tokens stored in
localStorageβ use HTTPS in production - Admin AI summaries are advisory; they do not auto-fail students
- Review workflow supports false-positive marking (
benign)
This project is private and proprietary unless the repository owner publishes an open-source license.
- GitHub: @Sathvik257
- Repository: AI-Anti-Cheating-System
If this project helps you, consider giving it a star on GitHub.
Built for secure, fair online examinations with transparent admin review.