# jayfarkade/cheating-resistant-attendance architecture

> Architecture diagram of the GitHub repository jayfarkade/cheating-resistant-attendance, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jayfarkade/cheating-resistant-attendance
- Repository: https://github.com/jayfarkade/cheating-resistant-attendance

## Overview

This is a web-based attendance system for professors and students. Professors create courses, manage enrollment, start timed attendance sessions, advance a three-stage QR challenge, and review results; students enroll, scan each stage, and view attendance history. The server validates attempts and tokens against SQLite, records attendance, and broadcasts successful check-ins to the professor dashboard. Frontend and several controller details are represented from the README and repository structure; their internal wiring is not fully shown in the sampled source.

Main entry points: [`public/js/app.js`](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/public/js/app.js) (Web app shell), [`src/controllers/attendanceController.js`](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/controllers/attendanceController.js) (Attendance engine), [`server.js`](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/server.js) (HTTP server), [`src/db/database.js`](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/db/database.js) (SQLite data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web app shell<br/>[app.js]"]
  node_profui["Professor dashboard<br/>[professor.js]"]
  node_studentui["Student dashboard<br/>[student.js]"]
end

subgraph group_api["API and domain"]
  node_server["HTTP server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_courseroutes["Course routes<br/>[courseRoutes.js]"]
  node_attendanceroutes["Attendance routes"]
  node_auth["Authentication<br/>[authController.js]"]
  node_courses["Course and enrollment"]
  node_attendance["Attendance engine"]
  node_middleware["JWT and roles<br/>[auth.js]"]
end

subgraph group_state["Persistence and services"]
  node_database[("SQLite data<br/>[database.js]")]
  node_qr["QR token service<br/>[qrService.js]"]
  node_audit["Audit logging<br/>[auditService.js]"]
end

subgraph group_realtime["Live updates"]
  node_socket["Socket.IO events<br/>[server.js]"]
end

node_professor(("Professor"))
node_student(("Student"))

node_professor -->|"uses"| node_profui
node_student -->|"uses"| node_studentui
node_webapp -->|"initializes"| node_profui
node_webapp -->|"initializes"| node_studentui
node_webapp -->|"HTTP requests"| node_server
node_profui -->|"API helper"| node_webapp
node_studentui -->|"API helper"| node_webapp
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_courseroutes
node_server -->|"mounts"| node_attendanceroutes
node_authroutes -->|"protects profile"| node_middleware
node_authroutes -->|"dispatches"| node_auth
node_courseroutes -->|"protects routes"| node_middleware
node_courseroutes -->|"dispatches"| node_courses
node_attendanceroutes -->|"protects routes"| node_middleware
node_attendanceroutes -->|"dispatches"| node_attendance
node_auth -->|"reads and writes"| node_database
node_auth -->|"logs events"| node_audit
node_courses -->|"reads and writes"| node_database
node_courses -->|"logs events"| node_audit
node_attendance -->|"reads and writes"| node_database
node_attendance -->|"generates and parses"| node_qr
node_attendance -->|"logs events"| node_audit
node_qr -->|"stores tokens"| node_database
node_attendance -->|"emits updates"| node_socket
node_socket -->|"delivers events"| node_webapp

click node_webapp "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/public/js/app.js"
click node_profui "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/public/js/professor.js"
click node_studentui "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/public/js/student.js"
click node_server "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/server.js"
click node_authroutes "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/routes/authRoutes.js"
click node_courseroutes "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/routes/courseRoutes.js"
click node_attendanceroutes "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/routes/attendanceRoutes.js"
click node_auth "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/controllers/authController.js"
click node_courses "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/controllers/courseController.js"
click node_attendance "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/controllers/attendanceController.js"
click node_middleware "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/middleware/auth.js"
click node_database "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/db/database.js"
click node_qr "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/services/qrService.js"
click node_audit "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/services/auditService.js"
click node_socket "https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/server.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_webapp,node_profui,node_studentui toneBlue
class node_server,node_authroutes,node_courseroutes,node_attendanceroutes,node_auth,node_courses,node_attendance,node_middleware toneAmber
class node_database,node_qr,node_audit toneMint
class node_socket toneRose
class node_professor,node_student toneIndigo
```

## Components

### Web application

- [Web app shell](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/public/js/app.js): `public/js/app.js`
- [Professor dashboard](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/public/js/professor.js): `public/js/professor.js`
- [Student dashboard](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/public/js/student.js): `public/js/student.js`

### API and domain

- [HTTP server](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/server.js): `server.js`
- [Auth routes](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/routes/authRoutes.js): `src/routes/authRoutes.js`
- [Course routes](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/routes/courseRoutes.js): `src/routes/courseRoutes.js`
- [Attendance routes](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/routes/attendanceRoutes.js): `src/routes/attendanceRoutes.js`
- [Authentication](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/controllers/authController.js): `src/controllers/authController.js`
- [Course and enrollment](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/controllers/courseController.js): `src/controllers/courseController.js`
- [Attendance engine](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/controllers/attendanceController.js): `src/controllers/attendanceController.js`
- [JWT and roles](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/middleware/auth.js): `src/middleware/auth.js`

### Persistence and services

- [SQLite data](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/db/database.js): `src/db/database.js`
- [QR token service](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/services/qrService.js): `src/services/qrService.js`
- [Audit logging](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/src/services/auditService.js): `src/services/auditService.js`

### Live updates

- [Socket.IO events](https://github.com/jayfarkade/cheating-resistant-attendance/blob/master/server.js): `server.js`

### Other components

- **Professor**
- **Student**

## Connections

- Professor → Professor dashboard: uses
- Student → Student dashboard: uses
- Web app shell → Professor dashboard: initializes
- Web app shell → Student dashboard: initializes
- Web app shell → HTTP server: HTTP requests
- Professor dashboard → Web app shell: API helper
- Student dashboard → Web app shell: API helper
- HTTP server → Auth routes: mounts
- HTTP server → Course routes: mounts
- HTTP server → Attendance routes: mounts
- Auth routes → JWT and roles: protects profile
- Auth routes → Authentication: dispatches
- Course routes → JWT and roles: protects routes
- Course routes → Course and enrollment: dispatches
- Attendance routes → JWT and roles: protects routes
- Attendance routes → Attendance engine: dispatches
- Authentication → SQLite data: reads and writes
- Authentication → Audit logging: logs events
- Course and enrollment → SQLite data: reads and writes
- Course and enrollment → Audit logging: logs events
- Attendance engine → SQLite data: reads and writes
- Attendance engine → QR token service: generates and parses
- Attendance engine → Audit logging: logs events
- QR token service → SQLite data: stores tokens
- Attendance engine → Socket.IO events: emits updates
- Socket.IO events → Web app shell: delivers events
