# yogananda151/sevm_onlinevotingsystem architecture

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

- Interactive diagram: https://gitdiagram.com/yogananda151/sevm_onlinevotingsystem
- Repository: https://github.com/yogananda151/sevm_onlinevotingsystem

## Overview

Smart EVM is an educational online-voting simulation with commissioner, election-officer, and touchscreen voting interfaces. Its main workflow is election and polling-place setup, voter verification, ballot submission, vote-integrity/VVPAT recording, and result reporting. The active backend in the tree is FastAPI/SQLAlchemy; the README describes an older Express/Prisma stack, and the Node backup is therefore excluded. Backend excerpts show application/router wiring and vote-service behavior, but not router internals; some feature links rely on README descriptions.

Main entry points: [`client/src/App.tsx`](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/App.tsx) (Role-based routing), [`client/src/services/api.service.ts`](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/services/api.service.ts) (API client), [`server/app/main.py`](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/main.py) (FastAPI application), [`server/app/services/vote_service.py`](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/vote_service.py) (Vote processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Role-based interfaces"]
  node_client_router["Role-based routing<br/>[App.tsx]"]
  node_login["Sign-in<br/>[LoginPage.tsx]"]
  node_officer_portal["Officer portal"]
  node_machine_control["Machine controls"]
  node_voting_machine["Voting machine"]
  node_vvpat_view["VVPAT display<br/>[VvpatPage.tsx]"]
  node_api_client["API client<br/>[api.service.ts]"]
  node_auth_api_client["Auth client<br/>[auth.service.ts]"]
end

subgraph group_election["Election administration"]
  node_admin_setup["Election setup"]
  node_admin_registry["Voter registry<br/>[VotersPage.tsx]"]
  node_admin_station["Station management"]
  node_admin_candidates["Candidate management<br/>[CandidatesPage.tsx]"]
  node_admin_other["Admin operations"]
end

subgraph group_backend["API and domain services"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_service["Authentication service<br/>[auth_service.py]"]
  node_election_api["Election endpoints<br/>[elections.py]"]
  node_management_api["Management endpoints<br/>[management.py]"]
  node_vote_service["Vote processing<br/>[vote_service.py]"]
  node_bulk_import["Bulk Excel import"]
  node_report_service["Reports<br/>[report_service.py]"]
end

subgraph group_data["Voting records"]
  node_database[("SQL database<br/>[database.py]")]
  node_vote_models["Vote and election records<br/>[vote.py]"]
  node_domain_models["Election domain records<br/>[election.py]"]
end

node_commissioner(("Commissioner"))
node_officer(("Election officer"))
node_voter(("Voter"))

node_commissioner -->|"opens portal"| node_client_router
node_officer -->|"opens portal"| node_client_router
node_voter -->|"uses machine"| node_client_router
node_client_router -->|"routes to"| node_login
node_client_router -->|"routes to"| node_admin_setup
node_client_router -->|"routes to"| node_admin_registry
node_client_router -->|"routes to"| node_admin_station
node_client_router -->|"routes to"| node_admin_candidates
node_client_router -->|"routes to"| node_admin_other
node_client_router -->|"routes to"| node_officer_portal
node_client_router -->|"routes to"| node_machine_control
node_client_router -->|"routes to"| node_voting_machine
node_client_router -->|"routes to"| node_vvpat_view
node_login -.->|"submits credentials"| node_auth_api_client
node_admin_setup -.->|"requests management"| node_api_client
node_admin_registry -.->|"requests voter data"| node_api_client
node_admin_station -.->|"requests management"| node_api_client
node_admin_candidates -.->|"requests management"| node_api_client
node_officer_portal -.->|"requests operations"| node_api_client
node_machine_control -.->|"controls station"| node_api_client
node_voting_machine -.->|"submits ballot"| node_api_client
node_vvpat_view -.->|"requests receipt"| node_api_client
node_auth_api_client -.->|"calls API"| node_api_app
node_api_client -.->|"calls API"| node_api_app
node_api_app -->|"mounts auth routes"| node_auth_service
node_api_app -->|"mounts routes"| node_election_api
node_api_app -->|"mounts routes"| node_management_api
node_api_app -->|"mounts voting routes"| node_vote_service
node_api_app -->|"mounts reports route"| node_report_service
node_vote_service -->|"creates vote and VVPAT"| node_vote_models
node_vote_service -->|"checks election and station"| node_domain_models
node_api_app -->|"creates tables"| node_database
node_bulk_import -->|"imports domain records"| node_domain_models
node_auth_service -.->|"queries user records"| node_database
node_vote_service -.->|"reads and writes"| node_database
node_report_service -.->|"reads report data"| node_database

click node_client_router "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/App.tsx"
click node_login "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/auth/LoginPage.tsx"
click node_admin_setup "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/ElectionSetupPage.tsx"
click node_admin_registry "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/VotersPage.tsx"
click node_admin_station "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/PollingStationsPage.tsx"
click node_admin_candidates "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/CandidatesPage.tsx"
click node_admin_other "https://github.com/yogananda151/sevm_onlinevotingsystem/tree/main/client/src/pages/admin"
click node_officer_portal "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/officer/OfficerDashboard.tsx"
click node_machine_control "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/officer/MachineControlPage.tsx"
click node_voting_machine "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/voting/VotingMachinePage.tsx"
click node_vvpat_view "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/voting/VvpatPage.tsx"
click node_api_client "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/services/api.service.ts"
click node_auth_api_client "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/services/auth.service.ts"
click node_api_app "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/main.py"
click node_auth_service "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/auth_service.py"
click node_election_api "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/routers/elections.py"
click node_management_api "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/routers/management.py"
click node_vote_service "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/vote_service.py"
click node_bulk_import "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/bulk_excel_service.py"
click node_report_service "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/report_service.py"
click node_database "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/database.py"
click node_vote_models "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/models/vote.py"
click node_domain_models "https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/models/election.py"

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_client_router,node_login,node_officer_portal,node_machine_control,node_voting_machine,node_vvpat_view,node_api_client,node_auth_api_client toneBlue
class node_admin_setup,node_admin_registry,node_admin_station,node_admin_candidates,node_admin_other toneAmber
class node_api_app,node_auth_service,node_election_api,node_management_api,node_vote_service,node_bulk_import,node_report_service toneMint
class node_database,node_vote_models,node_domain_models toneRose
class node_commissioner,node_officer,node_voter toneIndigo
```

## Components

### Role-based interfaces

- [Role-based routing](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Sign-in](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/auth/LoginPage.tsx): `client/src/pages/auth/LoginPage.tsx`
- [Officer portal](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/officer/OfficerDashboard.tsx): `client/src/pages/officer/OfficerDashboard.tsx`
- [Machine controls](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/officer/MachineControlPage.tsx): `client/src/pages/officer/MachineControlPage.tsx`
- [Voting machine](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/voting/VotingMachinePage.tsx): `client/src/pages/voting/VotingMachinePage.tsx`
- [VVPAT display](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/voting/VvpatPage.tsx): `client/src/pages/voting/VvpatPage.tsx`
- [API client](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/services/api.service.ts): `client/src/services/api.service.ts`
- [Auth client](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/services/auth.service.ts): `client/src/services/auth.service.ts`

### Election administration

- [Election setup](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/ElectionSetupPage.tsx): `client/src/pages/admin/ElectionSetupPage.tsx`
- [Voter registry](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/VotersPage.tsx): `client/src/pages/admin/VotersPage.tsx`
- [Station management](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/PollingStationsPage.tsx): `client/src/pages/admin/PollingStationsPage.tsx`
- [Candidate management](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/client/src/pages/admin/CandidatesPage.tsx): `client/src/pages/admin/CandidatesPage.tsx`
- [Admin operations](https://github.com/yogananda151/sevm_onlinevotingsystem/tree/main/client/src/pages/admin): `client/src/pages/admin`

### API and domain services

- [FastAPI application](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/main.py): `server/app/main.py`
- [Authentication service](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/auth_service.py): `server/app/services/auth_service.py`
- [Election endpoints](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/routers/elections.py): `server/app/routers/elections.py`
- [Management endpoints](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/routers/management.py): `server/app/routers/management.py`
- [Vote processing](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/vote_service.py): `server/app/services/vote_service.py`
- [Bulk Excel import](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/bulk_excel_service.py): `server/app/services/bulk_excel_service.py`
- [Reports](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/services/report_service.py): `server/app/services/report_service.py`

### Voting records

- [SQL database](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/database.py): `server/app/database.py`
- [Vote and election records](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/models/vote.py): `server/app/models/vote.py`
- [Election domain records](https://github.com/yogananda151/sevm_onlinevotingsystem/blob/main/server/app/models/election.py): `server/app/models/election.py`

### Other components

- **Commissioner**
- **Election officer**
- **Voter**

## Connections

- Commissioner → Role-based routing: opens portal (evidence: `client/src/App.tsx`)
- Election officer → Role-based routing: opens portal (evidence: `README.md`)
- Voter → Role-based routing: uses machine (evidence: `client/src/App.tsx`)
- Role-based routing → Sign-in: routes to (evidence: `client/src/App.tsx`)
- Role-based routing → Election setup: routes to (evidence: `client/src/App.tsx`)
- Role-based routing → Voter registry: routes to (evidence: `client/src/App.tsx`)
- Role-based routing → Station management: routes to (evidence: `client/src/App.tsx`)
- Role-based routing → Candidate management: routes to (evidence: `client/src/App.tsx`)
- Role-based routing → Admin operations: routes to (evidence: `client/src/App.tsx`)
- Role-based routing → Officer portal: routes to (evidence: `README.md`)
- Role-based routing → Machine controls: routes to (evidence: `README.md`)
- Role-based routing → Voting machine: routes to (evidence: `client/src/App.tsx`)
- Role-based routing → VVPAT display: routes to (evidence: `client/src/App.tsx`)
- Sign-in → Auth client: submits credentials
- Election setup → API client: requests management
- Voter registry → API client: requests voter data
- Station management → API client: requests management
- Candidate management → API client: requests management
- Officer portal → API client: requests operations
- Machine controls → API client: controls station
- Voting machine → API client: submits ballot
- VVPAT display → API client: requests receipt
- Auth client → FastAPI application: calls API
- API client → FastAPI application: calls API
- FastAPI application → Authentication service: mounts auth routes (evidence: `server/app/main.py`)
- FastAPI application → Election endpoints: mounts routes (evidence: `server/app/main.py`)
- FastAPI application → Management endpoints: mounts routes (evidence: `server/app/main.py`)
- FastAPI application → Vote processing: mounts voting routes (evidence: `server/app/main.py`)
- FastAPI application → Reports: mounts reports route (evidence: `server/app/main.py`)
- Vote processing → Vote and election records: creates vote and VVPAT (evidence: `server/app/services/vote_service.py`)
- Vote processing → Election domain records: checks election and station (evidence: `server/app/services/vote_service.py`)
- FastAPI application → SQL database: creates tables (evidence: `server/app/main.py`)
- Bulk Excel import → Election domain records: imports domain records (evidence: `server/app/services/bulk_excel_service.py`)
- Authentication service → SQL database: queries user records
- Vote processing → SQL database: reads and writes
- Reports → SQL database: reads report data
