# devking-kunal/attendx architecture

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

- Interactive diagram: https://gitdiagram.com/devking-kunal/attendx
- Repository: https://github.com/devking-kunal/attendx

## Overview

AttendX is an offline-first classroom attendance service hosted on a professor’s Windows laptop. Students connect to its hotspot and submit roll numbers; the server validates device and session bindings, records attendance, and isolates submitting devices. Teachers authenticate to manage sessions and review live or historical records, rosters, and exports. The README documents additional dashboard and network controls; sampled source confirms the main submission, persistence, Wi-Fi, authentication, and sync responsibilities. Some endpoint wiring is only partially excerpted, so uncertain relationships are omitted.

Main entry points: [`attendx/main.py`](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py) (FastAPI service), [`attendx/sync.py`](https://github.com/devking-kunal/attendx/blob/main/attendx/sync.py) (Post-session sync), [`attendx/wifi_control.py`](https://github.com/devking-kunal/attendx/blob/main/attendx/wifi_control.py) (Wi-Fi control), [`attendx/database.py`](https://github.com/devking-kunal/attendx/blob/main/attendx/database.py) (SQLite attendance store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_server["FastAPI service<br/>[main.py]"]
  node_portal["Check-in portal<br/>[main.py]"]
  node_dashboard["Teacher dashboard<br/>[dashboard.html]"]
  node_auth["Teacher authentication<br/>[auth.py]"]
  node_live_feed["Live event feed<br/>[main.py]"]
  node_qr["Hotspot QR endpoint<br/>[main.py]"]
end

subgraph group_attendance["Attendance records"]
  node_session_api["Session management<br/>[main.py]"]
  node_attendance_buffer["Session attendance buffer<br/>[main.py]"]
  node_records_api["Records and roster API<br/>[main.py]"]
  node_database[("SQLite attendance store<br/>[database.py]")]
end

subgraph group_network["Hotspot enforcement"]
  node_wifi["Wi-Fi control<br/>[wifi_control.py]"]
  node_windows["Windows hotspot and firewall"]
end

subgraph group_exports["Exports and sync"]
  node_csv_export["Session CSV export<br/>[main.py]"]
  node_sync["Post-session sync<br/>[sync.py]"]
  node_local_files["Attendance files"]
  node_xlsx_erp["XLSX and ERP export<br/>[sync.py]"]
  node_sheets[("Google Sheets")]
end

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

node_student -->|"submits roll"| node_portal
node_portal -->|"validates and records"| node_attendance_buffer
node_portal -->|"checks clients"| node_wifi
node_portal -->|"returns confirmation"| node_server
node_teacher -->|"manages attendance"| node_dashboard
node_dashboard -->|"uses API"| node_server
node_server -->|"checks credentials"| node_auth
node_server -->|"dispatches requests"| node_session_api
node_session_api -->|"controls hotspot"| node_wifi
node_session_api -->|"creates and ends sessions"| node_database
node_session_api -->|"starts session"| node_attendance_buffer
node_attendance_buffer -->|"autosaves records"| node_database
node_records_api -->|"reads active records"| node_attendance_buffer
node_records_api -->|"reads history and roster"| node_database
node_server -->|"serves events"| node_live_feed
node_live_feed -->|"streams updates"| node_dashboard
node_server -->|"serves exports"| node_csv_export
node_csv_export -->|"saves records"| node_database
node_server -->|"serves QR data"| node_qr
node_qr -->|"gets hotspot address"| node_wifi
node_wifi -->|"controls and isolates devices"| node_windows
node_teacher -.->|"runs after class"| node_sync
node_sync -->|"reads attendance CSV"| node_local_files
node_sync -->|"generates exports"| node_xlsx_erp
node_sync -.->|"uploads session data"| node_sheets

click node_server "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_portal "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_dashboard "https://github.com/devking-kunal/attendx/blob/main/attendx/templates/dashboard.html"
click node_auth "https://github.com/devking-kunal/attendx/blob/main/attendx/auth.py"
click node_session_api "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_live_feed "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_attendance_buffer "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_records_api "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_database "https://github.com/devking-kunal/attendx/blob/main/attendx/database.py"
click node_wifi "https://github.com/devking-kunal/attendx/blob/main/attendx/wifi_control.py"
click node_csv_export "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_qr "https://github.com/devking-kunal/attendx/blob/main/attendx/main.py"
click node_sync "https://github.com/devking-kunal/attendx/blob/main/attendx/sync.py"
click node_xlsx_erp "https://github.com/devking-kunal/attendx/blob/main/attendx/sync.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_server,node_portal,node_dashboard,node_auth,node_live_feed,node_qr toneBlue
class node_session_api,node_attendance_buffer,node_records_api,node_database toneAmber
class node_wifi,node_windows toneMint
class node_csv_export,node_sync,node_local_files,node_xlsx_erp,node_sheets toneRose
class node_student,node_teacher toneIndigo
```

## Components

### Web application

- [FastAPI service](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`
- [Check-in portal](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`
- [Teacher dashboard](https://github.com/devking-kunal/attendx/blob/main/attendx/templates/dashboard.html): `attendx/templates/dashboard.html`
- [Teacher authentication](https://github.com/devking-kunal/attendx/blob/main/attendx/auth.py): `attendx/auth.py`
- [Live event feed](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`
- [Hotspot QR endpoint](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`

### Attendance records

- [Session management](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`
- [Session attendance buffer](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`
- [Records and roster API](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`
- [SQLite attendance store](https://github.com/devking-kunal/attendx/blob/main/attendx/database.py): `attendx/database.py`

### Hotspot enforcement

- [Wi-Fi control](https://github.com/devking-kunal/attendx/blob/main/attendx/wifi_control.py): `attendx/wifi_control.py`
- **Windows hotspot and firewall**

### Exports and sync

- [Session CSV export](https://github.com/devking-kunal/attendx/blob/main/attendx/main.py): `attendx/main.py`
- [Post-session sync](https://github.com/devking-kunal/attendx/blob/main/attendx/sync.py): `attendx/sync.py`
- **Attendance files**
- [XLSX and ERP export](https://github.com/devking-kunal/attendx/blob/main/attendx/sync.py): `attendx/sync.py`
- **Google Sheets**

### Other components

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

## Connections

- Student → Check-in portal: submits roll
- Check-in portal → Session attendance buffer: validates and records
- Check-in portal → Wi-Fi control: checks clients
- Check-in portal → FastAPI service: returns confirmation
- Teacher → Teacher dashboard: manages attendance
- Teacher dashboard → FastAPI service: uses API
- FastAPI service → Teacher authentication: checks credentials
- FastAPI service → Session management: dispatches requests
- Session management → Wi-Fi control: controls hotspot
- Session management → SQLite attendance store: creates and ends sessions
- Session management → Session attendance buffer: starts session
- Session attendance buffer → SQLite attendance store: autosaves records
- Records and roster API → Session attendance buffer: reads active records
- Records and roster API → SQLite attendance store: reads history and roster
- FastAPI service → Live event feed: serves events
- Live event feed → Teacher dashboard: streams updates
- FastAPI service → Session CSV export: serves exports
- Session CSV export → SQLite attendance store: saves records
- FastAPI service → Hotspot QR endpoint: serves QR data
- Hotspot QR endpoint → Wi-Fi control: gets hotspot address
- Wi-Fi control → Windows hotspot and firewall: controls and isolates devices
- Teacher → Post-session sync: runs after class
- Post-session sync → Attendance files: reads attendance CSV
- Post-session sync → XLSX and ERP export: generates exports
- Post-session sync → Google Sheets: uploads session data
