# ajay7616/securevote architecture

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

## Overview

SecureVote is a web-based election administration and voter-facing voting platform. Administrators configure elections, wards, candidates, and voter rolls; voters authenticate, cast a ward- and election-checked vote, and can access voting and results features. The backend persists election data in PostgreSQL/PostGIS and the vote controller also checks a blockchain contract. The README documents immutable on-chain voting and email/RSA security. Several routes and frontend service-to-page connections are unsampled, so uncertain links are omitted.

Main entry points: [`backend/routes`](https://github.com/ajay7616/securevote/tree/main/backend/routes) (Domain routes), [`backend/config/database.js`](https://github.com/ajay7616/securevote/blob/main/backend/config/database.js) (Database pool), [`frontend/src/App.jsx`](https://github.com/ajay7616/securevote/blob/main/frontend/src/App.jsx) (Routed app), [`backend/controllers/wardController.js`](https://github.com/ajay7616/securevote/blob/main/backend/controllers/wardController.js) (Ward and voter intake)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Routed app<br/>[App.jsx]"]
  node_admin_pages["Admin consoles"]
  node_master_pages["Master admin"]
  node_voter_pages["Voter screens"]
  node_auth_service["Auth client<br/>[authService.js]"]
  node_candidate_service["Candidate client"]
  node_domain_clients["Domain clients"]
  node_api["API transport<br/>[api.js]"]
end

subgraph group_backend["API and domain"]
  node_server["HTTP server<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_domain_routes["Domain routes"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_election_controller["Election management"]
  node_ward_controller["Ward and voter intake<br/>[wardController.js]"]
  node_candidate_controller["Candidate management"]
  node_voter_controller["Voter management<br/>[voterController.js]"]
  node_vote_controller["Voting and results<br/>[voteController.js]"]
  node_issue_controller["Issues and feedback<br/>[issueController.js]"]
  node_email["Email delivery<br/>[emailService.js]"]
end

subgraph group_persistence["Election records"]
  node_db_config["Database pool<br/>[database.js]"]
  node_database[("PostgreSQL/PostGIS")]
end

subgraph group_integrations["External services"]
  node_blockchain[("Ethereum contract")]
  node_smtp["SMTP email"]
  node_geocoder["Nominatim"]
end

node_admins(("Administrators"))
node_voters(("Voters"))

node_admins -->|"use console"| node_app
node_voters -->|"use portal"| node_app
node_app -->|"routes to"| node_admin_pages
node_app -->|"routes to"| node_master_pages
node_app -->|"routes to"| node_voter_pages
node_auth_service -->|"sends requests"| node_api
node_candidate_service -->|"sends requests"| node_api
node_domain_clients -->|"sends requests"| node_api
node_api -->|"calls API"| node_server
node_server -->|"dispatches auth"| node_auth_routes
node_server -->|"dispatches domains"| node_domain_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_domain_routes -->|"dispatches"| node_election_controller
node_domain_routes -->|"dispatches"| node_ward_controller
node_domain_routes -->|"dispatches"| node_candidate_controller
node_domain_routes -->|"dispatches"| node_voter_controller
node_domain_routes -->|"dispatches"| node_vote_controller
node_domain_routes -->|"dispatches"| node_issue_controller
node_auth_controller -->|"queries"| node_db_config
node_election_controller -->|"queries"| node_db_config
node_ward_controller -->|"queries"| node_db_config
node_candidate_controller -->|"queries"| node_db_config
node_voter_controller -->|"queries"| node_db_config
node_vote_controller -->|"queries"| node_db_config
node_issue_controller -->|"queries"| node_db_config
node_db_config -->|"connects"| node_database
node_vote_controller -->|"checks vote"| node_blockchain
node_auth_controller -->|"sends OTP"| node_email
node_ward_controller -->|"sends login mail"| node_email
node_email -.->|"delivers mail"| node_smtp
node_ward_controller -.->|"geocodes addresses"| node_geocoder

click node_app "https://github.com/ajay7616/securevote/blob/main/frontend/src/App.jsx"
click node_admin_pages "https://github.com/ajay7616/securevote/tree/main/frontend/src/pages/Admin"
click node_master_pages "https://github.com/ajay7616/securevote/tree/main/frontend/src/pages/MasterAdmin"
click node_voter_pages "https://github.com/ajay7616/securevote/tree/main/frontend/src/pages/Voter"
click node_auth_service "https://github.com/ajay7616/securevote/blob/main/frontend/src/services/authService.js"
click node_candidate_service "https://github.com/ajay7616/securevote/blob/main/frontend/src/services/candidateService.js"
click node_domain_clients "https://github.com/ajay7616/securevote/tree/main/frontend/src/services"
click node_api "https://github.com/ajay7616/securevote/blob/main/frontend/src/config/api.js"
click node_server "https://github.com/ajay7616/securevote/blob/main/backend/server.js"
click node_auth_routes "https://github.com/ajay7616/securevote/blob/main/backend/routes/auth.js"
click node_domain_routes "https://github.com/ajay7616/securevote/tree/main/backend/routes"
click node_auth_controller "https://github.com/ajay7616/securevote/blob/main/backend/controllers/authController.js"
click node_election_controller "https://github.com/ajay7616/securevote/blob/main/backend/controllers/electionController.js"
click node_ward_controller "https://github.com/ajay7616/securevote/blob/main/backend/controllers/wardController.js"
click node_candidate_controller "https://github.com/ajay7616/securevote/blob/main/backend/controllers/candidateController.js"
click node_voter_controller "https://github.com/ajay7616/securevote/blob/main/backend/controllers/voterController.js"
click node_vote_controller "https://github.com/ajay7616/securevote/blob/main/backend/controllers/voteController.js"
click node_issue_controller "https://github.com/ajay7616/securevote/blob/main/backend/controllers/issueController.js"
click node_email "https://github.com/ajay7616/securevote/blob/main/backend/utils/emailService.js"
click node_db_config "https://github.com/ajay7616/securevote/blob/main/backend/config/database.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_admin_pages,node_master_pages,node_voter_pages,node_auth_service,node_candidate_service,node_domain_clients,node_api toneBlue
class node_server,node_auth_routes,node_domain_routes,node_auth_controller,node_election_controller,node_ward_controller,node_candidate_controller,node_voter_controller,node_vote_controller,node_issue_controller,node_email toneAmber
class node_db_config,node_database toneMint
class node_blockchain,node_smtp,node_geocoder toneRose
class node_admins,node_voters toneIndigo
```

## Components

### Web application

- [Routed app](https://github.com/ajay7616/securevote/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Admin consoles](https://github.com/ajay7616/securevote/tree/main/frontend/src/pages/Admin): `frontend/src/pages/Admin`
- [Master admin](https://github.com/ajay7616/securevote/tree/main/frontend/src/pages/MasterAdmin): `frontend/src/pages/MasterAdmin`
- [Voter screens](https://github.com/ajay7616/securevote/tree/main/frontend/src/pages/Voter): `frontend/src/pages/Voter`
- [Auth client](https://github.com/ajay7616/securevote/blob/main/frontend/src/services/authService.js): `frontend/src/services/authService.js`
- [Candidate client](https://github.com/ajay7616/securevote/blob/main/frontend/src/services/candidateService.js): `frontend/src/services/candidateService.js`
- [Domain clients](https://github.com/ajay7616/securevote/tree/main/frontend/src/services): `frontend/src/services`
- [API transport](https://github.com/ajay7616/securevote/blob/main/frontend/src/config/api.js): `frontend/src/config/api.js`

### API and domain

- [HTTP server](https://github.com/ajay7616/securevote/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/ajay7616/securevote/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Domain routes](https://github.com/ajay7616/securevote/tree/main/backend/routes): `backend/routes`
- [Authentication](https://github.com/ajay7616/securevote/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Election management](https://github.com/ajay7616/securevote/blob/main/backend/controllers/electionController.js): `backend/controllers/electionController.js`
- [Ward and voter intake](https://github.com/ajay7616/securevote/blob/main/backend/controllers/wardController.js): `backend/controllers/wardController.js`
- [Candidate management](https://github.com/ajay7616/securevote/blob/main/backend/controllers/candidateController.js): `backend/controllers/candidateController.js`
- [Voter management](https://github.com/ajay7616/securevote/blob/main/backend/controllers/voterController.js): `backend/controllers/voterController.js`
- [Voting and results](https://github.com/ajay7616/securevote/blob/main/backend/controllers/voteController.js): `backend/controllers/voteController.js`
- [Issues and feedback](https://github.com/ajay7616/securevote/blob/main/backend/controllers/issueController.js): `backend/controllers/issueController.js`
- [Email delivery](https://github.com/ajay7616/securevote/blob/main/backend/utils/emailService.js): `backend/utils/emailService.js`

### Election records

- [Database pool](https://github.com/ajay7616/securevote/blob/main/backend/config/database.js): `backend/config/database.js`
- **PostgreSQL/PostGIS**

### External services

- **Ethereum contract**
- **SMTP email**
- **Nominatim**

### Other components

- **Administrators**
- **Voters**

## Connections

- Administrators → Routed app: use console
- Voters → Routed app: use portal
- Routed app → Admin consoles: routes to
- Routed app → Master admin: routes to
- Routed app → Voter screens: routes to
- Auth client → API transport: sends requests
- Candidate client → API transport: sends requests
- Domain clients → API transport: sends requests
- API transport → HTTP server: calls API
- HTTP server → Auth routes: dispatches auth
- HTTP server → Domain routes: dispatches domains
- Auth routes → Authentication: dispatches
- Domain routes → Election management: dispatches
- Domain routes → Ward and voter intake: dispatches
- Domain routes → Candidate management: dispatches
- Domain routes → Voter management: dispatches
- Domain routes → Voting and results: dispatches
- Domain routes → Issues and feedback: dispatches
- Authentication → Database pool: queries
- Election management → Database pool: queries
- Ward and voter intake → Database pool: queries
- Candidate management → Database pool: queries
- Voter management → Database pool: queries
- Voting and results → Database pool: queries
- Issues and feedback → Database pool: queries
- Database pool → PostgreSQL/PostGIS: connects
- Voting and results → Ethereum contract: checks vote
- Authentication → Email delivery: sends OTP
- Ward and voter intake → Email delivery: sends login mail
- Email delivery → SMTP email: delivers mail
- Ward and voter intake → Nominatim: geocodes addresses
