# kansalakshat/remote-voting-blockchain architecture

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

- Interactive diagram: https://gitdiagram.com/kansalakshat/remote-voting-blockchain
- Repository: https://github.com/kansalakshat/remote-voting-blockchain

## Overview

The repository describes remote voting backed by Hyperledger Fabric, but the visible implementation is a React/Express user-account application: registration and activation, login and token-based profile access, password recovery, and admin user management. The README’s blockchain-voting capability has no corresponding voting, ballot, or ledger modules in the supplied tree, so its integration cannot be traced. The graph covers the implemented account workflow and supporting upload and offline-cache capabilities; relationships are limited to those shown in excerpts, the SOURCE INDEX, or the README.

Main entry points: [`WebApp/client/src/App.js`](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/App.js) (Application shell), [`WebApp/routes/userRouter.js`](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/routes/userRouter.js) (User routes), [`WebApp/client/src/components/body/Body.js`](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/body/Body.js) (Page routing), [`WebApp/controllers/userCtrl.js`](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/controllers/userCtrl.js) (Account operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Application shell<br/>[App.js]"]
  node_routes_ui["Page routing<br/>[Body.js]"]
  node_account_pages["Account pages"]
  node_profile_pages["Profile and admin pages"]
  node_home["Home page<br/>[Home.js]"]
  node_header["Header<br/>[Header.js]"]
  node_notifications["Notifications<br/>[Notification.js]"]
  node_validation["Form validation<br/>[Validation.js]"]
  node_service_worker["Offline cache<br/>[serviceWorker.js]"]
end

subgraph group_state["Client state"]
  node_redux_actions["Redux actions"]
  node_redux_store["Redux store<br/>[store.js]"]
  node_reducers["State reducers"]
end

subgraph group_api["Account API"]
  node_server["HTTP server<br/>[server.js]"]
  node_user_routes["User routes<br/>[userRouter.js]"]
  node_user_controller["Account operations<br/>[userCtrl.js]"]
  node_auth_middleware["Token authentication<br/>[auth.js]"]
  node_admin_middleware["Admin authorization<br/>[authAdmin.js]"]
  node_user_model["User model<br/>[userModel.js]"]
end

subgraph group_support["Supporting services"]
  node_mail["Mail delivery<br/>[sendMail.js]"]
  node_upload_routes["Upload routes<br/>[upload.js]"]
  node_upload_middleware["Image upload middleware<br/>[uploadImage.js]"]
  node_upload_controller["Upload handler<br/>[uploadCtrl.js]"]
end

node_voter(("Voter / admin"))
node_mongo[("MongoDB")]
node_fabric[("Hyperledger Fabric")]

node_voter -->|"uses"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_routes_ui
node_routes_ui -->|"routes to"| node_account_pages
node_routes_ui -->|"routes to"| node_profile_pages
node_routes_ui -->|"routes to"| node_home
node_redux_store -->|"configures"| node_reducers
node_app -->|"dispatches"| node_redux_actions
node_redux_actions -->|"requests user info"| node_user_routes
node_server -->|"mounts routes"| node_user_routes
node_server -->|"mounts routes"| node_upload_routes
node_user_routes -->|"dispatches"| node_user_controller
node_user_routes -->|"authenticates"| node_auth_middleware
node_user_routes -->|"authorizes admins"| node_admin_middleware
node_admin_middleware -->|"reads user"| node_user_model
node_user_controller -->|"reads and updates"| node_user_model
node_user_controller -->|"sends email"| node_mail
node_user_model -.->|"persists users"| node_mongo
node_upload_routes -->|"uses"| node_upload_middleware
node_upload_routes -->|"dispatches"| node_upload_controller
node_voter -.->|"casts remote vote"| node_fabric
node_service_worker -.->|"caches client"| node_app

click node_app "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/App.js"
click node_routes_ui "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/body/Body.js"
click node_account_pages "https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/components/body/auth"
click node_profile_pages "https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/components/body/profile"
click node_home "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/body/home/Home.js"
click node_header "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/header/Header.js"
click node_notifications "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/utils/notification/Notification.js"
click node_validation "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/utils/validation/Validation.js"
click node_redux_actions "https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/redux/actions"
click node_redux_store "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/redux/store.js"
click node_reducers "https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/redux/reducers"
click node_service_worker "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/serviceWorker.js"
click node_server "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/server.js"
click node_user_routes "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/routes/userRouter.js"
click node_user_controller "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/controllers/userCtrl.js"
click node_auth_middleware "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/middleware/auth.js"
click node_admin_middleware "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/middleware/authAdmin.js"
click node_user_model "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/models/userModel.js"
click node_mail "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/controllers/sendMail.js"
click node_upload_routes "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/routes/upload.js"
click node_upload_middleware "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/middleware/uploadImage.js"
click node_upload_controller "https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/controllers/uploadCtrl.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_app,node_routes_ui,node_account_pages,node_profile_pages,node_home,node_header,node_notifications,node_validation,node_service_worker toneBlue
class node_redux_actions,node_redux_store,node_reducers,node_mongo,node_fabric toneAmber
class node_server,node_user_routes,node_user_controller,node_auth_middleware,node_admin_middleware,node_user_model toneMint
class node_mail,node_upload_routes,node_upload_middleware,node_upload_controller toneRose
class node_voter toneIndigo
```

## Components

### Web client

- [Application shell](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/App.js): `WebApp/client/src/App.js`
- [Page routing](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/body/Body.js): `WebApp/client/src/components/body/Body.js`
- [Account pages](https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/components/body/auth): `WebApp/client/src/components/body/auth`
- [Profile and admin pages](https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/components/body/profile): `WebApp/client/src/components/body/profile`
- [Home page](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/body/home/Home.js): `WebApp/client/src/components/body/home/Home.js`
- [Header](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/header/Header.js): `WebApp/client/src/components/header/Header.js`
- [Notifications](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/utils/notification/Notification.js): `WebApp/client/src/components/utils/notification/Notification.js`
- [Form validation](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/components/utils/validation/Validation.js): `WebApp/client/src/components/utils/validation/Validation.js`
- [Offline cache](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/serviceWorker.js): `WebApp/client/src/serviceWorker.js`

### Client state

- [Redux actions](https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/redux/actions): `WebApp/client/src/redux/actions`
- [Redux store](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/client/src/redux/store.js): `WebApp/client/src/redux/store.js`
- [State reducers](https://github.com/kansalakshat/remote-voting-blockchain/tree/main/WebApp/client/src/redux/reducers): `WebApp/client/src/redux/reducers`

### Account API

- [HTTP server](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/server.js): `WebApp/server.js`
- [User routes](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/routes/userRouter.js): `WebApp/routes/userRouter.js`
- [Account operations](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/controllers/userCtrl.js): `WebApp/controllers/userCtrl.js`
- [Token authentication](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/middleware/auth.js): `WebApp/middleware/auth.js`
- [Admin authorization](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/middleware/authAdmin.js): `WebApp/middleware/authAdmin.js`
- [User model](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/models/userModel.js): `WebApp/models/userModel.js`

### Supporting services

- [Mail delivery](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/controllers/sendMail.js): `WebApp/controllers/sendMail.js`
- [Upload routes](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/routes/upload.js): `WebApp/routes/upload.js`
- [Image upload middleware](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/middleware/uploadImage.js): `WebApp/middleware/uploadImage.js`
- [Upload handler](https://github.com/kansalakshat/remote-voting-blockchain/blob/main/WebApp/controllers/uploadCtrl.js): `WebApp/controllers/uploadCtrl.js`

### Other components

- **Voter / admin**
- **MongoDB**
- **Hyperledger Fabric**

## Connections

- Voter / admin → Application shell: uses (evidence: `README.md`)
- Application shell → Header: renders (evidence: `WebApp/client/src/App.js`)
- Application shell → Page routing: renders (evidence: `WebApp/client/src/App.js`)
- Page routing → Account pages: routes to (evidence: `WebApp/client/src/components/body/Body.js`)
- Page routing → Profile and admin pages: routes to (evidence: `WebApp/client/src/components/body/Body.js`)
- Page routing → Home page: routes to (evidence: `WebApp/client/src/components/body/Body.js`)
- Redux store → State reducers: configures (evidence: `WebApp/client/src/redux/store.js`)
- Application shell → Redux actions: dispatches (evidence: `WebApp/client/src/App.js`)
- Redux actions → User routes: requests user info (evidence: `WebApp/client/src/redux/actions/authAction.js`)
- HTTP server → User routes: mounts routes (evidence: `WebApp/server.js`)
- HTTP server → Upload routes: mounts routes (evidence: `WebApp/server.js`)
- User routes → Account operations: dispatches (evidence: `WebApp/routes/userRouter.js`)
- User routes → Token authentication: authenticates (evidence: `WebApp/routes/userRouter.js`)
- User routes → Admin authorization: authorizes admins (evidence: `WebApp/routes/userRouter.js`)
- Admin authorization → User model: reads user (evidence: `WebApp/middleware/authAdmin.js`)
- Account operations → User model: reads and updates (evidence: `WebApp/controllers/userCtrl.js`)
- Account operations → Mail delivery: sends email (evidence: `WebApp/controllers/userCtrl.js`)
- User model → MongoDB: persists users
- Upload routes → Image upload middleware: uses (evidence: `WebApp/routes/upload.js`)
- Upload routes → Upload handler: dispatches (evidence: `WebApp/routes/upload.js`)
- Voter / admin → Hyperledger Fabric: casts remote vote
- Offline cache → Application shell: caches client
