# chesterbaltazar/ssc_voting_system architecture

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

- Interactive diagram: https://gitdiagram.com/chesterbaltazar/ssc_voting_system
- Repository: https://github.com/chesterbaltazar/ssc_voting_system

## Overview

This repository implements a school student-council election platform: users register or sign in, candidates/partylists are subject to administrative approval, eligible voters cast one vote, and approved-party totals are broadcast to connected clients. The graph distinguishes those domain stages and the authentication, persistence, and live-update layers. README excerpts describe centralized data gathering and evaluation goals, but the available tree and sampled source do not establish a separate data-gathering workflow. Several README capabilities are documented but their routes were not sampled, so uncertain links are omitted.

Main entry points: [`client/src/App.jsx`](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/App.jsx) (App navigation), [`server/server.js`](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/server.js) (HTTP and WebSocket server), [`server/Auth.js`](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Auth.js) (Authentication routes), [`server/ws/Votehandler.js`](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/ws/Votehandler.js) (Vote processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App navigation<br/>[App.jsx]"]
  node_home["Home and login entry<br/>[Home.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_partylist["Partylist view<br/>[Partylist.jsx]"]
  node_vote["Vote screen<br/>[Vote.jsx]"]
  node_adminparties["Party approval<br/>[AdminParties.jsx]"]
  node_adminrequests["Account approval"]
end

subgraph group_identity["Identity and access"]
  node_authroutes["Authentication routes<br/>[Auth.js]"]
  node_googleverify["Google token verification<br/>[googleAuth.js]"]
  node_authguard["Token and role guard<br/>[Auth.js]"]
end

subgraph group_election["Election operations"]
  node_server["HTTP and WebSocket server<br/>[server.js]"]
  node_registration["Student registration<br/>[server.js]"]
  node_adminroutes["Admin operations<br/>[Admin.js]"]
  node_voting["Vote processing<br/>[Votehandler.js]"]
end

subgraph group_data["Persistent state and live updates"]
  node_users[("User accounts<br/>[user.js]")]
  node_parties[("Party records and tallies<br/>[Party.js]")]
end

node_student(("Student"))
node_admin(("Election admin"))

node_student -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"renders"| node_home
node_app -->|"opens"| node_login
node_app -->|"opens"| node_register
node_app -->|"renders"| node_vote
node_app -->|"renders"| node_partylist
node_app -->|"renders"| node_adminparties
node_app -->|"renders"| node_adminrequests
node_login -->|"submits credentials"| node_authroutes
node_register -->|"submits registration"| node_registration
node_register -.->|"Google registration"| node_authroutes
node_login -.->|"Google sign-in"| node_googleverify
node_authroutes -->|"verifies token"| node_googleverify
node_authroutes -->|"reads and writes"| node_users
node_registration -->|"creates account"| node_users
node_adminparties -->|"manages requests"| node_adminroutes
node_adminrequests -->|"manages requests"| node_adminroutes
node_adminroutes -->|"reviews accounts"| node_users
node_adminroutes -->|"reviews partylists"| node_parties
node_partylist -->|"loads partylists"| node_server
node_vote -->|"sends vote"| node_server
node_server -->|"dispatches messages"| node_voting
node_server -->|"loads approved parties"| node_parties
node_voting -->|"checks and marks voter"| node_users
node_voting -->|"validates and increments tally"| node_parties
node_server -->|"mounts routes"| node_authroutes
node_authguard -->|"protects routes"| node_server
node_voting -->|"broadcasts updates"| node_server

click node_app "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/App.jsx"
click node_home "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Home.jsx"
click node_login "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Login.jsx"
click node_register "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Register.jsx"
click node_partylist "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Partylist.jsx"
click node_vote "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Vote.jsx"
click node_adminparties "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/AdminParties.jsx"
click node_adminrequests "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/AdminAccountRequest.jsx"
click node_authroutes "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Auth.js"
click node_googleverify "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Utils/googleAuth.js"
click node_authguard "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Routes/Auth.js"
click node_server "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/server.js"
click node_registration "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/server.js"
click node_adminroutes "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Routes/Admin.js"
click node_voting "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/ws/Votehandler.js"
click node_users "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/models/user.js"
click node_parties "https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/models/Party.js"

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_home,node_login,node_register,node_partylist,node_vote,node_adminparties,node_adminrequests toneBlue
class node_authroutes,node_googleverify,node_authguard toneAmber
class node_server,node_registration,node_adminroutes,node_voting toneMint
class node_users,node_parties toneRose
class node_student,node_admin toneIndigo
```

## Components

### Web client

- [App navigation](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Home and login entry](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Home.jsx): `client/src/Pages/Home.jsx`
- [Login](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Login.jsx): `client/src/Pages/Login.jsx`
- [Registration](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Register.jsx): `client/src/Pages/Register.jsx`
- [Partylist view](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Partylist.jsx): `client/src/Pages/Partylist.jsx`
- [Vote screen](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/Vote.jsx): `client/src/Pages/Vote.jsx`
- [Party approval](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/AdminParties.jsx): `client/src/AdminParties.jsx`
- [Account approval](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/client/src/Pages/AdminAccountRequest.jsx): `client/src/Pages/AdminAccountRequest.jsx`

### Identity and access

- [Authentication routes](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Auth.js): `server/Auth.js`
- [Google token verification](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Utils/googleAuth.js): `server/Utils/googleAuth.js`
- [Token and role guard](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Routes/Auth.js): `server/Routes/Auth.js`

### Election operations

- [HTTP and WebSocket server](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/server.js): `server/server.js`
- [Student registration](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/server.js): `server/server.js`
- [Admin operations](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/Routes/Admin.js): `server/Routes/Admin.js`
- [Vote processing](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/ws/Votehandler.js): `server/ws/Votehandler.js`

### Persistent state and live updates

- [User accounts](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/models/user.js): `server/models/user.js`
- [Party records and tallies](https://github.com/chesterbaltazar/ssc_voting_system/blob/main/server/models/Party.js): `server/models/Party.js`

### Other components

- **Student**
- **Election admin**

## Connections

- Student → App navigation: uses
- Election admin → App navigation: uses
- App navigation → Home and login entry: renders
- App navigation → Login: opens
- App navigation → Registration: opens
- App navigation → Vote screen: renders
- App navigation → Partylist view: renders
- App navigation → Party approval: renders
- App navigation → Account approval: renders
- Login → Authentication routes: submits credentials
- Registration → Student registration: submits registration
- Registration → Authentication routes: Google registration
- Login → Google token verification: Google sign-in
- Authentication routes → Google token verification: verifies token
- Authentication routes → User accounts: reads and writes
- Student registration → User accounts: creates account
- Party approval → Admin operations: manages requests
- Account approval → Admin operations: manages requests
- Admin operations → User accounts: reviews accounts
- Admin operations → Party records and tallies: reviews partylists
- Partylist view → HTTP and WebSocket server: loads partylists
- Vote screen → HTTP and WebSocket server: sends vote
- HTTP and WebSocket server → Vote processing: dispatches messages
- HTTP and WebSocket server → Party records and tallies: loads approved parties
- Vote processing → User accounts: checks and marks voter
- Vote processing → Party records and tallies: validates and increments tally
- HTTP and WebSocket server → Authentication routes: mounts routes
- Token and role guard → HTTP and WebSocket server: protects routes
- Vote processing → HTTP and WebSocket server: broadcasts updates
