# bayaraa07-27/diplom architecture

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

- Interactive diagram: https://gitdiagram.com/bayaraa07-27/diplom
- Repository: https://github.com/bayaraa07-27/diplom

## Overview

FaceAttend is a web-based student attendance system centered on webcam face recognition, with enrollment, liveness checks, schedule-aware attendance, manual corrections, and reporting. Users authenticate in the React interface; its API client sends requests to Flask routes, which apply domain logic and persist records in MongoDB. The recognition path uses ArcFace embeddings and can apply texture-based anti-spoofing. The graph preserves the README’s major capabilities, but several route implementations were not excerpted; those connections rely on documented API behavior rather than inspection of their internals.

Main entry points: [`frontend/src/utils/api.js`](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/utils/api.js) (HTTP client), [`frontend/src/App.jsx`](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/App.jsx) (React routes), [`backend/app.py`](https://github.com/bayaraa07-27/diplom/blob/main/backend/app.py) (Flask app), [`backend/database.py`](https://github.com/bayaraa07-27/diplom/blob/main/backend/database.py) (MongoDB)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["React routes<br/>[App.jsx]"]
  node_auth_ui["Auth state<br/>[useAuth.jsx]"]
  node_api_client["HTTP client<br/>[api.js]"]
  node_attendance_ui["Attendance scanning<br/>[Attendance.jsx]"]
  node_attendance_state["Attendance state"]
  node_enroll_ui["Face enrollment<br/>[Enroll.jsx]"]
  node_students_ui["Student management<br/>[Students.jsx]"]
  node_schedule_ui["Schedule management<br/>[Schedules.jsx]"]
  node_reports_ui["Attendance reports<br/>[Reports.jsx]"]
  node_dashboard_ui["Dashboard<br/>[Dashboard.jsx]"]
  node_dropdown["Dropdown control<br/>[Dropdown.jsx]"]
end

subgraph group_api["Flask API"]
  node_flask["Flask app<br/>[app.py]"]
  node_auth_routes["Authentication<br/>[auth.py]"]
  node_student_routes["Student routes<br/>[students.py]"]
  node_attendance_routes["Attendance routes<br/>[attendance.py]"]
  node_schedule_routes["Schedule routes<br/>[schedules.py]"]
  node_report_routes["Report routes<br/>[reports.py]"]
end

subgraph group_vision["Face processing"]
  node_face_match["ArcFace recognition<br/>[face_utils.py]"]
  node_liveness["Liveness checks<br/>[liveness.py]"]
end

subgraph group_records["Attendance data"]
  node_mongo[("MongoDB<br/>[database.py]")]
end

node_user(("Teacher or admin"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_attendance_ui
node_app -->|"routes to"| node_enroll_ui
node_app -->|"routes to"| node_students_ui
node_app -->|"routes to"| node_schedule_ui
node_app -->|"routes to"| node_reports_ui
node_app -->|"routes to"| node_dashboard_ui
node_app -->|"provides auth"| node_auth_ui
node_auth_ui -->|"calls"| node_api_client
node_attendance_ui -->|"calls"| node_api_client
node_attendance_ui -->|"uses state"| node_attendance_state
node_attendance_ui -->|"renders"| node_dropdown
node_enroll_ui -->|"calls"| node_api_client
node_students_ui -->|"calls"| node_api_client
node_schedule_ui -->|"calls"| node_api_client
node_schedule_ui -->|"renders"| node_dropdown
node_reports_ui -->|"calls"| node_api_client
node_dashboard_ui -->|"calls"| node_api_client
node_attendance_state -->|"calls"| node_api_client
node_api_client -->|"HTTP requests"| node_auth_routes
node_api_client -->|"HTTP requests"| node_student_routes
node_api_client -->|"HTTP requests"| node_attendance_routes
node_api_client -->|"HTTP requests"| node_schedule_routes
node_api_client -->|"HTTP requests"| node_report_routes
node_flask -->|"registers"| node_auth_routes
node_flask -->|"registers"| node_student_routes
node_flask -->|"registers"| node_attendance_routes
node_flask -->|"registers"| node_schedule_routes
node_flask -->|"registers"| node_report_routes
node_auth_routes -->|"reads and writes"| node_mongo
node_attendance_routes -->|"reads and writes"| node_mongo
node_attendance_routes -->|"recognizes faces"| node_face_match
node_attendance_routes -->|"checks liveness"| node_liveness
node_student_routes -->|"reads and writes"| node_mongo
node_student_routes -->|"enrolls faces"| node_face_match
node_schedule_routes -->|"reads and writes"| node_mongo
node_report_routes -->|"queries records"| node_mongo
node_face_match -->|"loads encodings"| node_mongo
node_face_match -->|"checks liveness"| node_liveness

click node_app "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/hooks/useAuth.jsx"
click node_api_client "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/utils/api.js"
click node_attendance_ui "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Attendance.jsx"
click node_attendance_state "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/contexts/AttendanceContext.jsx"
click node_enroll_ui "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Enroll.jsx"
click node_students_ui "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Students.jsx"
click node_schedule_ui "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Schedules.jsx"
click node_reports_ui "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Reports.jsx"
click node_dashboard_ui "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Dashboard.jsx"
click node_dropdown "https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/components/Dropdown.jsx"
click node_flask "https://github.com/bayaraa07-27/diplom/blob/main/backend/app.py"
click node_auth_routes "https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/auth.py"
click node_student_routes "https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/students.py"
click node_attendance_routes "https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/attendance.py"
click node_schedule_routes "https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/schedules.py"
click node_report_routes "https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/reports.py"
click node_face_match "https://github.com/bayaraa07-27/diplom/blob/main/backend/utils/face_utils.py"
click node_liveness "https://github.com/bayaraa07-27/diplom/blob/main/backend/utils/liveness.py"
click node_mongo "https://github.com/bayaraa07-27/diplom/blob/main/backend/database.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_app,node_auth_ui,node_api_client,node_attendance_ui,node_attendance_state,node_enroll_ui,node_students_ui,node_schedule_ui,node_reports_ui,node_dashboard_ui,node_dropdown toneBlue
class node_flask,node_auth_routes,node_student_routes,node_attendance_routes,node_schedule_routes,node_report_routes toneAmber
class node_face_match,node_liveness toneMint
class node_mongo toneRose
class node_user toneIndigo
```

## Components

### Web interface

- [React routes](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/hooks/useAuth.jsx): `frontend/src/hooks/useAuth.jsx`
- [HTTP client](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/utils/api.js): `frontend/src/utils/api.js`
- [Attendance scanning](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Attendance.jsx): `frontend/src/pages/Attendance.jsx`
- [Attendance state](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/contexts/AttendanceContext.jsx): `frontend/src/contexts/AttendanceContext.jsx`
- [Face enrollment](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Enroll.jsx): `frontend/src/pages/Enroll.jsx`
- [Student management](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Students.jsx): `frontend/src/pages/Students.jsx`
- [Schedule management](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Schedules.jsx): `frontend/src/pages/Schedules.jsx`
- [Attendance reports](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Reports.jsx): `frontend/src/pages/Reports.jsx`
- [Dashboard](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Dropdown control](https://github.com/bayaraa07-27/diplom/blob/main/frontend/src/components/Dropdown.jsx): `frontend/src/components/Dropdown.jsx`

### Flask API

- [Flask app](https://github.com/bayaraa07-27/diplom/blob/main/backend/app.py): `backend/app.py`
- [Authentication](https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Student routes](https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/students.py): `backend/routes/students.py`
- [Attendance routes](https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/attendance.py): `backend/routes/attendance.py`
- [Schedule routes](https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/schedules.py): `backend/routes/schedules.py`
- [Report routes](https://github.com/bayaraa07-27/diplom/blob/main/backend/routes/reports.py): `backend/routes/reports.py`

### Face processing

- [ArcFace recognition](https://github.com/bayaraa07-27/diplom/blob/main/backend/utils/face_utils.py): `backend/utils/face_utils.py`
- [Liveness checks](https://github.com/bayaraa07-27/diplom/blob/main/backend/utils/liveness.py): `backend/utils/liveness.py`

### Attendance data

- [MongoDB](https://github.com/bayaraa07-27/diplom/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Teacher or admin**

## Connections

- Teacher or admin → React routes: uses (evidence: `README.md`)
- React routes → Attendance scanning: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Face enrollment: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Student management: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Schedule management: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Attendance reports: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Auth state: provides auth (evidence: `frontend/src/App.jsx`)
- Auth state → HTTP client: calls (evidence: `frontend/src/hooks/useAuth.jsx`)
- Attendance scanning → HTTP client: calls (evidence: `frontend/src/pages/Attendance.jsx`)
- Attendance scanning → Attendance state: uses state (evidence: `frontend/src/pages/Attendance.jsx`)
- Attendance scanning → Dropdown control: renders (evidence: `frontend/src/pages/Attendance.jsx`)
- Face enrollment → HTTP client: calls (evidence: `frontend/src/pages/Enroll.jsx`)
- Student management → HTTP client: calls (evidence: `frontend/src/pages/Students.jsx`)
- Schedule management → HTTP client: calls (evidence: `frontend/src/pages/Schedules.jsx`)
- Schedule management → Dropdown control: renders (evidence: `frontend/src/pages/Schedules.jsx`)
- Attendance reports → HTTP client: calls (evidence: `frontend/src/pages/Reports.jsx`)
- Dashboard → HTTP client: calls (evidence: `frontend/src/pages/Dashboard.jsx`)
- Attendance state → HTTP client: calls (evidence: `frontend/src/contexts/AttendanceContext.jsx`)
- HTTP client → Authentication: HTTP requests (evidence: `README.md`)
- HTTP client → Student routes: HTTP requests (evidence: `README.md`)
- HTTP client → Attendance routes: HTTP requests (evidence: `README.md`)
- HTTP client → Schedule routes: HTTP requests (evidence: `README.md`)
- HTTP client → Report routes: HTTP requests (evidence: `README.md`)
- Flask app → Authentication: registers (evidence: `backend/app.py`)
- Flask app → Student routes: registers (evidence: `backend/app.py`)
- Flask app → Attendance routes: registers (evidence: `backend/app.py`)
- Flask app → Schedule routes: registers (evidence: `backend/app.py`)
- Flask app → Report routes: registers (evidence: `backend/app.py`)
- Authentication → MongoDB: reads and writes (evidence: `backend/routes/auth.py`)
- Attendance routes → MongoDB: reads and writes (evidence: `backend/routes/attendance.py`)
- Attendance routes → ArcFace recognition: recognizes faces (evidence: `backend/routes/attendance.py`)
- Attendance routes → Liveness checks: checks liveness (evidence: `backend/routes/attendance.py`)
- Student routes → MongoDB: reads and writes (evidence: `backend/routes/students.py`)
- Student routes → ArcFace recognition: enrolls faces (evidence: `backend/routes/students.py`)
- Schedule routes → MongoDB: reads and writes (evidence: `backend/routes/schedules.py`)
- Report routes → MongoDB: queries records (evidence: `backend/routes/reports.py`)
- ArcFace recognition → MongoDB: loads encodings (evidence: `backend/utils/face_utils.py`)
- ArcFace recognition → Liveness checks: checks liveness (evidence: `backend/utils/face_utils.py`)
