# saivighnesh811/anti_cheating_system architecture

> Architecture diagram of the GitHub repository saivighnesh811/anti_cheating_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saivighnesh811/anti_cheating_system
- Repository: https://github.com/saivighnesh811/anti_cheating_system

## Overview

This is a role-based online exam and proctoring application. Users register or sign in, then follow student, administrator, or super-administrator workflows: students take and review exams; administrators create exams and monitor attempts and violations; super-administrators manage platform-level activity. The frontend routes these workflows to an Express API, whose route handlers use MongoDB models. Authentication, password recovery, and profile management form a separate account stage. Frontend-to-API edges reflect sampled imports; the HTTP connection to backend routes is strongly implied but not directly shown in a shared excerpt.

Main entry points: [`client/src/App.jsx`](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/App.jsx) (Route application), [`server/index.js`](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/index.js) (Express router), [`client/src/services/api.js`](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/services/api.js) (HTTP client), [`server/routes/exam.js`](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/exam.js) (Exam API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Route application<br/>[App.jsx]"]
  node_toast["Toast notifications<br/>[ToastContext.jsx]"]
end

subgraph group_accounts["Accounts and access"]
  node_authctx["Session context<br/>[AuthContext.jsx]"]
  node_accountpages["Account pages"]
  node_profile["Profile<br/>[Profile.jsx]"]
  node_authroute["Authentication API<br/>[auth.js]"]
  node_userroute["User API<br/>[user.js]"]
end

subgraph group_exams["Exam workflows"]
  node_studentdash["Student dashboard"]
  node_takeexam["Take exam<br/>[TakeExam.jsx]"]
  node_anticheat["Exam safeguards<br/>[useAntiCheat.js]"]
  node_lockdown["Browser lockdown<br/>[useLockdown.js]"]
  node_review["Exam review<br/>[ReviewExam.jsx]"]
  node_admindash["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_createexam["Exam authoring<br/>[CreateExam.jsx]"]
  node_superadmin["Super-admin dashboard"]
  node_examroute["Exam API<br/>[exam.js]"]
  node_attemptroute["Attempt and proctoring API<br/>[attempt.js]"]
  node_reportroute["Report API<br/>[report.js]"]
  node_studentroute["Student API<br/>[student.js]"]
  node_superroute["Super-admin API<br/>[superadmin.js]"]
end

subgraph group_platform["API and data"]
  node_api["HTTP client<br/>[api.js]"]
  node_server["Express router<br/>[index.js]"]
  node_middleware["Access middleware<br/>[auth.js]"]
  node_userdb[("User records<br/>[User.js]")]
  node_examdb[("Exam records<br/>[Exam.js]")]
  node_attemptdb[("Attempt records<br/>[Attempt.js]")]
  node_violationdb[("Violation records<br/>[ViolationLog.js]")]
  node_auditdb[("Audit records<br/>[AuditLog.js]")]
  node_logindb[("Login activity<br/>[LoginActivity.js]")]
  node_upload["Upload middleware<br/>[upload.js]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_accountpages
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_studentdash
node_app -->|"routes to"| node_takeexam
node_app -->|"routes to"| node_review
node_app -->|"routes to"| node_admindash
node_app -->|"routes to"| node_createexam
node_app -->|"routes to"| node_superadmin
node_app -->|"checks session"| node_authctx
node_app -->|"provides"| node_toast
node_authctx -->|"calls"| node_api
node_accountpages -->|"uses"| node_authctx
node_profile -->|"calls"| node_api
node_studentdash -->|"calls"| node_api
node_takeexam -->|"calls"| node_api
node_takeexam -->|"uses"| node_anticheat
node_takeexam -->|"uses"| node_lockdown
node_review -->|"calls"| node_api
node_admindash -->|"calls"| node_api
node_createexam -->|"calls"| node_api
node_superadmin -->|"calls"| node_api
node_api -.->|"sends HTTP requests"| node_server
node_server -->|"mounts"| node_authroute
node_server -->|"mounts"| node_examroute
node_server -->|"mounts"| node_attemptroute
node_server -->|"mounts"| node_reportroute
node_server -->|"mounts"| node_studentroute
node_server -->|"mounts"| node_superroute
node_server -->|"mounts"| node_userroute
node_authroute -->|"reads and writes"| node_userdb
node_authroute -->|"records sign-ins"| node_logindb
node_authroute -->|"protects profile"| node_middleware
node_middleware -->|"loads user"| node_userdb
node_attemptroute -->|"protects routes"| node_middleware
node_attemptroute -->|"reads and writes"| node_attemptdb
node_attemptroute -->|"loads exam"| node_examdb
node_attemptroute -->|"reads and writes"| node_violationdb
node_examroute -->|"uses"| node_examdb
node_examroute -->|"uses"| node_attemptdb
node_examroute -->|"uses"| node_violationdb
node_examroute -->|"uses"| node_auditdb
node_reportroute -->|"reads"| node_attemptdb
node_reportroute -->|"reads"| node_violationdb
node_studentroute -->|"uses"| node_userdb
node_superroute -->|"uses"| node_userdb
node_superroute -->|"uses"| node_examdb
node_superroute -->|"uses"| node_attemptdb

click node_app "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/App.jsx"
click node_authctx "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/context/AuthContext.jsx"
click node_toast "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/context/ToastContext.jsx"
click node_accountpages "https://github.com/saivighnesh811/anti_cheating_system/tree/main/client/src/pages"
click node_profile "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/Profile.jsx"
click node_studentdash "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/StudentDashboard.jsx"
click node_takeexam "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/TakeExam.jsx"
click node_anticheat "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/hooks/useAntiCheat.js"
click node_lockdown "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/hooks/useLockdown.js"
click node_review "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/ReviewExam.jsx"
click node_admindash "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/AdminDashboard.jsx"
click node_createexam "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/CreateExam.jsx"
click node_superadmin "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/SuperAdminDashboard.jsx"
click node_api "https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/services/api.js"
click node_server "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/index.js"
click node_authroute "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/auth.js"
click node_middleware "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/middleware/auth.js"
click node_examroute "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/exam.js"
click node_attemptroute "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/attempt.js"
click node_reportroute "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/report.js"
click node_studentroute "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/student.js"
click node_superroute "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/superadmin.js"
click node_userroute "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/user.js"
click node_userdb "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/User.js"
click node_examdb "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/Exam.js"
click node_attemptdb "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/Attempt.js"
click node_violationdb "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/ViolationLog.js"
click node_auditdb "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/AuditLog.js"
click node_logindb "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/LoginActivity.js"
click node_upload "https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/middleware/upload.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_toast,node_user toneBlue
class node_authctx,node_accountpages,node_profile,node_authroute,node_userroute toneAmber
class node_studentdash,node_takeexam,node_anticheat,node_lockdown,node_review,node_admindash,node_createexam,node_superadmin,node_examroute,node_attemptroute,node_reportroute,node_studentroute,node_superroute toneMint
class node_api,node_server,node_middleware,node_userdb,node_examdb,node_attemptdb,node_violationdb,node_auditdb,node_logindb,node_upload toneRose
```

## Components

### Web application

- [Route application](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Toast notifications](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/context/ToastContext.jsx): `client/src/context/ToastContext.jsx`

### Accounts and access

- [Session context](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Account pages](https://github.com/saivighnesh811/anti_cheating_system/tree/main/client/src/pages): `client/src/pages`
- [Profile](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Authentication API](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [User API](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/user.js): `server/routes/user.js`

### Exam workflows

- [Student dashboard](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/StudentDashboard.jsx): `client/src/pages/StudentDashboard.jsx`
- [Take exam](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/TakeExam.jsx): `client/src/pages/TakeExam.jsx`
- [Exam safeguards](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/hooks/useAntiCheat.js): `client/src/hooks/useAntiCheat.js`
- [Browser lockdown](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/hooks/useLockdown.js): `client/src/hooks/useLockdown.js`
- [Exam review](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/ReviewExam.jsx): `client/src/pages/ReviewExam.jsx`
- [Admin dashboard](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/AdminDashboard.jsx): `client/src/pages/AdminDashboard.jsx`
- [Exam authoring](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/CreateExam.jsx): `client/src/pages/CreateExam.jsx`
- [Super-admin dashboard](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/pages/SuperAdminDashboard.jsx): `client/src/pages/SuperAdminDashboard.jsx`
- [Exam API](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/exam.js): `server/routes/exam.js`
- [Attempt and proctoring API](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/attempt.js): `server/routes/attempt.js`
- [Report API](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/report.js): `server/routes/report.js`
- [Student API](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/student.js): `server/routes/student.js`
- [Super-admin API](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/routes/superadmin.js): `server/routes/superadmin.js`

### API and data

- [HTTP client](https://github.com/saivighnesh811/anti_cheating_system/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Express router](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/index.js): `server/index.js`
- [Access middleware](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [User records](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/User.js): `server/models/User.js`
- [Exam records](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/Exam.js): `server/models/Exam.js`
- [Attempt records](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/Attempt.js): `server/models/Attempt.js`
- [Violation records](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/ViolationLog.js): `server/models/ViolationLog.js`
- [Audit records](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/AuditLog.js): `server/models/AuditLog.js`
- [Login activity](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/models/LoginActivity.js): `server/models/LoginActivity.js`
- [Upload middleware](https://github.com/saivighnesh811/anti_cheating_system/blob/main/server/middleware/upload.js): `server/middleware/upload.js`

### Other components

- **User**

## Connections

- User → Route application: uses (evidence: `client/src/App.jsx`)
- Route application → Account pages: routes to (evidence: `client/src/App.jsx`)
- Route application → Profile: routes to (evidence: `client/src/App.jsx`)
- Route application → Student dashboard: routes to (evidence: `client/src/App.jsx`)
- Route application → Take exam: routes to (evidence: `client/src/App.jsx`)
- Route application → Exam review: routes to (evidence: `client/src/App.jsx`)
- Route application → Admin dashboard: routes to (evidence: `client/src/App.jsx`)
- Route application → Exam authoring: routes to (evidence: `client/src/App.jsx`)
- Route application → Super-admin dashboard: routes to (evidence: `client/src/App.jsx`)
- Route application → Session context: checks session (evidence: `client/src/App.jsx`)
- Route application → Toast notifications: provides (evidence: `client/src/App.jsx`)
- Session context → HTTP client: calls (evidence: `client/src/context/AuthContext.jsx`)
- Account pages → Session context: uses (evidence: `client/src/pages/Login.jsx`)
- Profile → HTTP client: calls (evidence: `client/src/pages/Profile.jsx`)
- Student dashboard → HTTP client: calls (evidence: `client/src/pages/StudentDashboard.jsx`)
- Take exam → HTTP client: calls (evidence: `client/src/pages/TakeExam.jsx`)
- Take exam → Exam safeguards: uses (evidence: `client/src/pages/TakeExam.jsx`)
- Take exam → Browser lockdown: uses (evidence: `client/src/pages/TakeExam.jsx`)
- Exam review → HTTP client: calls (evidence: `client/src/pages/ReviewExam.jsx`)
- Admin dashboard → HTTP client: calls (evidence: `client/src/pages/AdminDashboard.jsx`)
- Exam authoring → HTTP client: calls (evidence: `client/src/pages/CreateExam.jsx`)
- Super-admin dashboard → HTTP client: calls (evidence: `client/src/pages/SuperAdminDashboard.jsx`)
- HTTP client → Express router: sends HTTP requests
- Express router → Authentication API: mounts (evidence: `server/index.js`)
- Express router → Exam API: mounts (evidence: `server/index.js`)
- Express router → Attempt and proctoring API: mounts (evidence: `server/index.js`)
- Express router → Report API: mounts (evidence: `server/index.js`)
- Express router → Student API: mounts (evidence: `server/index.js`)
- Express router → Super-admin API: mounts (evidence: `server/index.js`)
- Express router → User API: mounts (evidence: `server/index.js`)
- Authentication API → User records: reads and writes (evidence: `server/routes/auth.js`)
- Authentication API → Login activity: records sign-ins (evidence: `server/routes/auth.js`)
- Authentication API → Access middleware: protects profile (evidence: `server/routes/auth.js`)
- Access middleware → User records: loads user (evidence: `server/middleware/auth.js`)
- Attempt and proctoring API → Access middleware: protects routes (evidence: `server/routes/attempt.js`)
- Attempt and proctoring API → Attempt records: reads and writes (evidence: `server/routes/attempt.js`)
- Attempt and proctoring API → Exam records: loads exam (evidence: `server/routes/attempt.js`)
- Attempt and proctoring API → Violation records: reads and writes (evidence: `server/routes/attempt.js`)
- Exam API → Exam records: uses (evidence: `server/routes/exam.js`)
- Exam API → Attempt records: uses (evidence: `server/routes/exam.js`)
- Exam API → Violation records: uses (evidence: `server/routes/exam.js`)
- Exam API → Audit records: uses (evidence: `server/routes/exam.js`)
- Report API → Attempt records: reads (evidence: `server/routes/report.js`)
- Report API → Violation records: reads (evidence: `server/routes/report.js`)
- Student API → User records: uses (evidence: `server/routes/student.js`)
- Super-admin API → User records: uses (evidence: `server/routes/superadmin.js`)
- Super-admin API → Exam records: uses (evidence: `server/routes/superadmin.js`)
- Super-admin API → Attempt records: uses (evidence: `server/routes/superadmin.js`)
