# yash17013366/ipfs-based-decentralized-voting-system architecture

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

- Interactive diagram: https://gitdiagram.com/yash17013366/ipfs-based-decentralized-voting-system
- Repository: https://github.com/yash17013366/ipfs-based-decentralized-voting-system

## Overview

This browser-based voting application takes an election from candidate setup and voter registration through ID-validated vote casting, live results, and winner declaration; it also offers JSON export and printable voter cards. The main script coordinates election state and the IPFS service, which stores vote records and election data, with a localStorage hash pointer and gateway fallback. The graph combines sampled script and service behavior with README-documented capabilities; unsampled UI wiring and feature implementations are not inferred.

Main entry points: [`index.html`](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/index.html) (Voting UI), [`ipfs-service.js`](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/ipfs-service.js) (IPFS Service), [`script.js`](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js) (Vote Casting), [`styles.css`](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/styles.css) (Interface Styling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_election["Election Setup"]
  node_candidate_setup["Candidate Management<br/>[script.js]"]
  node_voter_registry["Voter Registration<br/>[script.js]"]
  node_voter_cards["Printable Voter Cards<br/>[script.js]"]
end

subgraph group_voting["Voting and Results"]
  node_vote_validation["Voter Validation<br/>[script.js]"]
  node_vote_casting["Vote Casting<br/>[script.js]"]
  node_election_control["Election Timing<br/>[script.js]"]
  node_results["Live Results<br/>[script.js]"]
  node_winner["Winner Declaration<br/>[script.js]"]
  node_export["JSON Export<br/>[script.js]"]
  node_state["Election State<br/>[script.js]"]
end

subgraph group_storage["Persistence"]
  node_ipfs_service["IPFS Service<br/>[ipfs-service.js]"]
  node_local_storage[("Hash Persistence<br/>[ipfs-service.js]")]
end

subgraph group_interface["Application Interface"]
  node_app["Voting UI<br/>[index.html]"]
  node_styling["Interface Styling<br/>[styles.css]"]
end

node_admin(("Election Admin"))
node_voter(("Voter"))
node_ipfs[("IPFS Network")]

node_admin -->|"manages election"| node_app
node_voter -->|"casts vote"| node_app
node_app -->|"administers candidates"| node_candidate_setup
node_app -->|"registers voters"| node_voter_registry
node_voter_registry -->|"prints cards"| node_voter_cards
node_app -->|"validates voter ID"| node_vote_validation
node_app -->|"submits vote"| node_vote_casting
node_vote_casting -->|"updates vote state"| node_state
node_app -->|"ends on deadline"| node_election_control
node_app -->|"updates live results"| node_results
node_results -->|"declares winner"| node_winner
node_app -->|"exports data"| node_export
node_app -->|"loads and saves state"| node_ipfs_service
node_vote_casting -->|"saves vote record"| node_ipfs_service
node_ipfs_service -->|"stores hash"| node_local_storage
node_ipfs_service -->|"uploads and retrieves"| node_ipfs
node_app -.->|"uses layout styles"| node_styling

click node_app "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/index.html"
click node_styling "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/styles.css"
click node_candidate_setup "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_voter_registry "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_voter_cards "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_vote_validation "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_vote_casting "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_election_control "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_results "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_winner "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_export "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_state "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js"
click node_ipfs_service "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/ipfs-service.js"
click node_local_storage "https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/ipfs-service.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_candidate_setup,node_voter_registry,node_voter_cards toneBlue
class node_vote_validation,node_vote_casting,node_election_control,node_results,node_winner,node_export,node_state,node_ipfs toneAmber
class node_ipfs_service,node_local_storage toneMint
class node_app,node_styling toneRose
class node_admin,node_voter toneIndigo
```

## Components

### Election Setup

- [Candidate Management](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [Voter Registration](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [Printable Voter Cards](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`

### Voting and Results

- [Voter Validation](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [Vote Casting](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [Election Timing](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [Live Results](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [Winner Declaration](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [JSON Export](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`
- [Election State](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/script.js): `script.js`

### Persistence

- [IPFS Service](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/ipfs-service.js): `ipfs-service.js`
- [Hash Persistence](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/ipfs-service.js): `ipfs-service.js`

### Application Interface

- [Voting UI](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/index.html): `index.html`
- [Interface Styling](https://github.com/yash17013366/ipfs-based-decentralized-voting-system/blob/master/styles.css): `styles.css`

### Other components

- **Election Admin**
- **Voter**
- **IPFS Network**

## Connections

- Election Admin → Voting UI: manages election (evidence: `README.md`)
- Voter → Voting UI: casts vote (evidence: `README.md`)
- Voting UI → Candidate Management: administers candidates (evidence: `README.md`)
- Voting UI → Voter Registration: registers voters (evidence: `README.md`)
- Voter Registration → Printable Voter Cards: prints cards (evidence: `README.md`)
- Voting UI → Voter Validation: validates voter ID (evidence: `README.md`)
- Voting UI → Vote Casting: submits vote (evidence: `script.js`)
- Vote Casting → Election State: updates vote state (evidence: `script.js`)
- Voting UI → Election Timing: ends on deadline (evidence: `script.js`)
- Voting UI → Live Results: updates live results (evidence: `README.md`)
- Live Results → Winner Declaration: declares winner (evidence: `README.md`)
- Voting UI → JSON Export: exports data (evidence: `README.md`)
- Voting UI → IPFS Service: loads and saves state
- Vote Casting → IPFS Service: saves vote record (evidence: `script.js`)
- IPFS Service → Hash Persistence: stores hash (evidence: `ipfs-service.js`)
- IPFS Service → IPFS Network: uploads and retrieves (evidence: `ipfs-service.js`)
- Voting UI → Interface Styling: uses layout styles
