# omarkhan56/attendease architecture

> Architecture diagram of the GitHub repository omarkhan56/attendease, 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/omarkhan56/attendease
- Repository: https://github.com/omarkhan56/attendease

## Overview

AttendEase is a role-aware attendance and class-management application. Faculty create classes, enroll students, and start scheduled QR attendance sessions; students scan a session QR to record attendance, with optional WebAuthn verification. Users can review attendance history and analytics, while faculty can run spot checks. The graph follows documented UI routes and sampled backend routing/calls. Several page-to-API interactions and the analytics implementation were not sampled, so those connections are not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/omarkhan56/attendease/blob/main/frontend/src/App.jsx) (App routing), [`backend/server.js`](https://github.com/omarkhan56/attendease/blob/main/backend/server.js) (Express API), [`backend/middleware/authMiddleware.js`](https://github.com/omarkhan56/attendease/blob/main/backend/middleware/authMiddleware.js) (JWT and roles), [`backend/controllers/attendanceController.js`](https://github.com/omarkhan56/attendease/blob/main/backend/controllers/attendanceController.js) (QR attendance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_authctx["Authentication state<br/>[AuthContext.jsx]"]
  node_private["Route protection<br/>[PrivateRoute.jsx]"]
  node_login["Login and registration<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_classesui["Class browsing<br/>[Classes.jsx]"]
  node_createui["Class creation<br/>[CreateClass.jsx]"]
  node_detailsui["Class details<br/>[ClassDetails.jsx]"]
  node_enrollui["Student enrollment<br/>[EnrollStudents.jsx]"]
  node_markui["Mark attendance<br/>[MarkAttendance.jsx]"]
  node_historyui["Attendance history"]
  node_analyticsui["Attendance analytics<br/>[Analytics.jsx]"]
  node_dashboardui["Dashboard<br/>[Dashboard.jsx]"]
  node_profileui["Profile and devices<br/>[Profile.jsx]"]
  node_spotui["Spot check<br/>[SpotCheck.jsx]"]
end

subgraph group_api["API and security"]
  node_server["Express API<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_classroutes["Class routes<br/>[classRoutes.js]"]
  node_attendroutes["Attendance routes"]
  node_analyticsroutes["Analytics routes<br/>[analyticsRoutes.js]"]
  node_webauthnroutes["WebAuthn routes<br/>[webauthnRoutes.js]"]
  node_spotroutes["Spot-check routes<br/>[spotCheckRoutes.js]"]
  node_authmw["JWT and roles<br/>[authMiddleware.js]"]
end

subgraph group_domain["Academic workflows"]
  node_authctrl["Account operations<br/>[authController.js]"]
  node_classctrl["Class management<br/>[classController.js]"]
  node_attendctrl["QR attendance"]
  node_analyticsctrl["Analytics queries"]
  node_webauthnctrl["Biometric verification"]
  node_spotctrl["Spot-check workflow"]
end

subgraph group_infra["Data and integrations"]
  node_users[("User records<br/>[User.js]")]
  node_classes[("Class records<br/>[Class.js]")]
  node_attendance[("Attendance records<br/>[Attendance.js]")]
  node_qrsession[("QR sessions<br/>[QRSession.js]")]
end

node_user(("Student or faculty"))

node_app -->|"provides state"| node_authctx
node_app -->|"guards pages"| node_private
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_classesui
node_app -->|"routes to"| node_createui
node_app -->|"routes to"| node_detailsui
node_app -->|"routes to"| node_enrollui
node_app -->|"routes to"| node_markui
node_app -->|"routes to"| node_historyui
node_app -->|"routes to"| node_analyticsui
node_app -->|"routes to"| node_dashboardui
node_app -->|"routes to"| node_profileui
node_app -->|"routes to"| node_spotui
node_server -->|"mounts at"| node_authroutes
node_server -->|"mounts at"| node_classroutes
node_server -->|"mounts at"| node_attendroutes
node_server -->|"mounts at"| node_analyticsroutes
node_server -->|"mounts at"| node_webauthnroutes
node_server -->|"mounts at"| node_spotroutes
node_authroutes -->|"protects routes"| node_authmw
node_classroutes -->|"protects routes"| node_authmw
node_attendroutes -->|"protects routes"| node_authmw
node_analyticsroutes -->|"protects routes"| node_authmw
node_webauthnroutes -->|"protects routes"| node_authmw
node_spotroutes -->|"protects routes"| node_authmw
node_authroutes -->|"dispatches to"| node_authctrl
node_classroutes -->|"dispatches to"| node_classctrl
node_attendroutes -->|"dispatches to"| node_attendctrl
node_analyticsroutes -->|"dispatches to"| node_analyticsctrl
node_webauthnroutes -->|"dispatches to"| node_webauthnctrl
node_spotroutes -->|"dispatches to"| node_spotctrl
node_authmw -->|"loads account"| node_users
node_authctrl -->|"reads and writes"| node_users
node_classctrl -->|"reads and writes"| node_classes
node_classctrl -->|"reads and updates"| node_users
node_attendctrl -->|"creates and checks"| node_qrsession
node_attendctrl -->|"records and queries"| node_attendance
node_attendctrl -->|"checks enrollment"| node_classes
node_attendctrl -->|"verifies assertion"| node_webauthnctrl
node_webauthnctrl -->|"updates credentials"| node_users
node_spotctrl -->|"checks records"| node_attendance
node_spotctrl -->|"checks class"| node_classes

click node_app "https://github.com/omarkhan56/attendease/blob/main/frontend/src/App.jsx"
click node_authctx "https://github.com/omarkhan56/attendease/blob/main/frontend/src/context/AuthContext.jsx"
click node_private "https://github.com/omarkhan56/attendease/blob/main/frontend/src/components/PrivateRoute.jsx"
click node_login "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Login.jsx"
click node_register "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Register.jsx"
click node_classesui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Classes.jsx"
click node_createui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/CreateClass.jsx"
click node_detailsui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/ClassDetails.jsx"
click node_enrollui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/EnrollStudents.jsx"
click node_markui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/MarkAttendance.jsx"
click node_historyui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/AttendanceHistory.jsx"
click node_analyticsui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Analytics.jsx"
click node_dashboardui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Dashboard.jsx"
click node_profileui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Profile.jsx"
click node_spotui "https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/SpotCheck.jsx"
click node_server "https://github.com/omarkhan56/attendease/blob/main/backend/server.js"
click node_authroutes "https://github.com/omarkhan56/attendease/blob/main/backend/routes/authRoutes.js"
click node_classroutes "https://github.com/omarkhan56/attendease/blob/main/backend/routes/classRoutes.js"
click node_attendroutes "https://github.com/omarkhan56/attendease/blob/main/backend/routes/attendanceRoutes.js"
click node_analyticsroutes "https://github.com/omarkhan56/attendease/blob/main/backend/routes/analyticsRoutes.js"
click node_webauthnroutes "https://github.com/omarkhan56/attendease/blob/main/backend/routes/webauthnRoutes.js"
click node_spotroutes "https://github.com/omarkhan56/attendease/blob/main/backend/routes/spotCheckRoutes.js"
click node_authmw "https://github.com/omarkhan56/attendease/blob/main/backend/middleware/authMiddleware.js"
click node_authctrl "https://github.com/omarkhan56/attendease/blob/main/backend/controllers/authController.js"
click node_classctrl "https://github.com/omarkhan56/attendease/blob/main/backend/controllers/classController.js"
click node_attendctrl "https://github.com/omarkhan56/attendease/blob/main/backend/controllers/attendanceController.js"
click node_analyticsctrl "https://github.com/omarkhan56/attendease/blob/main/backend/controllers/analyticsController.js"
click node_webauthnctrl "https://github.com/omarkhan56/attendease/blob/main/backend/controllers/webauthnController.js"
click node_spotctrl "https://github.com/omarkhan56/attendease/blob/main/backend/controllers/spotCheckController.js"
click node_users "https://github.com/omarkhan56/attendease/blob/main/backend/models/User.js"
click node_classes "https://github.com/omarkhan56/attendease/blob/main/backend/models/Class.js"
click node_attendance "https://github.com/omarkhan56/attendease/blob/main/backend/models/Attendance.js"
click node_qrsession "https://github.com/omarkhan56/attendease/blob/main/backend/models/QRSession.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_authctx,node_private,node_login,node_register,node_classesui,node_createui,node_detailsui,node_enrollui,node_markui,node_historyui,node_analyticsui,node_dashboardui,node_profileui,node_spotui toneBlue
class node_server,node_authroutes,node_classroutes,node_attendroutes,node_analyticsroutes,node_webauthnroutes,node_spotroutes,node_authmw toneAmber
class node_authctrl,node_classctrl,node_attendctrl,node_analyticsctrl,node_webauthnctrl,node_spotctrl toneMint
class node_users,node_classes,node_attendance,node_qrsession toneRose
class node_user toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/omarkhan56/attendease/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication state](https://github.com/omarkhan56/attendease/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Route protection](https://github.com/omarkhan56/attendease/blob/main/frontend/src/components/PrivateRoute.jsx): `frontend/src/components/PrivateRoute.jsx`
- [Login and registration](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Registration](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Register.jsx): `frontend/src/pages/Register.jsx`
- [Class browsing](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Classes.jsx): `frontend/src/pages/Classes.jsx`
- [Class creation](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/CreateClass.jsx): `frontend/src/pages/CreateClass.jsx`
- [Class details](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/ClassDetails.jsx): `frontend/src/pages/ClassDetails.jsx`
- [Student enrollment](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/EnrollStudents.jsx): `frontend/src/pages/EnrollStudents.jsx`
- [Mark attendance](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/MarkAttendance.jsx): `frontend/src/pages/MarkAttendance.jsx`
- [Attendance history](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/AttendanceHistory.jsx): `frontend/src/pages/AttendanceHistory.jsx`
- [Attendance analytics](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Analytics.jsx): `frontend/src/pages/Analytics.jsx`
- [Dashboard](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Profile and devices](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [Spot check](https://github.com/omarkhan56/attendease/blob/main/frontend/src/pages/SpotCheck.jsx): `frontend/src/pages/SpotCheck.jsx`

### API and security

- [Express API](https://github.com/omarkhan56/attendease/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/omarkhan56/attendease/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Class routes](https://github.com/omarkhan56/attendease/blob/main/backend/routes/classRoutes.js): `backend/routes/classRoutes.js`
- [Attendance routes](https://github.com/omarkhan56/attendease/blob/main/backend/routes/attendanceRoutes.js): `backend/routes/attendanceRoutes.js`
- [Analytics routes](https://github.com/omarkhan56/attendease/blob/main/backend/routes/analyticsRoutes.js): `backend/routes/analyticsRoutes.js`
- [WebAuthn routes](https://github.com/omarkhan56/attendease/blob/main/backend/routes/webauthnRoutes.js): `backend/routes/webauthnRoutes.js`
- [Spot-check routes](https://github.com/omarkhan56/attendease/blob/main/backend/routes/spotCheckRoutes.js): `backend/routes/spotCheckRoutes.js`
- [JWT and roles](https://github.com/omarkhan56/attendease/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Academic workflows

- [Account operations](https://github.com/omarkhan56/attendease/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Class management](https://github.com/omarkhan56/attendease/blob/main/backend/controllers/classController.js): `backend/controllers/classController.js`
- [QR attendance](https://github.com/omarkhan56/attendease/blob/main/backend/controllers/attendanceController.js): `backend/controllers/attendanceController.js`
- [Analytics queries](https://github.com/omarkhan56/attendease/blob/main/backend/controllers/analyticsController.js): `backend/controllers/analyticsController.js`
- [Biometric verification](https://github.com/omarkhan56/attendease/blob/main/backend/controllers/webauthnController.js): `backend/controllers/webauthnController.js`
- [Spot-check workflow](https://github.com/omarkhan56/attendease/blob/main/backend/controllers/spotCheckController.js): `backend/controllers/spotCheckController.js`

### Data and integrations

- [User records](https://github.com/omarkhan56/attendease/blob/main/backend/models/User.js): `backend/models/User.js`
- [Class records](https://github.com/omarkhan56/attendease/blob/main/backend/models/Class.js): `backend/models/Class.js`
- [Attendance records](https://github.com/omarkhan56/attendease/blob/main/backend/models/Attendance.js): `backend/models/Attendance.js`
- [QR sessions](https://github.com/omarkhan56/attendease/blob/main/backend/models/QRSession.js): `backend/models/QRSession.js`

### Other components

- **Student or faculty**

## Connections

- App routing → Authentication state: provides state (evidence: `frontend/src/App.jsx`)
- App routing → Route protection: guards pages (evidence: `frontend/src/App.jsx`)
- App routing → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Registration: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Class browsing: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Class creation: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Class details: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Student enrollment: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Mark attendance: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Attendance history: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Attendance analytics: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Profile and devices: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Spot check: routes to (evidence: `frontend/src/App.jsx`)
- Express API → Authentication routes: mounts at (evidence: `backend/server.js`)
- Express API → Class routes: mounts at (evidence: `backend/server.js`)
- Express API → Attendance routes: mounts at (evidence: `backend/server.js`)
- Express API → Analytics routes: mounts at (evidence: `backend/server.js`)
- Express API → WebAuthn routes: mounts at (evidence: `backend/server.js`)
- Express API → Spot-check routes: mounts at (evidence: `backend/server.js`)
- Authentication routes → JWT and roles: protects routes (evidence: `backend/routes/authRoutes.js`)
- Class routes → JWT and roles: protects routes (evidence: `backend/routes/classRoutes.js`)
- Attendance routes → JWT and roles: protects routes (evidence: `backend/routes/attendanceRoutes.js`)
- Analytics routes → JWT and roles: protects routes (evidence: `backend/routes/analyticsRoutes.js`)
- WebAuthn routes → JWT and roles: protects routes (evidence: `backend/routes/webauthnRoutes.js`)
- Spot-check routes → JWT and roles: protects routes (evidence: `backend/routes/spotCheckRoutes.js`)
- Authentication routes → Account operations: dispatches to (evidence: `backend/routes/authRoutes.js`)
- Class routes → Class management: dispatches to (evidence: `backend/routes/classRoutes.js`)
- Attendance routes → QR attendance: dispatches to (evidence: `backend/routes/attendanceRoutes.js`)
- Analytics routes → Analytics queries: dispatches to (evidence: `backend/routes/analyticsRoutes.js`)
- WebAuthn routes → Biometric verification: dispatches to (evidence: `backend/routes/webauthnRoutes.js`)
- Spot-check routes → Spot-check workflow: dispatches to (evidence: `backend/routes/spotCheckRoutes.js`)
- JWT and roles → User records: loads account (evidence: `backend/middleware/authMiddleware.js`)
- Account operations → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Class management → Class records: reads and writes (evidence: `backend/controllers/classController.js`)
- Class management → User records: reads and updates (evidence: `backend/controllers/classController.js`)
- QR attendance → QR sessions: creates and checks (evidence: `backend/controllers/attendanceController.js`)
- QR attendance → Attendance records: records and queries (evidence: `backend/controllers/attendanceController.js`)
- QR attendance → Class records: checks enrollment (evidence: `backend/controllers/attendanceController.js`)
- QR attendance → Biometric verification: verifies assertion (evidence: `backend/controllers/attendanceController.js`)
- Biometric verification → User records: updates credentials (evidence: `backend/controllers/webauthnController.js`)
- Spot-check workflow → Attendance records: checks records (evidence: `backend/controllers/spotCheckController.js`)
- Spot-check workflow → Class records: checks class (evidence: `backend/controllers/spotCheckController.js`)
