# hemeshhere/ai-based-exam-evaluation-system architecture

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

- Interactive diagram: https://gitdiagram.com/hemeshhere/ai-based-exam-evaluation-system
- Repository: https://github.com/hemeshhere/ai-based-exam-evaluation-system

## Overview

This MERN exam system supports teacher-led exam creation, student exam sessions, AI-assisted subjective grading, and published results, alongside dashboards, schedules, profiles, and issue reporting. The frontend routes role-specific users through React pages and API services; the Express backend authenticates requests, dispatches controllers, and persists domain records in MongoDB. The sampled source shows the main exam and auth flows, but several page and controller implementations were not sampled, so their internal links are omitted or documented only at the API boundary.

Main entry points: [`Backend/server.js`](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/server.js) (HTTP server), [`Frontend/src/routes/AppRoutes.jsx`](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/routes/AppRoutes.jsx) (Role routes), [`Frontend/src/services/apiServices.js`](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/services/apiServices.js) (API services), [`Backend/src/controllers/teacherController.js`](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/controllers/teacherController.js) (Exam and grading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["App entry<br/>[main.jsx]"]
  node_routes["Role routes<br/>[AppRoutes.jsx]"]
  node_authui["Login and auth<br/>[AuthContext.jsx]"]
  node_studentexam["Exam taking<br/>[StudentExam.jsx]"]
  node_studentareas["Student services"]
  node_teacherareas["Teacher workspace"]
  node_apiservices["API services<br/>[apiServices.js]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_authcontroller["Authentication<br/>[authController.js]"]
  node_middleware["Access control<br/>[authmiddleware.js]"]
  node_examroutes["Exam routes<br/>[teacherRoutes.js]"]
  node_studentcontroller["Student exam flow"]
  node_teachercontroller["Exam and grading"]
  node_othercontrollers["Other API features"]
end

subgraph group_data["Domain data"]
  node_students[("Student records<br/>[student.model.js]")]
  node_teachers[("Teacher records<br/>[teacher.model.js]")]
  node_examdata[("Exam and questions<br/>[exam.model.js]")]
  node_submissions[("Submissions")]
  node_issues[("Issue records<br/>[issue.model.js]")]
end

subgraph group_integrations["External services"]
  node_ai["Gemini AI"]
  node_mongodb[("MongoDB")]
end

node_student(("Student"))
node_teacher(("Teacher"))

node_app -->|"renders"| node_routes
node_routes -->|"uses auth state"| node_authui
node_routes -->|"routes to"| node_studentexam
node_student -.->|"opens app"| node_routes
node_teacher -.->|"opens app"| node_routes
node_authui -->|"calls auth APIs"| node_apiservices
node_student -.->|"takes exam"| node_studentexam
node_studentexam -->|"loads and submits"| node_apiservices
node_studentareas -.->|"uses API"| node_apiservices
node_teacherareas -.->|"uses API"| node_apiservices
node_apiservices -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_examroutes
node_server -->|"mounts feature routes"| node_othercontrollers
node_authroutes -->|"dispatches"| node_authcontroller
node_examroutes -->|"dispatches"| node_teachercontroller
node_examroutes -->|"checks role"| node_middleware
node_server -.->|"routes student API"| node_studentcontroller
node_authcontroller -->|"reads and creates"| node_students
node_authcontroller -->|"reads and creates"| node_teachers
node_middleware -->|"loads identity"| node_students
node_middleware -->|"loads identity"| node_teachers
node_studentcontroller -->|"reads exams"| node_examdata
node_studentcontroller -->|"creates and updates"| node_submissions
node_teachercontroller -->|"creates and reads"| node_examdata
node_teachercontroller -->|"reads and updates"| node_submissions
node_teachercontroller -->|"requests grading"| node_ai
node_othercontrollers -.->|"manages reports"| node_issues
node_server -->|"connects"| node_mongodb
node_teacher -.->|"manages exams"| node_teacherareas
node_teacherareas -.->|"AI evaluation capability"| node_ai

click node_app "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/main.jsx"
click node_routes "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/routes/AppRoutes.jsx"
click node_authui "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/context/AuthContext.jsx"
click node_studentexam "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/pages/StudentExam.jsx"
click node_studentareas "https://github.com/hemeshhere/ai-based-exam-evaluation-system/tree/main/Frontend/src/pages"
click node_teacherareas "https://github.com/hemeshhere/ai-based-exam-evaluation-system/tree/main/Frontend/src/pages"
click node_apiservices "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/services/apiServices.js"
click node_server "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/server.js"
click node_authroutes "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/routes/authRoutes.js"
click node_authcontroller "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/controllers/authController.js"
click node_middleware "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/middlewares/authmiddleware.js"
click node_examroutes "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/routes/teacherRoutes.js"
click node_studentcontroller "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/controllers/studentController.js"
click node_teachercontroller "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/controllers/teacherController.js"
click node_othercontrollers "https://github.com/hemeshhere/ai-based-exam-evaluation-system/tree/main/Backend/src/controllers"
click node_students "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/student.model.js"
click node_teachers "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/teacher.model.js"
click node_examdata "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/exam.model.js"
click node_submissions "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/submission.model.js"
click node_issues "https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/issue.model.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_routes,node_authui,node_studentexam,node_studentareas,node_teacherareas,node_apiservices toneBlue
class node_server,node_authroutes,node_authcontroller,node_middleware,node_examroutes,node_studentcontroller,node_teachercontroller,node_othercontrollers toneAmber
class node_students,node_teachers,node_examdata,node_submissions,node_issues toneMint
class node_ai,node_mongodb toneRose
class node_student,node_teacher toneIndigo
```

## Components

### Web experience

- [App entry](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/main.jsx): `Frontend/src/main.jsx`
- [Role routes](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/routes/AppRoutes.jsx): `Frontend/src/routes/AppRoutes.jsx`
- [Login and auth](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/context/AuthContext.jsx): `Frontend/src/context/AuthContext.jsx`
- [Exam taking](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/pages/StudentExam.jsx): `Frontend/src/pages/StudentExam.jsx`
- [Student services](https://github.com/hemeshhere/ai-based-exam-evaluation-system/tree/main/Frontend/src/pages): `Frontend/src/pages`
- [Teacher workspace](https://github.com/hemeshhere/ai-based-exam-evaluation-system/tree/main/Frontend/src/pages): `Frontend/src/pages`
- [API services](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Frontend/src/services/apiServices.js): `Frontend/src/services/apiServices.js`

### Backend API

- [HTTP server](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/server.js): `Backend/server.js`
- [Auth routes](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/routes/authRoutes.js): `Backend/src/routes/authRoutes.js`
- [Authentication](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/controllers/authController.js): `Backend/src/controllers/authController.js`
- [Access control](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/middlewares/authmiddleware.js): `Backend/src/middlewares/authmiddleware.js`
- [Exam routes](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/routes/teacherRoutes.js): `Backend/src/routes/teacherRoutes.js`
- [Student exam flow](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/controllers/studentController.js): `Backend/src/controllers/studentController.js`
- [Exam and grading](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/controllers/teacherController.js): `Backend/src/controllers/teacherController.js`
- [Other API features](https://github.com/hemeshhere/ai-based-exam-evaluation-system/tree/main/Backend/src/controllers): `Backend/src/controllers`

### Domain data

- [Student records](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/student.model.js): `Backend/src/models/student.model.js`
- [Teacher records](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/teacher.model.js): `Backend/src/models/teacher.model.js`
- [Exam and questions](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/exam.model.js): `Backend/src/models/exam.model.js`
- [Submissions](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/submission.model.js): `Backend/src/models/submission.model.js`
- [Issue records](https://github.com/hemeshhere/ai-based-exam-evaluation-system/blob/main/Backend/src/models/issue.model.js): `Backend/src/models/issue.model.js`

### External services

- **Gemini AI**
- **MongoDB**

### Other components

- **Student**
- **Teacher**

## Connections

- App entry → Role routes: renders
- Role routes → Login and auth: uses auth state (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Role routes → Exam taking: routes to (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Student → Role routes: opens app
- Teacher → Role routes: opens app
- Login and auth → API services: calls auth APIs (evidence: `Frontend/src/context/AuthContext.jsx`)
- Student → Exam taking: takes exam
- Exam taking → API services: loads and submits (evidence: `Frontend/src/pages/StudentExam.jsx`)
- Student services → API services: uses API (evidence: `Frontend/src/pages/StudentExam.jsx`)
- Teacher workspace → API services: uses API (evidence: `Frontend/src/pages/StudentExam.jsx`)
- API services → HTTP server: HTTP requests (evidence: `Frontend/src/services/apiServices.js`)
- HTTP server → Auth routes: mounts (evidence: `Backend/server.js`)
- HTTP server → Exam routes: mounts (evidence: `Backend/server.js`)
- HTTP server → Other API features: mounts feature routes (evidence: `Backend/server.js`)
- Auth routes → Authentication: dispatches (evidence: `Backend/src/routes/authRoutes.js`)
- Exam routes → Exam and grading: dispatches (evidence: `Backend/src/routes/teacherRoutes.js`)
- Exam routes → Access control: checks role (evidence: `Backend/src/routes/teacherRoutes.js`)
- HTTP server → Student exam flow: routes student API
- Authentication → Student records: reads and creates (evidence: `Backend/src/controllers/authController.js`)
- Authentication → Teacher records: reads and creates (evidence: `Backend/src/controllers/authController.js`)
- Access control → Student records: loads identity (evidence: `Backend/src/middlewares/authmiddleware.js`)
- Access control → Teacher records: loads identity (evidence: `Backend/src/middlewares/authmiddleware.js`)
- Student exam flow → Exam and questions: reads exams (evidence: `Backend/src/controllers/studentController.js`)
- Student exam flow → Submissions: creates and updates (evidence: `Backend/src/controllers/studentController.js`)
- Exam and grading → Exam and questions: creates and reads (evidence: `Backend/src/controllers/teacherController.js`)
- Exam and grading → Submissions: reads and updates (evidence: `Backend/src/controllers/teacherController.js`)
- Exam and grading → Gemini AI: requests grading (evidence: `Backend/src/controllers/teacherController.js`)
- Other API features → Issue records: manages reports (evidence: `Backend/src/controllers/dashboardController.js`)
- HTTP server → MongoDB: connects (evidence: `Backend/server.js`)
- Teacher → Teacher workspace: manages exams
- Teacher workspace → Gemini AI: AI evaluation capability
