# jayadeeep/e-voting-system architecture

> Architecture diagram of the GitHub repository jayadeeep/e-voting-system, 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/jayadeeep/e-voting-system
- Repository: https://github.com/jayadeeep/e-voting-system

## Overview

This is a web-based voting application: citizens register with Aadhaar-linked details, authenticate, cast a vote, and see a receipt or election results. The PHP entry point is the documented database-backed path for registration and voting; the sampled vote handler checks whether a voter has already voted before updating vote records. The JavaScript also contains a separate simulated OTP, admin, and results flow using browser storage. Its referenced OTP PHP endpoints are absent from the supplied tree, so their implementation and connection to the PHP flow cannot be verified.

Main entry points: [`index.php`](https://github.com/jayadeeep/e-voting-system/blob/main/index.php) (PHP application), [`script.js`](https://github.com/jayadeeep/e-voting-system/blob/main/script.js) (Simulated OTP flow), [`db.php`](https://github.com/jayadeeep/e-voting-system/blob/main/db.php) (Database connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_voting["Voting workflow"]
  node_php_app["PHP application<br/>[index.php]"]
  node_registration["Voter registration<br/>[index.php]"]
  node_authentication["Voter authentication<br/>[index.php]"]
  node_ballot["Vote submission<br/>[index.php]"]
  node_receipt["Vote receipt<br/>[index.php]"]
  node_results["Election results<br/>[index.php]"]
end

subgraph group_frontend["Browser experience"]
  node_browser_app["Browser application<br/>[script.js]"]
  node_otp_flow["Simulated OTP flow<br/>[script.js]"]
  node_admin_module["Admin dashboard<br/>[script.js]"]
  node_browser_storage[("Browser voter store<br/>[script.js]")]
end

subgraph group_storage["Persistent data"]
  node_db_connection["Database connection<br/>[db.php]"]
  node_mysql[("MySQL database")]
end

node_citizen(("Citizen"))
node_admin(("Administrator"))
node_otp_endpoint["OTP PHP endpoints"]

node_citizen -->|"submits requests"| node_php_app
node_php_app -->|"handles registration"| node_registration
node_php_app -->|"handles sign-in"| node_authentication
node_php_app -->|"handles vote"| node_ballot
node_php_app -->|"sets receipt data"| node_receipt
node_php_app -->|"renders results"| node_results
node_php_app -->|"loads connection"| node_db_connection
node_registration -->|"stores voter data"| node_mysql
node_authentication -->|"checks voter"| node_mysql
node_ballot -->|"reads and updates votes"| node_mysql
node_results -->|"reads vote totals"| node_mysql
node_browser_app -->|"drives"| node_otp_flow
node_browser_app -->|"drives"| node_admin_module
node_otp_flow -.->|"requests verification"| node_otp_endpoint
node_otp_flow -->|"updates simulated state"| node_browser_storage
node_admin -->|"uses"| node_admin_module
node_citizen -->|"uses"| node_browser_app

click node_php_app "https://github.com/jayadeeep/e-voting-system/blob/main/index.php"
click node_registration "https://github.com/jayadeeep/e-voting-system/blob/main/index.php"
click node_authentication "https://github.com/jayadeeep/e-voting-system/blob/main/index.php"
click node_ballot "https://github.com/jayadeeep/e-voting-system/blob/main/index.php"
click node_receipt "https://github.com/jayadeeep/e-voting-system/blob/main/index.php"
click node_results "https://github.com/jayadeeep/e-voting-system/blob/main/index.php"
click node_browser_app "https://github.com/jayadeeep/e-voting-system/blob/main/script.js"
click node_otp_flow "https://github.com/jayadeeep/e-voting-system/blob/main/script.js"
click node_admin_module "https://github.com/jayadeeep/e-voting-system/blob/main/script.js"
click node_browser_storage "https://github.com/jayadeeep/e-voting-system/blob/main/script.js"
click node_db_connection "https://github.com/jayadeeep/e-voting-system/blob/main/db.php"

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_php_app,node_registration,node_authentication,node_ballot,node_receipt,node_results toneBlue
class node_browser_app,node_otp_flow,node_admin_module,node_browser_storage toneAmber
class node_db_connection,node_mysql toneMint
class node_citizen,node_admin,node_otp_endpoint toneIndigo
```

## Components

### Voting workflow

- [PHP application](https://github.com/jayadeeep/e-voting-system/blob/main/index.php): `index.php`
- [Voter registration](https://github.com/jayadeeep/e-voting-system/blob/main/index.php): `index.php`
- [Voter authentication](https://github.com/jayadeeep/e-voting-system/blob/main/index.php): `index.php`
- [Vote submission](https://github.com/jayadeeep/e-voting-system/blob/main/index.php): `index.php`
- [Vote receipt](https://github.com/jayadeeep/e-voting-system/blob/main/index.php): `index.php`
- [Election results](https://github.com/jayadeeep/e-voting-system/blob/main/index.php): `index.php`

### Browser experience

- [Browser application](https://github.com/jayadeeep/e-voting-system/blob/main/script.js): `script.js`
- [Simulated OTP flow](https://github.com/jayadeeep/e-voting-system/blob/main/script.js): `script.js`
- [Admin dashboard](https://github.com/jayadeeep/e-voting-system/blob/main/script.js): `script.js`
- [Browser voter store](https://github.com/jayadeeep/e-voting-system/blob/main/script.js): `script.js`

### Persistent data

- [Database connection](https://github.com/jayadeeep/e-voting-system/blob/main/db.php): `db.php`
- **MySQL database**

### Other components

- **Citizen**
- **Administrator**
- **OTP PHP endpoints**

## Connections

- Citizen → PHP application: submits requests
- PHP application → Voter registration: handles registration
- PHP application → Voter authentication: handles sign-in
- PHP application → Vote submission: handles vote
- PHP application → Vote receipt: sets receipt data
- PHP application → Election results: renders results
- PHP application → Database connection: loads connection
- Voter registration → MySQL database: stores voter data
- Voter authentication → MySQL database: checks voter
- Vote submission → MySQL database: reads and updates votes
- Election results → MySQL database: reads vote totals
- Browser application → Simulated OTP flow: drives
- Browser application → Admin dashboard: drives
- Simulated OTP flow → OTP PHP endpoints: requests verification
- Simulated OTP flow → Browser voter store: updates simulated state
- Administrator → Admin dashboard: uses
- Citizen → Browser application: uses
