# mark920-hub/ltnhs architecture

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

## Overview

STNHS QR Attendance & Scheduling is a role-based school administration web app. Users authenticate, then manage attendance, schedules, enrollments and notifications through a React client backed by Express APIs and PostgreSQL; attendance reporting and live updates round out the workflow. The graph preserves README capabilities even where route or page implementation was not sampled. Client-to-route links reflect documented API domains, but detailed request wiring and storage behavior for unsampled modules are not inferred.

Main entry points: [`client/src/App.tsx`](https://github.com/mark920-hub/ltnhs/blob/main/client/src/App.tsx) (Application router), [`server/src/routes/schedules.ts`](https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/schedules.ts) (Schedule API), [`server/src/routes/attendance.ts`](https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/attendance.ts) (Attendance API), [`server/src/db.ts`](https://github.com/mark920-hub/ltnhs/blob/main/server/src/db.ts) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Application router<br/>[App.tsx]"]
  node_auth_ui["Login and registration<br/>[AuthPage.tsx]"]
  node_dashboard["Dashboard reports<br/>[DashboardPage.tsx]"]
  node_attendance_ui["Attendance views<br/>[AttendancePage.tsx]"]
  node_scan_ui["QR scan station"]
  node_schedules_ui["Schedule workflows"]
  node_teacher_schedule["Teacher schedule tools"]
  node_enrollment_ui["Enrollment approvals"]
  node_student_subjects["Student subjects"]
  node_users_ui["User administration"]
  node_notifications_ui["Notifications"]
  node_client_socket["Realtime client<br/>[socket.ts]"]
end

subgraph group_identity["Identity and users"]
  node_auth_api["Authentication API<br/>[auth.ts]"]
  node_users_api["User API<br/>[users.ts]"]
end

subgraph group_school["School operations"]
  node_schedules_api["Schedule API<br/>[schedules.ts]"]
  node_attendance_api["Attendance API<br/>[attendance.ts]"]
  node_notifications_api["Notification API<br/>[notifications.ts]"]
end

subgraph group_platform["Server platform"]
  node_server["HTTP API server<br/>[index.ts]"]
  node_middleware["Authentication middleware<br/>[middleware.ts]"]
  node_socket_server["Realtime events<br/>[socket.ts]"]
  node_db_access["Database access<br/>[db.ts]"]
  node_postgres[("PostgreSQL")]
end

node_school_users(("School users"))

node_school_users -->|"use"| node_app
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_attendance_ui
node_app -->|"routes to"| node_scan_ui
node_app -->|"routes to"| node_schedules_ui
node_app -->|"routes to"| node_enrollment_ui
node_app -->|"routes to"| node_student_subjects
node_app -->|"routes to"| node_users_ui
node_app -->|"routes to"| node_notifications_ui
node_teacher_schedule -->|"submits templates"| node_schedules_api
node_auth_ui -->|"authenticates"| node_auth_api
node_dashboard -->|"requests reports"| node_attendance_api
node_attendance_ui -->|"requests attendance"| node_attendance_api
node_scan_ui -->|"logs scans"| node_attendance_api
node_schedules_ui -->|"manages schedules"| node_schedules_api
node_enrollment_ui -->|"reviews enrollments"| node_schedules_api
node_student_subjects -->|"submits subjects"| node_schedules_api
node_users_ui -->|"manages accounts"| node_users_api
node_notifications_ui -->|"loads notifications"| node_notifications_api
node_notifications_ui -->|"receives events"| node_client_socket
node_client_socket -->|"connects"| node_socket_server
node_server -->|"mounts route"| node_auth_api
node_server -->|"mounts route"| node_schedules_api
node_server -->|"mounts route"| node_attendance_api
node_server -->|"mounts route"| node_notifications_api
node_server -->|"mounts route"| node_users_api
node_auth_api -->|"queries"| node_db_access
node_users_api -->|"protects routes"| node_middleware
node_schedules_api -->|"protects routes"| node_middleware
node_attendance_api -->|"protects routes"| node_middleware
node_notifications_api -->|"protects routes"| node_middleware
node_users_api -->|"queries"| node_db_access
node_schedules_api -->|"queries"| node_db_access
node_attendance_api -->|"queries"| node_db_access
node_notifications_api -->|"queries"| node_db_access
node_schedules_api -->|"emits updates"| node_socket_server
node_db_access -->|"reads and writes"| node_postgres

click node_app "https://github.com/mark920-hub/ltnhs/blob/main/client/src/App.tsx"
click node_auth_ui "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/AuthPage.tsx"
click node_dashboard "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/DashboardPage.tsx"
click node_attendance_ui "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/AttendancePage.tsx"
click node_scan_ui "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/ScanStationPage.tsx"
click node_schedules_ui "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/ScheduleSubmissionsPage.tsx"
click node_teacher_schedule "https://github.com/mark920-hub/ltnhs/blob/main/client/src/components/teacher/ScheduleSubmissionSection.tsx"
click node_enrollment_ui "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/EnrollmentSubmissionsPage.tsx"
click node_student_subjects "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/StudentSubjectsPage.tsx"
click node_users_ui "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/UserManagementPage.tsx"
click node_notifications_ui "https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/NotificationsPage.tsx"
click node_client_socket "https://github.com/mark920-hub/ltnhs/blob/main/client/src/lib/socket.ts"
click node_auth_api "https://github.com/mark920-hub/ltnhs/blob/main/server/src/auth.ts"
click node_users_api "https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/users.ts"
click node_schedules_api "https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/schedules.ts"
click node_attendance_api "https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/attendance.ts"
click node_notifications_api "https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/notifications.ts"
click node_server "https://github.com/mark920-hub/ltnhs/blob/main/server/src/index.ts"
click node_middleware "https://github.com/mark920-hub/ltnhs/blob/main/server/src/middleware.ts"
click node_socket_server "https://github.com/mark920-hub/ltnhs/blob/main/server/src/socket.ts"
click node_db_access "https://github.com/mark920-hub/ltnhs/blob/main/server/src/db.ts"

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_auth_ui,node_dashboard,node_attendance_ui,node_scan_ui,node_schedules_ui,node_teacher_schedule,node_enrollment_ui,node_student_subjects,node_users_ui,node_notifications_ui,node_client_socket,node_school_users toneBlue
class node_auth_api,node_users_api toneAmber
class node_schedules_api,node_attendance_api,node_notifications_api toneMint
class node_server,node_middleware,node_socket_server,node_db_access,node_postgres toneRose
```

## Components

### Web client

- [Application router](https://github.com/mark920-hub/ltnhs/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Login and registration](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/AuthPage.tsx): `client/src/pages/AuthPage.tsx`
- [Dashboard reports](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/DashboardPage.tsx): `client/src/pages/DashboardPage.tsx`
- [Attendance views](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/AttendancePage.tsx): `client/src/pages/AttendancePage.tsx`
- [QR scan station](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/ScanStationPage.tsx): `client/src/pages/ScanStationPage.tsx`
- [Schedule workflows](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/ScheduleSubmissionsPage.tsx): `client/src/pages/ScheduleSubmissionsPage.tsx`
- [Teacher schedule tools](https://github.com/mark920-hub/ltnhs/blob/main/client/src/components/teacher/ScheduleSubmissionSection.tsx): `client/src/components/teacher/ScheduleSubmissionSection.tsx`
- [Enrollment approvals](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/EnrollmentSubmissionsPage.tsx): `client/src/pages/EnrollmentSubmissionsPage.tsx`
- [Student subjects](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/StudentSubjectsPage.tsx): `client/src/pages/StudentSubjectsPage.tsx`
- [User administration](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/UserManagementPage.tsx): `client/src/pages/UserManagementPage.tsx`
- [Notifications](https://github.com/mark920-hub/ltnhs/blob/main/client/src/pages/NotificationsPage.tsx): `client/src/pages/NotificationsPage.tsx`
- [Realtime client](https://github.com/mark920-hub/ltnhs/blob/main/client/src/lib/socket.ts): `client/src/lib/socket.ts`

### Identity and users

- [Authentication API](https://github.com/mark920-hub/ltnhs/blob/main/server/src/auth.ts): `server/src/auth.ts`
- [User API](https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/users.ts): `server/src/routes/users.ts`

### School operations

- [Schedule API](https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/schedules.ts): `server/src/routes/schedules.ts`
- [Attendance API](https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/attendance.ts): `server/src/routes/attendance.ts`
- [Notification API](https://github.com/mark920-hub/ltnhs/blob/main/server/src/routes/notifications.ts): `server/src/routes/notifications.ts`

### Server platform

- [HTTP API server](https://github.com/mark920-hub/ltnhs/blob/main/server/src/index.ts): `server/src/index.ts`
- [Authentication middleware](https://github.com/mark920-hub/ltnhs/blob/main/server/src/middleware.ts): `server/src/middleware.ts`
- [Realtime events](https://github.com/mark920-hub/ltnhs/blob/main/server/src/socket.ts): `server/src/socket.ts`
- [Database access](https://github.com/mark920-hub/ltnhs/blob/main/server/src/db.ts): `server/src/db.ts`
- **PostgreSQL**

### Other components

- **School users**

## Connections

- School users → Application router: use
- Application router → Login and registration: routes to
- Application router → Dashboard reports: routes to
- Application router → Attendance views: routes to
- Application router → QR scan station: routes to
- Application router → Schedule workflows: routes to
- Application router → Enrollment approvals: routes to
- Application router → Student subjects: routes to
- Application router → User administration: routes to
- Application router → Notifications: routes to
- Teacher schedule tools → Schedule API: submits templates
- Login and registration → Authentication API: authenticates
- Dashboard reports → Attendance API: requests reports
- Attendance views → Attendance API: requests attendance
- QR scan station → Attendance API: logs scans
- Schedule workflows → Schedule API: manages schedules
- Enrollment approvals → Schedule API: reviews enrollments
- Student subjects → Schedule API: submits subjects
- User administration → User API: manages accounts
- Notifications → Notification API: loads notifications
- Notifications → Realtime client: receives events
- Realtime client → Realtime events: connects
- HTTP API server → Authentication API: mounts route
- HTTP API server → Schedule API: mounts route
- HTTP API server → Attendance API: mounts route
- HTTP API server → Notification API: mounts route
- HTTP API server → User API: mounts route
- Authentication API → Database access: queries
- User API → Authentication middleware: protects routes
- Schedule API → Authentication middleware: protects routes
- Attendance API → Authentication middleware: protects routes
- Notification API → Authentication middleware: protects routes
- User API → Database access: queries
- Schedule API → Database access: queries
- Attendance API → Database access: queries
- Notification API → Database access: queries
- Schedule API → Realtime events: emits updates
- Database access → PostgreSQL: reads and writes
