# spectator-code/stjsp architecture

> Architecture diagram of the GitHub repository spectator-code/stjsp, 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/spectator-code/stjsp
- Repository: https://github.com/spectator-code/stjsp

## Overview

This is a driving-school management web application for prospective students, learners, instructors, and school staff. The user-facing workflow spans public course information and the student portal, enrollment, learner progress and payments, then staff operations for student records, scheduling, fleet, tuition, and reporting. Server-rendered dashboards authenticate users and retrieve Supabase data before passing it to client views; API routes provide separate auth and domain endpoints. Source excerpts establish several page-to-view and layout-to-component links, but most client/API and API/database interactions are not shown, so they are not asserted.

Main entry points: [`web-app/src/app/layout.jsx`](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/layout.jsx) (Root Layout), [`web-app/src/app/portal/page.jsx`](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/portal/page.jsx) (Student Portal), [`web-app/src/app/dashboard/student/StudentDashboardClient.jsx`](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/student/StudentDashboardClient.jsx) (Student Dashboard), [`web-app/src/app/dashboard/instructor/page.jsx`](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/instructor/page.jsx) (Instructor Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public and Portal"]
  node_publicsite["Public Site<br/>[page.jsx]"]
  node_portal["Student Portal<br/>[page.jsx]"]
end

subgraph group_learning["Learner and Instruction"]
  node_studentview["Student Dashboard"]
  node_enrollapi["Enrollment API<br/>[route.js]"]
  node_progressapi["Progress API<br/>[route.js]"]
  node_instructpage["Instructor Page<br/>[page.jsx]"]
  node_instructview["Instructor View"]
end

subgraph group_staff["Staff Operations"]
  node_studentspage["Student Records Page<br/>[page.jsx]"]
  node_studentsview["Student Records View<br/>[StudentsClient.jsx]"]
  node_ops["Operations Dashboard<br/>[page.jsx]"]
  node_opsview["Operations View"]
  node_schedpage["Scheduling Page<br/>[page.jsx]"]
  node_schedview["Scheduling View"]
  node_fleet["Fleet Management<br/>[page.jsx]"]
  node_tuition["Tuition and Payments<br/>[TuitionClient.jsx]"]
  node_paymentsapi["Payments API<br/>[route.js]"]
  node_sessionsapi["Sessions API<br/>[route.js]"]
  node_vehiclesapi["Vehicles API<br/>[route.js]"]
  node_reports["Reports<br/>[page.jsx]"]
end

subgraph group_platform["Application Platform"]
  node_authapi["Authentication APIs"]
  node_statsapi["Dashboard Stats API<br/>[route.js]"]
  node_middleware["Request Middleware<br/>[middleware.js]"]
  node_supabaseclient["Supabase Client<br/>[client.js]"]
  node_supabaseserver["Supabase Server Client<br/>[server.js]"]
  node_supabasemiddleware["Supabase Middleware<br/>[middleware.js]"]
  node_globalui["Global UI Components"]
  node_confirm["Confirmation Dialog<br/>[ConfirmDialog.jsx]"]
  node_protect["Data Protection Guard"]
  node_loader["Global Loader<br/>[GlobalLoader.jsx]"]
  node_scroll["Scroll Controls<br/>[ScrollControls.jsx]"]
  node_layout["Root Layout<br/>[layout.jsx]"]
end

node_visitor(("Visitor / Learner"))
node_supabase[("Supabase Service")]

node_visitor -.->|"visits"| node_publicsite
node_visitor -.->|"opens portal"| node_portal
node_portal -.->|"serves learner"| node_studentview
node_studentview -->|"requests enrollment"| node_enrollapi
node_instructpage -->|"renders"| node_instructview
node_ops -->|"renders"| node_opsview
node_schedpage -->|"renders"| node_schedview
node_studentspage -->|"renders"| node_studentsview
node_layout -->|"renders"| node_confirm
node_layout -->|"renders"| node_protect
node_layout -->|"renders"| node_loader
node_layout -->|"renders"| node_scroll

click node_publicsite "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/page.jsx"
click node_portal "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/portal/page.jsx"
click node_studentview "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/student/StudentDashboardClient.jsx"
click node_enrollapi "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/enroll/route.js"
click node_progressapi "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/progress/route.js"
click node_instructpage "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/instructor/page.jsx"
click node_instructview "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/instructor/InstructorClient.jsx"
click node_studentspage "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/students/page.jsx"
click node_studentsview "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/students/StudentsClient.jsx"
click node_ops "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/operations/page.jsx"
click node_opsview "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/operations/OperationsClient.jsx"
click node_schedpage "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/scheduling/page.jsx"
click node_schedview "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/scheduling/SchedulingClient.jsx"
click node_fleet "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/fleet/page.jsx"
click node_tuition "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/tuition/TuitionClient.jsx"
click node_paymentsapi "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/payments/route.js"
click node_sessionsapi "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/sessions/route.js"
click node_vehiclesapi "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/vehicles/route.js"
click node_reports "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/reports/page.jsx"
click node_authapi "https://github.com/spectator-code/stjsp/tree/main/web-app/src/app/api/auth"
click node_statsapi "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/dashboard/stats/route.js"
click node_middleware "https://github.com/spectator-code/stjsp/blob/main/web-app/src/middleware.js"
click node_supabaseclient "https://github.com/spectator-code/stjsp/blob/main/web-app/src/utils/supabase/client.js"
click node_supabaseserver "https://github.com/spectator-code/stjsp/blob/main/web-app/src/utils/supabase/server.js"
click node_supabasemiddleware "https://github.com/spectator-code/stjsp/blob/main/web-app/src/utils/supabase/middleware.js"
click node_globalui "https://github.com/spectator-code/stjsp/tree/main/web-app/src/app/components"
click node_confirm "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/ConfirmDialog.jsx"
click node_protect "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/DataProtectionGuard.jsx"
click node_loader "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/GlobalLoader.jsx"
click node_scroll "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/ScrollControls.jsx"
click node_layout "https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/layout.jsx"

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_publicsite,node_portal toneBlue
class node_studentview,node_enrollapi,node_progressapi,node_instructpage,node_instructview,node_supabase toneAmber
class node_studentspage,node_studentsview,node_ops,node_opsview,node_schedpage,node_schedview,node_fleet,node_tuition,node_paymentsapi,node_sessionsapi,node_vehiclesapi,node_reports toneMint
class node_authapi,node_statsapi,node_middleware,node_supabaseclient,node_supabaseserver,node_supabasemiddleware,node_globalui,node_confirm,node_protect,node_loader,node_scroll,node_layout toneRose
class node_visitor toneIndigo
```

## Components

### Public and Portal

- [Public Site](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/page.jsx): `web-app/src/app/page.jsx`
- [Student Portal](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/portal/page.jsx): `web-app/src/app/portal/page.jsx`

### Learner and Instruction

- [Student Dashboard](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/student/StudentDashboardClient.jsx): `web-app/src/app/dashboard/student/StudentDashboardClient.jsx`
- [Enrollment API](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/enroll/route.js): `web-app/src/app/api/enroll/route.js`
- [Progress API](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/progress/route.js): `web-app/src/app/api/progress/route.js`
- [Instructor Page](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/instructor/page.jsx): `web-app/src/app/dashboard/instructor/page.jsx`
- [Instructor View](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/instructor/InstructorClient.jsx): `web-app/src/app/dashboard/instructor/InstructorClient.jsx`

### Staff Operations

- [Student Records Page](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/students/page.jsx): `web-app/src/app/dashboard/students/page.jsx`
- [Student Records View](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/students/StudentsClient.jsx): `web-app/src/app/dashboard/students/StudentsClient.jsx`
- [Operations Dashboard](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/operations/page.jsx): `web-app/src/app/dashboard/operations/page.jsx`
- [Operations View](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/operations/OperationsClient.jsx): `web-app/src/app/dashboard/operations/OperationsClient.jsx`
- [Scheduling Page](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/scheduling/page.jsx): `web-app/src/app/dashboard/scheduling/page.jsx`
- [Scheduling View](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/scheduling/SchedulingClient.jsx): `web-app/src/app/dashboard/scheduling/SchedulingClient.jsx`
- [Fleet Management](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/fleet/page.jsx): `web-app/src/app/dashboard/fleet/page.jsx`
- [Tuition and Payments](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/tuition/TuitionClient.jsx): `web-app/src/app/dashboard/tuition/TuitionClient.jsx`
- [Payments API](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/payments/route.js): `web-app/src/app/api/payments/route.js`
- [Sessions API](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/sessions/route.js): `web-app/src/app/api/sessions/route.js`
- [Vehicles API](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/vehicles/route.js): `web-app/src/app/api/vehicles/route.js`
- [Reports](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/dashboard/reports/page.jsx): `web-app/src/app/dashboard/reports/page.jsx`

### Application Platform

- [Authentication APIs](https://github.com/spectator-code/stjsp/tree/main/web-app/src/app/api/auth): `web-app/src/app/api/auth`
- [Dashboard Stats API](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/api/dashboard/stats/route.js): `web-app/src/app/api/dashboard/stats/route.js`
- [Request Middleware](https://github.com/spectator-code/stjsp/blob/main/web-app/src/middleware.js): `web-app/src/middleware.js`
- [Supabase Client](https://github.com/spectator-code/stjsp/blob/main/web-app/src/utils/supabase/client.js): `web-app/src/utils/supabase/client.js`
- [Supabase Server Client](https://github.com/spectator-code/stjsp/blob/main/web-app/src/utils/supabase/server.js): `web-app/src/utils/supabase/server.js`
- [Supabase Middleware](https://github.com/spectator-code/stjsp/blob/main/web-app/src/utils/supabase/middleware.js): `web-app/src/utils/supabase/middleware.js`
- [Global UI Components](https://github.com/spectator-code/stjsp/tree/main/web-app/src/app/components): `web-app/src/app/components`
- [Confirmation Dialog](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/ConfirmDialog.jsx): `web-app/src/app/components/ConfirmDialog.jsx`
- [Data Protection Guard](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/DataProtectionGuard.jsx): `web-app/src/app/components/DataProtectionGuard.jsx`
- [Global Loader](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/GlobalLoader.jsx): `web-app/src/app/components/GlobalLoader.jsx`
- [Scroll Controls](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/components/ScrollControls.jsx): `web-app/src/app/components/ScrollControls.jsx`
- [Root Layout](https://github.com/spectator-code/stjsp/blob/main/web-app/src/app/layout.jsx): `web-app/src/app/layout.jsx`

### Other components

- **Visitor / Learner**
- **Supabase Service**

## Connections

- Visitor / Learner → Public Site: visits
- Visitor / Learner → Student Portal: opens portal
- Student Portal → Student Dashboard: serves learner
- Student Dashboard → Enrollment API: requests enrollment (evidence: `web-app/src/app/dashboard/student/StudentDashboardClient.jsx`)
- Instructor Page → Instructor View: renders (evidence: `web-app/src/app/dashboard/instructor/page.jsx`)
- Operations Dashboard → Operations View: renders (evidence: `web-app/src/app/dashboard/operations/page.jsx`)
- Scheduling Page → Scheduling View: renders (evidence: `web-app/src/app/dashboard/scheduling/page.jsx`)
- Student Records Page → Student Records View: renders (evidence: `web-app/src/app/dashboard/students/page.jsx`)
- Root Layout → Confirmation Dialog: renders (evidence: `web-app/src/app/layout.jsx`)
- Root Layout → Data Protection Guard: renders (evidence: `web-app/src/app/layout.jsx`)
- Root Layout → Global Loader: renders (evidence: `web-app/src/app/layout.jsx`)
- Root Layout → Scroll Controls: renders (evidence: `web-app/src/app/layout.jsx`)
