# kpradeepreddy0/examguard-ai architecture

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

- Interactive diagram: https://gitdiagram.com/kpradeepreddy0/examguard-ai
- Repository: https://github.com/kpradeepreddy0/examguard-ai

## Overview

ExamGuard-AI is a Flask-based online examination and proctoring application. Candidates register or log in, access a dashboard, take a timed multiple-choice exam, and receive browser-based monitoring for face instability and server-assisted phone detection. The backend manages sessions, user records, questions, scoring, and the phone-detection endpoint; browser code handles camera capture, monitoring UI, and the timer. The README also describes head-movement alerts and auto-submission, though sampled code does not show every documented behavior. Connections for unsampled templates and capabilities are limited to README or visible Flask references.

Main entry points: [`app.py`](https://github.com/kpradeepreddy0/examguard-ai/blob/main/app.py) (Auth Routes), [`static/js/exam.js`](https://github.com/kpradeepreddy0/examguard-ai/blob/main/static/js/exam.js) (Exam Client), [`static/js/script.js`](https://github.com/kpradeepreddy0/examguard-ai/blob/main/static/js/script.js) (Camera Monitor), [`templates/login.html`](https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/login.html) (Login Forms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Accounts"]
  node_auth["Auth Routes<br/>[app.py]"]
  node_loginui["Login Forms<br/>[login.html]"]
  node_registerui["Registration Form<br/>[register.html]"]
  node_userdb[("User Database<br/>[users.db]")]
end

subgraph group_exam["Examination"]
  node_dashboard["Dashboard<br/>[dashboard.html]"]
  node_examui["Exam Page<br/>[index.html]"]
  node_questions["Question Bank<br/>[exam_data.py]"]
  node_examapi["Exam Routes<br/>[app.py]"]
  node_examclient["Exam Client<br/>[exam.js]"]
end

subgraph group_proctor["Proctoring"]
  node_monitorclient["Camera Monitor<br/>[script.js]"]
  node_phoneapi["Phone API<br/>[app.py]"]
  node_phonevision["Phone Detector<br/>[phone_detection.py]"]
  node_facevision["Face Detector<br/>[face_detection.py]"]
  node_eyevision["Eye Detection<br/>[eye_detection.py]"]
end

subgraph group_backend["Application Backend"]
end

node_candidate(("Candidate"))
node_browser["Web Browser"]

node_candidate -->|"uses"| node_browser
node_browser -->|"requests access"| node_auth
node_auth -->|"renders"| node_loginui
node_auth -->|"renders"| node_registerui
node_auth -->|"reads and writes"| node_userdb
node_auth -->|"renders"| node_dashboard
node_browser -->|"requests exam"| node_examapi
node_examapi -->|"renders"| node_examui
node_examapi -->|"loads questions"| node_questions
node_browser -->|"runs"| node_examclient
node_examclient -.->|"requests questions"| node_examapi
node_examclient -.->|"submits answers"| node_examapi
node_browser -->|"runs monitoring"| node_monitorclient
node_monitorclient -->|"posts frames"| node_phoneapi
node_phoneapi -->|"detects phones"| node_phonevision
node_monitorclient -->|"uses face detection"| node_browser
node_candidate -.->|"runs camera tool"| node_facevision

click node_auth "https://github.com/kpradeepreddy0/examguard-ai/blob/main/app.py"
click node_loginui "https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/login.html"
click node_registerui "https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/register.html"
click node_userdb "https://github.com/kpradeepreddy0/examguard-ai/blob/main/users.db"
click node_dashboard "https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/dashboard.html"
click node_examui "https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/index.html"
click node_questions "https://github.com/kpradeepreddy0/examguard-ai/blob/main/exam_data.py"
click node_examapi "https://github.com/kpradeepreddy0/examguard-ai/blob/main/app.py"
click node_examclient "https://github.com/kpradeepreddy0/examguard-ai/blob/main/static/js/exam.js"
click node_monitorclient "https://github.com/kpradeepreddy0/examguard-ai/blob/main/static/js/script.js"
click node_phoneapi "https://github.com/kpradeepreddy0/examguard-ai/blob/main/app.py"
click node_phonevision "https://github.com/kpradeepreddy0/examguard-ai/blob/main/phone_detection.py"
click node_facevision "https://github.com/kpradeepreddy0/examguard-ai/blob/main/ai/face_detection.py"
click node_eyevision "https://github.com/kpradeepreddy0/examguard-ai/blob/main/ai/eye_detection.py"

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_auth,node_loginui,node_registerui,node_userdb,node_browser toneBlue
class node_dashboard,node_examui,node_questions,node_examapi,node_examclient toneAmber
class node_monitorclient,node_phoneapi,node_phonevision,node_facevision,node_eyevision toneMint
class node_candidate toneIndigo
```

## Components

### Access and Accounts

- [Auth Routes](https://github.com/kpradeepreddy0/examguard-ai/blob/main/app.py): `app.py`
- [Login Forms](https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/login.html): `templates/login.html`
- [Registration Form](https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/register.html): `templates/register.html`
- [User Database](https://github.com/kpradeepreddy0/examguard-ai/blob/main/users.db): `users.db`

### Examination

- [Dashboard](https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [Exam Page](https://github.com/kpradeepreddy0/examguard-ai/blob/main/templates/index.html): `templates/index.html`
- [Question Bank](https://github.com/kpradeepreddy0/examguard-ai/blob/main/exam_data.py): `exam_data.py`
- [Exam Routes](https://github.com/kpradeepreddy0/examguard-ai/blob/main/app.py): `app.py`
- [Exam Client](https://github.com/kpradeepreddy0/examguard-ai/blob/main/static/js/exam.js): `static/js/exam.js`

### Proctoring

- [Camera Monitor](https://github.com/kpradeepreddy0/examguard-ai/blob/main/static/js/script.js): `static/js/script.js`
- [Phone API](https://github.com/kpradeepreddy0/examguard-ai/blob/main/app.py): `app.py`
- [Phone Detector](https://github.com/kpradeepreddy0/examguard-ai/blob/main/phone_detection.py): `phone_detection.py`
- [Face Detector](https://github.com/kpradeepreddy0/examguard-ai/blob/main/ai/face_detection.py): `ai/face_detection.py`
- [Eye Detection](https://github.com/kpradeepreddy0/examguard-ai/blob/main/ai/eye_detection.py): `ai/eye_detection.py`

### Other components

- **Candidate**
- **Web Browser**

## Connections

- Candidate → Web Browser: uses (evidence: `README.md`)
- Web Browser → Auth Routes: requests access (evidence: `README.md`)
- Auth Routes → Login Forms: renders (evidence: `app.py`)
- Auth Routes → Registration Form: renders (evidence: `app.py`)
- Auth Routes → User Database: reads and writes (evidence: `app.py`)
- Auth Routes → Dashboard: renders (evidence: `app.py`)
- Web Browser → Exam Routes: requests exam (evidence: `README.md`)
- Exam Routes → Exam Page: renders (evidence: `app.py`)
- Exam Routes → Question Bank: loads questions (evidence: `app.py`)
- Web Browser → Exam Client: runs (evidence: `README.md`)
- Exam Client → Exam Routes: requests questions
- Exam Client → Exam Routes: submits answers
- Web Browser → Camera Monitor: runs monitoring (evidence: `README.md`)
- Camera Monitor → Phone API: posts frames (evidence: `static/js/script.js`)
- Phone API → Phone Detector: detects phones (evidence: `app.py`)
- Camera Monitor → Web Browser: uses face detection (evidence: `static/js/script.js`)
- Candidate → Face Detector: runs camera tool
