# bhaskar1461/att3 architecture

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

- Interactive diagram: https://gitdiagram.com/bhaskar1461/att3
- Repository: https://github.com/bhaskar1461/att3

## Overview

SNIST’s product is a role-based attendance and academic-management platform: students scan classroom projector QR codes, teachers manage sessions and registers, and administrators handle rosters, onboarding, devices, compliance, and reports. The React client reaches FastAPI through its API service; the backend provides attendance, identity, device, onboarding, and reporting capabilities over persistent academic data. Documented branches also include rotating QR validation, device binding and recovery, email delivery, Google Sheets/Excel registers, and security monitoring. Some backend routing and integration wiring is unsampled, so those links are shown only where documented.

Main entry points: [`backend/app/main.py`](https://github.com/bhaskar1461/att3/blob/main/backend/app/main.py) (FastAPI Application), [`backend/app/api/attendance.py`](https://github.com/bhaskar1461/att3/blob/main/backend/app/api/attendance.py) (Attendance APIs), [`frontend/src/services/api.ts`](https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/api.ts) (API Client), [`backend/app/models/models.py`](https://github.com/bhaskar1461/att3/blob/main/backend/app/models/models.py) (Academic Data Models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web Application"]
  node_react_app["React Application<br/>[App.tsx]"]
  node_client_api["API Client<br/>[api.ts]"]
end

subgraph group_attendance["Attendance Workflow"]
  node_scanner["QR Scanner<br/>[qrEngine.ts]"]
  node_projector["Projector QR"]
  node_attendance_api["Attendance APIs<br/>[attendance.py]"]
  node_attendance_engine["Attendance Engine"]
  node_attendance_ui["Attendance Registers"]
end

subgraph group_identity["Identity Security"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_binding_crypto["Device Binding Crypto<br/>[cryptoEngine.ts]"]
  node_binding_storage[("Binding Storage<br/>[storage.ts]")]
  node_device_security["Device Security<br/>[device_security.py]"]
  node_device_api["Device Management<br/>[devices.py]"]
end

subgraph group_operations["Academic Operations"]
  node_onboarding_api["Onboarding API<br/>[onboarding.py]"]
  node_onboarding_service["Onboarding Service"]
  node_onboarding_ui["Onboarding Manager"]
  node_compliance["Compliance Analytics"]
  node_reporting["Reports<br/>[report_service.py]"]
end

subgraph group_data["Persistence Integrations"]
  node_application["FastAPI Application<br/>[main.py]"]
  node_models["Academic Data Models<br/>[models.py]"]
  node_database[("SQL Database<br/>[database.py]")]
  node_email["Email Delivery<br/>[email_service.py]"]
  node_sheets["Google Sheets Sync<br/>[gsheets_service.py]"]
  node_excel["Excel Registers<br/>[excel_service.py]"]
end

node_student(("Student"))
node_teacher(("Teacher"))
node_administrator(("Administrator"))
node_mail_provider["SMTP Providers"]
node_google_sheets[("Google Sheets")]

node_student -->|"uses"| node_react_app
node_teacher -->|"uses"| node_react_app
node_administrator -->|"uses"| node_react_app
node_react_app -->|"requests"| node_client_api
node_client_api -->|"HTTP API"| node_application
node_application -->|"dispatches"| node_attendance_api
node_application -->|"dispatches"| node_auth_api
node_application -->|"dispatches"| node_device_api
node_application -->|"dispatches"| node_onboarding_api
node_application -->|"dispatches"| node_compliance
node_projector -->|"displays QR"| node_student
node_student -->|"scans QR"| node_scanner
node_scanner -->|"submits scan"| node_attendance_api
node_attendance_api -->|"calculates attendance"| node_attendance_engine
node_attendance_api -->|"reads/writes"| node_models
node_attendance_ui -->|"requests registers"| node_client_api
node_attendance_engine -->|"supplies metrics"| node_compliance
node_binding_crypto -->|"stores keys"| node_binding_storage
node_binding_crypto -->|"signs enrollment"| node_device_api
node_device_api -->|"checks binding"| node_device_security
node_device_api -->|"reads/writes"| node_models
node_onboarding_ui -->|"requests onboarding"| node_client_api
node_client_api -->|"HTTP requests"| node_onboarding_api
node_onboarding_api -->|"handles onboarding"| node_onboarding_service
node_onboarding_service -->|"dispatches links"| node_email
node_email -.->|"sends email"| node_mail_provider
node_onboarding_service -->|"updates roster"| node_models
node_attendance_api -.->|"syncs attendance"| node_sheets
node_sheets -.->|"updates sheets"| node_google_sheets
node_reporting -->|"generates registers"| node_excel
node_attendance_api -->|"persists records"| node_database
node_models -->|"maps data"| node_database
node_compliance -->|"reads academic data"| node_models

click node_react_app "https://github.com/bhaskar1461/att3/blob/main/frontend/src/App.tsx"
click node_client_api "https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/api.ts"
click node_scanner "https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/qrEngine.ts"
click node_projector "https://github.com/bhaskar1461/att3/blob/main/frontend/src/pages/PublicQrDisplay.tsx"
click node_attendance_api "https://github.com/bhaskar1461/att3/blob/main/backend/app/api/attendance.py"
click node_attendance_engine "https://github.com/bhaskar1461/att3/blob/main/backend/app/services/attendance_engine.py"
click node_attendance_ui "https://github.com/bhaskar1461/att3/blob/main/frontend/src/features/attendance/TodayRegisterPage.tsx"
click node_auth_api "https://github.com/bhaskar1461/att3/blob/main/backend/app/api/auth.py"
click node_binding_crypto "https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/binding/cryptoEngine.ts"
click node_binding_storage "https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/binding/storage.ts"
click node_device_security "https://github.com/bhaskar1461/att3/blob/main/backend/app/core/device_security.py"
click node_device_api "https://github.com/bhaskar1461/att3/blob/main/backend/app/api/devices.py"
click node_onboarding_api "https://github.com/bhaskar1461/att3/blob/main/backend/app/api/onboarding.py"
click node_onboarding_service "https://github.com/bhaskar1461/att3/blob/main/backend/app/services/onboarding_service.py"
click node_onboarding_ui "https://github.com/bhaskar1461/att3/blob/main/frontend/src/components/admin/OnboardingManager.tsx"
click node_compliance "https://github.com/bhaskar1461/att3/blob/main/backend/app/api/compliance_analytics.py"
click node_reporting "https://github.com/bhaskar1461/att3/blob/main/backend/app/services/report_service.py"
click node_application "https://github.com/bhaskar1461/att3/blob/main/backend/app/main.py"
click node_models "https://github.com/bhaskar1461/att3/blob/main/backend/app/models/models.py"
click node_database "https://github.com/bhaskar1461/att3/blob/main/backend/app/core/database.py"
click node_email "https://github.com/bhaskar1461/att3/blob/main/backend/app/services/email_service.py"
click node_sheets "https://github.com/bhaskar1461/att3/blob/main/backend/app/services/gsheets_service.py"
click node_excel "https://github.com/bhaskar1461/att3/blob/main/backend/app/services/excel_service.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_react_app,node_client_api toneBlue
class node_scanner,node_projector,node_attendance_api,node_attendance_engine,node_attendance_ui,node_google_sheets toneAmber
class node_auth_api,node_binding_crypto,node_binding_storage,node_device_security,node_device_api toneMint
class node_onboarding_api,node_onboarding_service,node_onboarding_ui,node_compliance,node_reporting toneRose
class node_application,node_models,node_database,node_email,node_sheets,node_excel,node_student,node_teacher,node_administrator,node_mail_provider toneIndigo
```

## Components

### Web Application

- [React Application](https://github.com/bhaskar1461/att3/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Attendance Workflow

- [QR Scanner](https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/qrEngine.ts): `frontend/src/services/qrEngine.ts`
- [Projector QR](https://github.com/bhaskar1461/att3/blob/main/frontend/src/pages/PublicQrDisplay.tsx): `frontend/src/pages/PublicQrDisplay.tsx`
- [Attendance APIs](https://github.com/bhaskar1461/att3/blob/main/backend/app/api/attendance.py): `backend/app/api/attendance.py`
- [Attendance Engine](https://github.com/bhaskar1461/att3/blob/main/backend/app/services/attendance_engine.py): `backend/app/services/attendance_engine.py`
- [Attendance Registers](https://github.com/bhaskar1461/att3/blob/main/frontend/src/features/attendance/TodayRegisterPage.tsx): `frontend/src/features/attendance/TodayRegisterPage.tsx`

### Identity Security

- [Authentication API](https://github.com/bhaskar1461/att3/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Device Binding Crypto](https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/binding/cryptoEngine.ts): `frontend/src/services/binding/cryptoEngine.ts`
- [Binding Storage](https://github.com/bhaskar1461/att3/blob/main/frontend/src/services/binding/storage.ts): `frontend/src/services/binding/storage.ts`
- [Device Security](https://github.com/bhaskar1461/att3/blob/main/backend/app/core/device_security.py): `backend/app/core/device_security.py`
- [Device Management](https://github.com/bhaskar1461/att3/blob/main/backend/app/api/devices.py): `backend/app/api/devices.py`

### Academic Operations

- [Onboarding API](https://github.com/bhaskar1461/att3/blob/main/backend/app/api/onboarding.py): `backend/app/api/onboarding.py`
- [Onboarding Service](https://github.com/bhaskar1461/att3/blob/main/backend/app/services/onboarding_service.py): `backend/app/services/onboarding_service.py`
- [Onboarding Manager](https://github.com/bhaskar1461/att3/blob/main/frontend/src/components/admin/OnboardingManager.tsx): `frontend/src/components/admin/OnboardingManager.tsx`
- [Compliance Analytics](https://github.com/bhaskar1461/att3/blob/main/backend/app/api/compliance_analytics.py): `backend/app/api/compliance_analytics.py`
- [Reports](https://github.com/bhaskar1461/att3/blob/main/backend/app/services/report_service.py): `backend/app/services/report_service.py`

### Persistence Integrations

- [FastAPI Application](https://github.com/bhaskar1461/att3/blob/main/backend/app/main.py): `backend/app/main.py`
- [Academic Data Models](https://github.com/bhaskar1461/att3/blob/main/backend/app/models/models.py): `backend/app/models/models.py`
- [SQL Database](https://github.com/bhaskar1461/att3/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Email Delivery](https://github.com/bhaskar1461/att3/blob/main/backend/app/services/email_service.py): `backend/app/services/email_service.py`
- [Google Sheets Sync](https://github.com/bhaskar1461/att3/blob/main/backend/app/services/gsheets_service.py): `backend/app/services/gsheets_service.py`
- [Excel Registers](https://github.com/bhaskar1461/att3/blob/main/backend/app/services/excel_service.py): `backend/app/services/excel_service.py`

### Other components

- **Student**
- **Teacher**
- **Administrator**
- **SMTP Providers**
- **Google Sheets**

## Connections

- Student → React Application: uses
- Teacher → React Application: uses
- Administrator → React Application: uses
- React Application → API Client: requests
- API Client → FastAPI Application: HTTP API
- FastAPI Application → Attendance APIs: dispatches
- FastAPI Application → Authentication API: dispatches
- FastAPI Application → Device Management: dispatches
- FastAPI Application → Onboarding API: dispatches
- FastAPI Application → Compliance Analytics: dispatches
- Projector QR → Student: displays QR
- Student → QR Scanner: scans QR
- QR Scanner → Attendance APIs: submits scan
- Attendance APIs → Attendance Engine: calculates attendance
- Attendance APIs → Academic Data Models: reads/writes
- Attendance Registers → API Client: requests registers
- Attendance Engine → Compliance Analytics: supplies metrics
- Device Binding Crypto → Binding Storage: stores keys
- Device Binding Crypto → Device Management: signs enrollment
- Device Management → Device Security: checks binding
- Device Management → Academic Data Models: reads/writes
- Onboarding Manager → API Client: requests onboarding
- API Client → Onboarding API: HTTP requests
- Onboarding API → Onboarding Service: handles onboarding
- Onboarding Service → Email Delivery: dispatches links
- Email Delivery → SMTP Providers: sends email
- Onboarding Service → Academic Data Models: updates roster
- Attendance APIs → Google Sheets Sync: syncs attendance
- Google Sheets Sync → Google Sheets: updates sheets
- Reports → Excel Registers: generates registers
- Attendance APIs → SQL Database: persists records
- Academic Data Models → SQL Database: maps data
- Compliance Analytics → Academic Data Models: reads academic data
