# spandan2106/metropolis-evoting-2026 architecture

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

- Interactive diagram: https://gitdiagram.com/spandan2106/metropolis-evoting-2026
- Repository: https://github.com/spandan2106/metropolis-evoting-2026

## Overview

Metropolis EVoting is a React/Express voting platform with identity and role controls, vote recording, an audit ledger, and administrator-controlled publication. The main workflow is citizen registration or login, ballot submission, and later results viewing; administrators manage election state and publication. The sampled implementation places most UI behavior in `src/App.tsx` and server behavior in `server.ts`, with MongoDB schemas in `mongoose_models.ts`. Several product capabilities are documented but their implementation details were not sampled, so those links are shown only where documented or left unverified.

Main entry points: [`server.ts`](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts) (Express API and SSE), [`mongoose_models.ts`](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/mongoose_models.ts) (Election data models), [`src/App.tsx`](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/App.tsx) (Voting and results UI), [`src/main.tsx`](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/main.tsx) (React entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Voting interface"]
  node_app["Voting and results UI<br/>[App.tsx]"]
  node_entry["React entry point<br/>[main.tsx]"]
end

subgraph group_protocol["Election protocol"]
  node_identity["Identity and access<br/>[server.ts]"]
  node_registration["Registration<br/>[server.ts]"]
  node_ballot["Vote submission<br/>[server.ts]"]
  node_ledger["Hash-linked vote ledger<br/>[server.ts]"]
  node_results["Results and turnout<br/>[server.ts]"]
  node_api["Express API and SSE<br/>[server.ts]"]
end

subgraph group_records["Persistent records"]
  node_mongo[("MongoDB")]
  node_schemas["Election data models<br/>[mongoose_models.ts]"]
end

subgraph group_oversight["Administration and oversight"]
  node_audit["Audit log<br/>[server.ts]"]
  node_alerts["Notifications<br/>[server.ts]"]
  node_admin["Authority controls<br/>[App.tsx]"]
end

node_citizens(("Citizens and candidates"))

node_entry -->|"renders"| node_app
node_citizens -->|"use"| node_app
node_app -.->|"requests"| node_api
node_admin -->|"shares interface"| node_app
node_api -->|"routes login"| node_identity
node_api -->|"routes registration"| node_registration
node_api -->|"routes vote"| node_ballot
node_api -->|"routes stats"| node_results
node_ballot -->|"adds vote"| node_ledger
node_identity -->|"reads users"| node_schemas
node_registration -->|"checks users"| node_schemas
node_ballot -->|"updates voter"| node_schemas
node_results -->|"aggregates blocks"| node_schemas
node_api -->|"uses models"| node_schemas
node_schemas -->|"persists records"| node_mongo
node_api -->|"records actions"| node_audit
node_api -->|"serves alerts"| node_alerts
node_admin -.->|"controls election"| node_api
node_api -->|"publishes updates"| node_results
node_api -.->|"broadcasts updates"| node_alerts
node_citizens -.->|"casts ballots"| node_ledger
node_results -.->|"releases outcome"| node_citizens

click node_app "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/App.tsx"
click node_entry "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/main.tsx"
click node_identity "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_registration "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_ballot "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_ledger "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_results "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_api "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_schemas "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/mongoose_models.ts"
click node_audit "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_alerts "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts"
click node_admin "https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/App.tsx"

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_entry toneBlue
class node_identity,node_registration,node_ballot,node_ledger,node_results,node_api toneAmber
class node_mongo,node_schemas toneMint
class node_audit,node_alerts,node_admin toneRose
class node_citizens toneIndigo
```

## Components

### Voting interface

- [Voting and results UI](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/App.tsx): `src/App.tsx`
- [React entry point](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/main.tsx): `src/main.tsx`

### Election protocol

- [Identity and access](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`
- [Registration](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`
- [Vote submission](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`
- [Hash-linked vote ledger](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`
- [Results and turnout](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`
- [Express API and SSE](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`

### Persistent records

- **MongoDB**
- [Election data models](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/mongoose_models.ts): `mongoose_models.ts`

### Administration and oversight

- [Audit log](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`
- [Notifications](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/server.ts): `server.ts`
- [Authority controls](https://github.com/spandan2106/metropolis-evoting-2026/blob/main/src/App.tsx): `src/App.tsx`

### Other components

- **Citizens and candidates**

## Connections

- React entry point → Voting and results UI: renders (evidence: `src/main.tsx`)
- Citizens and candidates → Voting and results UI: use (evidence: `README.md`)
- Voting and results UI → Express API and SSE: requests
- Authority controls → Voting and results UI: shares interface (evidence: `src/App.tsx`)
- Express API and SSE → Identity and access: routes login (evidence: `server.ts`)
- Express API and SSE → Registration: routes registration (evidence: `server.ts`)
- Express API and SSE → Vote submission: routes vote (evidence: `server.ts`)
- Express API and SSE → Results and turnout: routes stats (evidence: `server.ts`)
- Vote submission → Hash-linked vote ledger: adds vote (evidence: `server.ts`)
- Identity and access → Election data models: reads users (evidence: `server.ts`)
- Registration → Election data models: checks users (evidence: `server.ts`)
- Vote submission → Election data models: updates voter (evidence: `server.ts`)
- Results and turnout → Election data models: aggregates blocks (evidence: `server.ts`)
- Express API and SSE → Election data models: uses models (evidence: `server.ts`)
- Election data models → MongoDB: persists records (evidence: `mongoose_models.ts`)
- Express API and SSE → Audit log: records actions (evidence: `server.ts`)
- Express API and SSE → Notifications: serves alerts (evidence: `server.ts`)
- Authority controls → Express API and SSE: controls election
- Express API and SSE → Results and turnout: publishes updates (evidence: `server.ts`)
- Express API and SSE → Notifications: broadcasts updates (evidence: `README.md`)
- Citizens and candidates → Hash-linked vote ledger: casts ballots (evidence: `README.md`)
- Results and turnout → Citizens and candidates: releases outcome (evidence: `README.md`)
