# shuvro86/example-voting-app architecture

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

- Interactive diagram: https://gitdiagram.com/shuvro86/example-voting-app
- Repository: https://github.com/shuvro86/example-voting-app

## Overview

Example Voting App accepts a browser vote, queues it in Redis, and has a .NET worker persist it to Postgres; the results service periodically queries the database and broadcasts live scores to a browser dashboard. The README documents the major services and deployment options; the sampled source shows the runtime handoffs. Deployment manifests and seed-data tooling are not runtime product components.

Main entry points: [`result/views/app.js`](https://github.com/shuvro86/example-voting-app/blob/main/result/views/app.js) (Score Dashboard), [`worker/Program.cs`](https://github.com/shuvro86/example-voting-app/blob/main/worker/Program.cs) (Vote Worker), [`result/server.js`](https://github.com/shuvro86/example-voting-app/blob/main/result/server.js) (Results Service), [`vote/templates/index.html`](https://github.com/shuvro86/example-voting-app/blob/main/vote/templates/index.html) (Vote Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_voting["Voting"]
  node_vote_page["Vote Page<br/>[index.html]"]
  node_vote_app["Vote Handler<br/>[app.py]"]
end

subgraph group_processing["Vote Processing"]
  node_worker["Vote Worker<br/>[Program.cs]"]
end

subgraph group_results["Live Results"]
  node_result_service["Results Service<br/>[server.js]"]
  node_result_page["Results Page<br/>[index.html]"]
  node_dashboard["Score Dashboard<br/>[app.js]"]
  node_socket_client["Socket.IO Client<br/>[socket.io.js]"]
end

subgraph group_state["Data Services"]
  node_redis["Redis Queue"]
  node_postgres[("Postgres Votes")]
end

node_voter(("Voter"))
node_results_viewer(("Results Viewer"))

node_voter -->|"opens"| node_vote_page
node_vote_page -->|"submits vote"| node_vote_app
node_vote_app -->|"queues vote"| node_redis
node_worker -->|"pops votes"| node_redis
node_worker -->|"writes votes"| node_postgres
node_result_service -->|"queries counts"| node_postgres
node_result_service -->|"broadcasts scores"| node_dashboard
node_result_page -->|"loads script"| node_dashboard
node_dashboard -->|"connects through"| node_socket_client
node_results_viewer -->|"opens"| node_result_page

click node_vote_page "https://github.com/shuvro86/example-voting-app/blob/main/vote/templates/index.html"
click node_vote_app "https://github.com/shuvro86/example-voting-app/blob/main/vote/app.py"
click node_worker "https://github.com/shuvro86/example-voting-app/blob/main/worker/Program.cs"
click node_result_service "https://github.com/shuvro86/example-voting-app/blob/main/result/server.js"
click node_result_page "https://github.com/shuvro86/example-voting-app/blob/main/result/views/index.html"
click node_dashboard "https://github.com/shuvro86/example-voting-app/blob/main/result/views/app.js"
click node_socket_client "https://github.com/shuvro86/example-voting-app/blob/main/result/views/socket.io.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_vote_page,node_vote_app,node_results_viewer toneBlue
class node_worker toneAmber
class node_result_service,node_result_page,node_dashboard,node_socket_client toneMint
class node_redis,node_postgres toneRose
class node_voter toneIndigo
```

## Components

### Voting

- [Vote Page](https://github.com/shuvro86/example-voting-app/blob/main/vote/templates/index.html): `vote/templates/index.html`
- [Vote Handler](https://github.com/shuvro86/example-voting-app/blob/main/vote/app.py): `vote/app.py`

### Vote Processing

- [Vote Worker](https://github.com/shuvro86/example-voting-app/blob/main/worker/Program.cs): `worker/Program.cs`

### Live Results

- [Results Service](https://github.com/shuvro86/example-voting-app/blob/main/result/server.js): `result/server.js`
- [Results Page](https://github.com/shuvro86/example-voting-app/blob/main/result/views/index.html): `result/views/index.html`
- [Score Dashboard](https://github.com/shuvro86/example-voting-app/blob/main/result/views/app.js): `result/views/app.js`
- [Socket.IO Client](https://github.com/shuvro86/example-voting-app/blob/main/result/views/socket.io.js): `result/views/socket.io.js`

### Data Services

- **Redis Queue**
- **Postgres Votes**

### Other components

- **Voter**
- **Results Viewer**

## Connections

- Voter → Vote Page: opens (evidence: `README.md`)
- Vote Page → Vote Handler: submits vote (evidence: `vote/app.py`)
- Vote Handler → Redis Queue: queues vote (evidence: `vote/app.py`)
- Vote Worker → Redis Queue: pops votes (evidence: `worker/Program.cs`)
- Vote Worker → Postgres Votes: writes votes (evidence: `worker/Program.cs`)
- Results Service → Postgres Votes: queries counts (evidence: `result/server.js`)
- Results Service → Score Dashboard: broadcasts scores (evidence: `result/server.js`)
- Results Page → Score Dashboard: loads script
- Score Dashboard → Socket.IO Client: connects through (evidence: `result/views/app.js`)
- Results Viewer → Results Page: opens (evidence: `README.md`)
