# leopadilla147/cnnhs-svock-finalrepo210926 architecture

> Architecture diagram of the GitHub repository leopadilla147/cnnhs-svock-finalrepo210926, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leopadilla147/cnnhs-svock-finalrepo210926
- Repository: https://github.com/leopadilla147/cnnhs-svock-finalrepo210926

## Overview

This is an online voting system for students and school election staff. Its user-facing workflow runs from student registration and candidacy submission through staff review and election administration to voting and live results; complaints, reports, and archives support election oversight. The React app routes these surfaces through shared application state, which synchronizes domain data with Supabase. The README gives only the product name, and several core pages and voting modules were not excerpted, so those capabilities are represented from the file tree without asserting unverified implementation links.

Main entry points: [`src/app/routes.tsx`](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/routes.tsx) (Role routes), [`src/app/lib/supabaseData.ts`](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/supabaseData.ts) (Domain data access), [`src/app/context/AppContext.tsx`](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/context/AppContext.tsx) (Application state), [`src/app/lib/supabase.ts`](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/supabase.ts) (Supabase service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_app["App bootstrap<br/>[App.tsx]"]
  node_routes["Role routes<br/>[routes.tsx]"]
end

subgraph group_identity["Identity and data"]
  node_registration["Student registration<br/>[RegisterPage.tsx]"]
  node_login["Login<br/>[LoginPage.tsx]"]
  node_session["Session token<br/>[session.ts]"]
  node_context["Application state<br/>[AppContext.tsx]"]
  node_data["Domain data access<br/>[supabaseData.ts]"]
  node_supabase["Supabase service<br/>[supabase.ts]"]
  node_database[("Supabase database")]
end

subgraph group_election["Election workflow"]
  node_candidacy["Candidacy application"]
  node_eaf["Application document"]
  node_review["Candidate review"]
  node_setup["Election setup"]
  node_vote["Voting<br/>[voteApi.ts]"]
  node_receipt["Vote receipt"]
  node_results["Live results"]
  node_functions["Candidacy functions"]
end

subgraph group_oversight["Oversight"]
  node_complaints["Complaints"]
  node_student_complaints["Student complaints"]
  node_reports["Reports<br/>[AdminReports.tsx]"]
  node_archive["Election archive<br/>[AdminArchive.tsx]"]
  node_students["Student records<br/>[AdminStudents.tsx]"]
  node_appointments["Staff appointments"]
end

node_student(("Student"))
node_staff(("Election staff"))

node_app -->|"provides state"| node_context
node_app -->|"mounts routes"| node_routes
node_routes -->|"routes to"| node_registration
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_candidacy
node_routes -->|"routes to"| node_review
node_routes -->|"routes to"| node_setup
node_routes -->|"routes to"| node_results
node_routes -->|"routes to"| node_complaints
node_routes -->|"routes to"| node_student_complaints
node_routes -->|"routes to"| node_reports
node_routes -->|"routes to"| node_archive
node_routes -->|"routes to"| node_students
node_routes -->|"routes to"| node_appointments
node_student -.->|"registers"| node_registration
node_student -.->|"applies"| node_candidacy
node_staff -.->|"reviews"| node_review
node_registration -->|"registers student"| node_data
node_login -->|"uses state"| node_context
node_context -->|"loads and syncs"| node_data
node_context -->|"clears session"| node_session
node_context -->|"uses client"| node_supabase
node_data -->|"queries and writes"| node_supabase
node_supabase -->|"attaches token"| node_session
node_supabase -.->|"accesses data"| node_database
node_candidacy -->|"submits application"| node_data
node_candidacy -->|"previews form"| node_eaf
node_review -->|"reviews candidate"| node_data
node_functions -.->|"handles candidacy"| node_database
node_vote -.->|"records ballots"| node_database
node_vote -.->|"shows receipt"| node_receipt
node_results -.->|"loads results"| node_data
node_student_complaints -.->|"submits complaint"| node_data
node_complaints -.->|"manages complaints"| node_data
node_reports -.->|"builds reports"| node_data
node_archive -.->|"loads records"| node_data
node_students -->|"manages records"| node_data
node_appointments -->|"manages appointments"| node_data

click node_app "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/App.tsx"
click node_routes "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/routes.tsx"
click node_registration "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/RegisterPage.tsx"
click node_login "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/LoginPage.tsx"
click node_session "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/session.ts"
click node_context "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/context/AppContext.tsx"
click node_data "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/supabaseData.ts"
click node_supabase "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/supabase.ts"
click node_candidacy "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/student/StudentApplyCandidacy.tsx"
click node_eaf "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/components/EAFPreviewDocument.tsx"
click node_review "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminCandidates.tsx"
click node_setup "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminElectionSetup.tsx"
click node_vote "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/voteApi.ts"
click node_receipt "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/components/VoteReceiptDialog.tsx"
click node_results "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminLiveResults.tsx"
click node_complaints "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminComplaints.tsx"
click node_student_complaints "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/student/StudentComplaints.tsx"
click node_reports "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminReports.tsx"
click node_archive "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminArchive.tsx"
click node_students "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminStudents.tsx"
click node_appointments "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/ChiefAppointments.tsx"
click node_functions "https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/tree/main/supabase/functions"

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_routes toneBlue
class node_registration,node_login,node_session,node_context,node_data,node_supabase,node_database toneAmber
class node_candidacy,node_eaf,node_review,node_setup,node_vote,node_receipt,node_results,node_functions toneMint
class node_complaints,node_student_complaints,node_reports,node_archive,node_students,node_appointments toneRose
class node_student,node_staff toneIndigo
```

## Components

### App entry

- [App bootstrap](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Role routes](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/routes.tsx): `src/app/routes.tsx`

### Identity and data

- [Student registration](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/RegisterPage.tsx): `src/app/pages/RegisterPage.tsx`
- [Login](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/LoginPage.tsx): `src/app/pages/LoginPage.tsx`
- [Session token](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/session.ts): `src/app/lib/session.ts`
- [Application state](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/context/AppContext.tsx): `src/app/context/AppContext.tsx`
- [Domain data access](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/supabaseData.ts): `src/app/lib/supabaseData.ts`
- [Supabase service](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/supabase.ts): `src/app/lib/supabase.ts`
- **Supabase database**

### Election workflow

- [Candidacy application](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/student/StudentApplyCandidacy.tsx): `src/app/pages/student/StudentApplyCandidacy.tsx`
- [Application document](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/components/EAFPreviewDocument.tsx): `src/app/components/EAFPreviewDocument.tsx`
- [Candidate review](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminCandidates.tsx): `src/app/pages/admin/AdminCandidates.tsx`
- [Election setup](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminElectionSetup.tsx): `src/app/pages/admin/AdminElectionSetup.tsx`
- [Voting](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/lib/voteApi.ts): `src/app/lib/voteApi.ts`
- [Vote receipt](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/components/VoteReceiptDialog.tsx): `src/app/components/VoteReceiptDialog.tsx`
- [Live results](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminLiveResults.tsx): `src/app/pages/admin/AdminLiveResults.tsx`
- [Candidacy functions](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/tree/main/supabase/functions): `supabase/functions`

### Oversight

- [Complaints](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminComplaints.tsx): `src/app/pages/admin/AdminComplaints.tsx`
- [Student complaints](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/student/StudentComplaints.tsx): `src/app/pages/student/StudentComplaints.tsx`
- [Reports](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminReports.tsx): `src/app/pages/admin/AdminReports.tsx`
- [Election archive](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminArchive.tsx): `src/app/pages/admin/AdminArchive.tsx`
- [Student records](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/AdminStudents.tsx): `src/app/pages/admin/AdminStudents.tsx`
- [Staff appointments](https://github.com/leopadilla147/cnnhs-svock-finalrepo210926/blob/main/src/app/pages/admin/ChiefAppointments.tsx): `src/app/pages/admin/ChiefAppointments.tsx`

### Other components

- **Student**
- **Election staff**

## Connections

- App bootstrap → Application state: provides state (evidence: `src/app/App.tsx`)
- App bootstrap → Role routes: mounts routes (evidence: `src/app/App.tsx`)
- Role routes → Student registration: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Login: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Candidacy application: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Candidate review: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Election setup: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Live results: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Complaints: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Student complaints: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Reports: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Election archive: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Student records: routes to (evidence: `src/app/routes.tsx`)
- Role routes → Staff appointments: routes to (evidence: `src/app/routes.tsx`)
- Student → Student registration: registers
- Student → Candidacy application: applies
- Election staff → Candidate review: reviews
- Student registration → Domain data access: registers student (evidence: `src/app/pages/RegisterPage.tsx`)
- Login → Application state: uses state (evidence: `src/app/pages/LoginPage.tsx`)
- Application state → Domain data access: loads and syncs (evidence: `src/app/context/AppContext.tsx`)
- Application state → Session token: clears session (evidence: `src/app/context/AppContext.tsx`)
- Application state → Supabase service: uses client (evidence: `src/app/context/AppContext.tsx`)
- Domain data access → Supabase service: queries and writes (evidence: `src/app/lib/supabaseData.ts`)
- Supabase service → Session token: attaches token (evidence: `src/app/lib/supabase.ts`)
- Supabase service → Supabase database: accesses data
- Candidacy application → Domain data access: submits application (evidence: `src/app/pages/student/StudentApplyCandidacy.tsx`)
- Candidacy application → Application document: previews form (evidence: `src/app/components/EAFPreviewDocument.tsx`)
- Candidate review → Domain data access: reviews candidate (evidence: `src/app/pages/admin/AdminCandidates.tsx`)
- Candidacy functions → Supabase database: handles candidacy
- Voting → Supabase database: records ballots
- Voting → Vote receipt: shows receipt
- Live results → Domain data access: loads results
- Student complaints → Domain data access: submits complaint
- Complaints → Domain data access: manages complaints
- Reports → Domain data access: builds reports
- Election archive → Domain data access: loads records
- Student records → Domain data access: manages records (evidence: `src/app/pages/admin/AdminStudents.tsx`)
- Staff appointments → Domain data access: manages appointments (evidence: `src/app/pages/admin/ChiefAppointments.tsx`)
