# emmy6-d/student-rfid-attendance architecture

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

- Interactive diagram: https://gitdiagram.com/emmy6-d/student-rfid-attendance
- Repository: https://github.com/emmy6-d/student-rfid-attendance

## Overview

Classmark is a student registration and RFID attendance application. Staff use the React app to register students, enroll and manage cards, and review attendance and dashboard totals; an ESP32 reader submits enrollment scans and attendance check-ins to FastAPI, which validates and records them in Supabase. The graph preserves these distinct workflows and notification, reporting, and device capabilities. Backend route/service details are partly evidenced by the source index and excerpts; hardware-to-API behavior is documented in the README.

Main entry points: [`frontend/src/api.js`](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/api.js) (API client), [`frontend/src/routes/AppRoutes.jsx`](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/routes/AppRoutes.jsx) (App routes), [`backend/app/main.py`](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/services/attendance_service.py`](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/services/attendance_service.py) (Attendance service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Staff web app"]
  node_routes["App routes<br/>[AppRoutes.jsx]"]
  node_students_ui["Student register<br/>[StudentsPage.jsx]"]
  node_registration["Student registration"]
  node_enroll_dialog["Enrollment dialog"]
  node_cards_ui["Card management<br/>[CardsPage.jsx]"]
  node_attendance_ui["Attendance view<br/>[AttendancePage.jsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.jsx]"]
  node_notifications["Scan notifications"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_student_routes["Student endpoints<br/>[students.py]"]
  node_rfid_routes["RFID endpoints<br/>[rfid.py]"]
  node_attendance_routes["Attendance endpoints<br/>[attendance.py]"]
  node_student_service["Student service<br/>[student_service.py]"]
  node_rfid_service["Card enrollment service<br/>[rfid_service.py]"]
  node_attendance_service["Attendance service"]
end

subgraph group_data["Attendance data"]
  node_database_client["Supabase client<br/>[database.py]"]
  node_supabase[("Supabase tables<br/>[schema.sql]")]
end

subgraph group_device["RFID device"]
  node_esp32["ESP32 RFID reader"]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_routes
node_routes -->|"routes to"| node_students_ui
node_routes -->|"routes to"| node_registration
node_routes -->|"routes to"| node_cards_ui
node_routes -->|"routes to"| node_attendance_ui
node_routes -->|"routes to"| node_dashboard
node_students_ui -->|"requests data"| node_api_client
node_registration -->|"requests data"| node_api_client
node_cards_ui -->|"requests data"| node_api_client
node_attendance_ui -->|"requests data"| node_api_client
node_dashboard -->|"requests data"| node_api_client
node_registration -->|"opens"| node_enroll_dialog
node_cards_ui -->|"opens"| node_enroll_dialog
node_api_client -->|"sends requests"| node_fastapi
node_fastapi -->|"registers"| node_student_routes
node_fastapi -->|"registers"| node_rfid_routes
node_fastapi -->|"registers"| node_attendance_routes
node_student_routes -->|"calls"| node_student_service
node_rfid_routes -->|"calls"| node_rfid_service
node_attendance_routes -->|"calls"| node_attendance_service
node_student_service -->|"uses"| node_database_client
node_rfid_service -->|"uses"| node_database_client
node_attendance_service -->|"uses"| node_database_client
node_database_client -->|"connects to"| node_supabase
node_attendance_service -->|"reads and writes"| node_supabase
node_esp32 -->|"submits scans"| node_fastapi
node_enroll_dialog -->|"polls requests"| node_api_client
node_notifications -->|"fetches events"| node_api_client
node_fastapi -.->|"serves scan events"| node_notifications
node_dashboard -.->|"loads totals"| node_attendance_service

click node_routes "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/routes/AppRoutes.jsx"
click node_students_ui "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/StudentsPage.jsx"
click node_registration "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/RegisterStudentPage.jsx"
click node_enroll_dialog "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/components/CardEnrollmentDialog.jsx"
click node_cards_ui "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/CardsPage.jsx"
click node_attendance_ui "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/AttendancePage.jsx"
click node_dashboard "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_notifications "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/components/AttendanceNotifications.jsx"
click node_api_client "https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/api.js"
click node_fastapi "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/main.py"
click node_student_routes "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/routes/students.py"
click node_rfid_routes "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/routes/rfid.py"
click node_attendance_routes "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/routes/attendance.py"
click node_student_service "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/services/student_service.py"
click node_rfid_service "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/services/rfid_service.py"
click node_attendance_service "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/services/attendance_service.py"
click node_database_client "https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/database.py"
click node_supabase "https://github.com/emmy6-d/student-rfid-attendance/blob/main/database/schema.sql"
click node_esp32 "https://github.com/emmy6-d/student-rfid-attendance/blob/main/esp32/student_rfid_attendance/student_rfid_attendance.ino"

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_routes,node_students_ui,node_registration,node_enroll_dialog,node_cards_ui,node_attendance_ui,node_dashboard,node_notifications,node_api_client,node_staff toneBlue
class node_fastapi,node_student_routes,node_rfid_routes,node_attendance_routes,node_student_service,node_rfid_service,node_attendance_service toneAmber
class node_database_client,node_supabase toneMint
class node_esp32 toneRose
```

## Components

### Staff web app

- [App routes](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/routes/AppRoutes.jsx): `frontend/src/routes/AppRoutes.jsx`
- [Student register](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/StudentsPage.jsx): `frontend/src/pages/StudentsPage.jsx`
- [Student registration](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/RegisterStudentPage.jsx): `frontend/src/pages/RegisterStudentPage.jsx`
- [Enrollment dialog](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/components/CardEnrollmentDialog.jsx): `frontend/src/components/CardEnrollmentDialog.jsx`
- [Card management](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/CardsPage.jsx): `frontend/src/pages/CardsPage.jsx`
- [Attendance view](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/AttendancePage.jsx): `frontend/src/pages/AttendancePage.jsx`
- [Dashboard](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Scan notifications](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/components/AttendanceNotifications.jsx): `frontend/src/components/AttendanceNotifications.jsx`
- [API client](https://github.com/emmy6-d/student-rfid-attendance/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Backend API

- [FastAPI application](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/main.py): `backend/app/main.py`
- [Student endpoints](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/routes/students.py): `backend/app/routes/students.py`
- [RFID endpoints](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/routes/rfid.py): `backend/app/routes/rfid.py`
- [Attendance endpoints](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/routes/attendance.py): `backend/app/routes/attendance.py`
- [Student service](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/services/student_service.py): `backend/app/services/student_service.py`
- [Card enrollment service](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/services/rfid_service.py): `backend/app/services/rfid_service.py`
- [Attendance service](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/services/attendance_service.py): `backend/app/services/attendance_service.py`

### Attendance data

- [Supabase client](https://github.com/emmy6-d/student-rfid-attendance/blob/main/backend/app/database.py): `backend/app/database.py`
- [Supabase tables](https://github.com/emmy6-d/student-rfid-attendance/blob/main/database/schema.sql): `database/schema.sql`

### RFID device

- [ESP32 RFID reader](https://github.com/emmy6-d/student-rfid-attendance/blob/main/esp32/student_rfid_attendance/student_rfid_attendance.ino): `esp32/student_rfid_attendance/student_rfid_attendance.ino`

### Other components

- **Staff user**

## Connections

- Staff user → App routes: uses (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routes → Student register: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routes → Student registration: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routes → Card management: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routes → Attendance view: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Student register → API client: requests data (evidence: `frontend/src/pages/StudentsPage.jsx`)
- Student registration → API client: requests data (evidence: `frontend/src/pages/RegisterStudentPage.jsx`)
- Card management → API client: requests data (evidence: `frontend/src/pages/CardsPage.jsx`)
- Attendance view → API client: requests data (evidence: `frontend/src/pages/AttendancePage.jsx`)
- Dashboard → API client: requests data (evidence: `frontend/src/pages/DashboardPage.jsx`)
- Student registration → Enrollment dialog: opens (evidence: `frontend/src/pages/RegisterStudentPage.jsx`)
- Card management → Enrollment dialog: opens (evidence: `frontend/src/pages/CardsPage.jsx`)
- API client → FastAPI application: sends requests (evidence: `README.md`)
- FastAPI application → Student endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → RFID endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → Attendance endpoints: registers (evidence: `backend/app/main.py`)
- Student endpoints → Student service: calls (evidence: `backend/app/routes/students.py`)
- RFID endpoints → Card enrollment service: calls (evidence: `backend/app/routes/rfid.py`)
- Attendance endpoints → Attendance service: calls (evidence: `backend/app/routes/attendance.py`)
- Student service → Supabase client: uses (evidence: `backend/app/services/student_service.py`)
- Card enrollment service → Supabase client: uses (evidence: `backend/app/services/rfid_service.py`)
- Attendance service → Supabase client: uses (evidence: `backend/app/services/attendance_service.py`)
- Supabase client → Supabase tables: connects to (evidence: `backend/app/database.py`)
- Attendance service → Supabase tables: reads and writes (evidence: `backend/app/services/attendance_service.py`)
- ESP32 RFID reader → FastAPI application: submits scans (evidence: `README.md`)
- Enrollment dialog → API client: polls requests (evidence: `frontend/src/components/CardEnrollmentDialog.jsx`)
- Scan notifications → API client: fetches events (evidence: `frontend/src/components/AttendanceNotifications.jsx`)
- FastAPI application → Scan notifications: serves scan events (evidence: `README.md`)
- Dashboard → Attendance service: loads totals
