# vaibhav0643/project_k8s-voting-app architecture

> Architecture diagram of the GitHub repository vaibhav0643/project_k8s-voting-app, 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/vaibhav0643/project_k8s-voting-app
- Repository: https://github.com/vaibhav0643/project_k8s-voting-app

## Overview

This repository combines a two-option voting application with a Kind/Kubernetes deployment guide. A voter submits through the Flask app; votes pass through Redis to a .NET worker, which stores them in Postgres. The Node.js result service reads the stored votes and streams scores to the results UI. The README also documents Argo CD GitOps deployment, cluster access, and Prometheus/Grafana monitoring. Runtime links are grounded in sampled source; deployment and operational links reflect README claims. The tree has no Postgres manifest or monitoring configuration, so those implementation details are not mapped.

Main entry points: [`worker/Program.cs`](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/worker/Program.cs) (Vote Worker), [`result/server.js`](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/result/server.js) (Result Service), [`vote/templates/index.html`](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/vote/templates/index.html) (Vote UI), [`vote/app.py`](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/vote/app.py) (Vote App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_voting["Voting Interface"]
  node_vote_ui["Vote UI<br/>[index.html]"]
  node_vote_app["Vote App<br/>[app.py]"]
end

subgraph group_processing["Vote Processing"]
  node_redis["Redis Queue"]
  node_worker["Vote Worker<br/>[Program.cs]"]
  node_postgres[("Postgres")]
end

subgraph group_results["Live Results"]
  node_result_server["Result Service<br/>[server.js]"]
  node_result_ui["Results UI<br/>[app.js]"]
end

subgraph group_deployment["Cluster Deployment"]
  node_argocd["Argo CD"]
  node_manifests["Kubernetes Manifests"]
  node_kind_config["Kind Config<br/>[config.yml]"]
  node_cluster["Kubernetes Cluster"]
end

subgraph group_operations["Cluster Operations"]
  node_dashboard["Kubernetes Dashboard"]
  node_monitoring["Prometheus and Grafana"]
end

node_voter(("Voter"))
node_git_repo["Git Repository"]

node_voter -->|"uses"| node_vote_ui
node_vote_ui -->|"submits vote"| node_vote_app
node_vote_app -->|"enqueues vote"| node_redis
node_worker -->|"dequeues vote"| node_redis
node_worker -->|"writes vote"| node_postgres
node_result_server -->|"queries counts"| node_postgres
node_result_server -->|"streams scores"| node_result_ui
node_voter -->|"views results"| node_result_ui
node_git_repo -.->|"provides revision"| node_argocd
node_argocd -->|"syncs manifests"| node_manifests
node_manifests -->|"declares workloads"| node_cluster
node_kind_config -->|"configures cluster"| node_cluster
node_dashboard -->|"configures access"| node_cluster
node_monitoring -.->|"monitors"| node_cluster

click node_vote_ui "https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/vote/templates/index.html"
click node_vote_app "https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/vote/app.py"
click node_worker "https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/worker/Program.cs"
click node_result_server "https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/result/server.js"
click node_result_ui "https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/result/views/app.js"
click node_manifests "https://github.com/vaibhav0643/project_k8s-voting-app/tree/main/k8s-specifications"
click node_kind_config "https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/kind-cluster/config.yml"
click node_dashboard "https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/kind-cluster/dashboard-adminuser.yml"

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_ui,node_vote_app toneBlue
class node_redis,node_worker,node_postgres toneAmber
class node_result_server,node_result_ui toneMint
class node_argocd,node_manifests,node_kind_config,node_cluster toneRose
class node_dashboard,node_monitoring,node_voter,node_git_repo toneIndigo
```

## Components

### Voting Interface

- [Vote UI](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/vote/templates/index.html): `vote/templates/index.html`
- [Vote App](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/vote/app.py): `vote/app.py`

### Vote Processing

- **Redis Queue**
- [Vote Worker](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/worker/Program.cs): `worker/Program.cs`
- **Postgres**

### Live Results

- [Result Service](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/result/server.js): `result/server.js`
- [Results UI](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/result/views/app.js): `result/views/app.js`

### Cluster Deployment

- **Argo CD**
- [Kubernetes Manifests](https://github.com/vaibhav0643/project_k8s-voting-app/tree/main/k8s-specifications): `k8s-specifications`
- [Kind Config](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/kind-cluster/config.yml): `kind-cluster/config.yml`
- **Kubernetes Cluster**

### Cluster Operations

- [Kubernetes Dashboard](https://github.com/vaibhav0643/project_k8s-voting-app/blob/main/kind-cluster/dashboard-adminuser.yml): `kind-cluster/dashboard-adminuser.yml`
- **Prometheus and Grafana**

### Other components

- **Voter**
- **Git Repository**

## Connections

- Voter → Vote UI: uses
- Vote UI → Vote App: submits vote
- Vote App → Redis Queue: enqueues vote
- Vote Worker → Redis Queue: dequeues vote
- Vote Worker → Postgres: writes vote
- Result Service → Postgres: queries counts
- Result Service → Results UI: streams scores
- Voter → Results UI: views results
- Git Repository → Argo CD: provides revision
- Argo CD → Kubernetes Manifests: syncs manifests
- Kubernetes Manifests → Kubernetes Cluster: declares workloads
- Kind Config → Kubernetes Cluster: configures cluster
- Kubernetes Dashboard → Kubernetes Cluster: configures access
- Prometheus and Grafana → Kubernetes Cluster: monitors
