# kshsri21/votingbootcamp architecture

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

- Interactive diagram: https://gitdiagram.com/kshsri21/votingbootcamp
- Repository: https://github.com/kshsri21/votingbootcamp

## Overview

Bootcamp1.0 is a browser-based voting dapp with voter and candidate registration/listing, voting, election administration, wallet authentication, and a token marketplace. Users connect a wallet, then navigate to registration, voting, election-management, or marketplace screens; those screens use shared Web3 state to interact with contracts. The README gives no further capability details, so unsampled feature relationships are kept conservative. The graph follows explicit route/component wiring and sampled Web3 setup; several contract interactions are indicated by indexed imports, not inspected implementations.

Main entry points: [`src/context/useWeb3Context.jsx`](https://github.com/kshsri21/votingbootcamp/blob/main/src/context/useWeb3Context.jsx) (Web3 hook), [`src/routes/routes.jsx`](https://github.com/kshsri21/votingbootcamp/blob/main/src/routes/routes.jsx) (Page routes), [`src/pages/TokenMarketplace/TokenMarketplace.jsx`](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/TokenMarketplace/TokenMarketplace.jsx) (Marketplace page), [`src/pages/ElectionCommision/ElectionCommision.jsx`](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/ElectionCommision/ElectionCommision.jsx) (Election administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application flow"]
  node_app["App shell<br/>[App.jsx]"]
  node_routes["Page routes<br/>[routes.jsx]"]
  node_navigation["Navigation<br/>[Navigation.jsx]"]
end

subgraph group_identity["Wallet and Web3"]
  node_wallet["Wallet screen<br/>[Wallet.jsx]"]
  node_web3provider["Web3 provider<br/>[Web3Provider.jsx]"]
  node_web3hook["Web3 hook<br/>[useWeb3Context.jsx]"]
  node_web3context["Web3 context<br/>[web3Context.jsx]"]
  node_web3setup["Wallet setup<br/>[getWeb3State.jsx]"]
end

subgraph group_election["Election workflows"]
  node_voterregister["Voter registration<br/>[RegisterVoter.jsx]"]
  node_voterlist["Voter list<br/>[GetVoterList.jsx]"]
  node_candidateregister["Candidate registration"]
  node_candidatelist["Candidate list"]
  node_imageupload["Candidate image upload"]
  node_electionpage["Election administration"]
  node_votingstatus["Voting status<br/>[VotingStatus.jsx]"]
  node_results["Election results<br/>[DisplayResult.jsx]"]
  node_votingperiod["Voting period"]
  node_winner["Winner announcement<br/>[AnnounceWinner.jsx]"]
  node_emergency["Emergency declaration"]
  node_castvote["Cast vote<br/>[CastVote.jsx]"]
end

subgraph group_market["Token marketplace"]
  node_marketpage["Marketplace page"]
  node_buytoken["Buy tokens<br/>[BuyToken.jsx]"]
  node_selltoken["Sell and approve<br/>[SellToken.jsx]"]
  node_balance["Token balance<br/>[TokenBalance.jsx]"]
  node_price["Token price<br/>[TokenPrice.jsx]"]
end

node_user(("Dapp user"))
node_metamask{{"MetaMask"}}
node_authservice{{"Authentication API"}}
node_votingcontract[("Voting contract")]
node_marketcontract[("Marketplace contract")]
node_erc20contract[("ERC-20 contract")]

node_user -->|"navigates"| node_routes
node_app -->|"provides state"| node_web3provider
node_app -->|"mounts router"| node_routes
node_routes -->|"routes to"| node_wallet
node_routes -->|"renders"| node_navigation
node_routes -->|"routes to"| node_voterregister
node_routes -->|"routes to"| node_voterlist
node_routes -->|"routes to"| node_candidateregister
node_routes -->|"routes to"| node_candidatelist
node_routes -->|"routes to"| node_electionpage
node_routes -->|"routes to"| node_marketpage
node_web3provider -->|"provides context"| node_web3context
node_web3provider -->|"loads wallet state"| node_web3setup
node_web3hook -->|"reads context"| node_web3context
node_web3setup -->|"requests account"| node_metamask
node_web3setup -->|"authenticates account"| node_authservice
node_web3setup -->|"creates contract client"| node_votingcontract
node_wallet -->|"reads wallet state"| node_web3hook
node_voterregister -->|"reads contract state"| node_web3hook
node_voterregister -.->|"registers voter"| node_votingcontract
node_voterlist -->|"reads contract state"| node_web3hook
node_voterlist -.->|"queries voters"| node_votingcontract
node_candidateregister -->|"reads contract state"| node_web3hook
node_candidateregister -->|"uploads image"| node_imageupload
node_candidateregister -->|"registers candidate"| node_votingcontract
node_candidatelist -->|"reads contract state"| node_web3hook
node_candidatelist -.->|"queries candidates"| node_votingcontract
node_electionpage -->|"renders"| node_votingstatus
node_electionpage -->|"renders"| node_results
node_electionpage -->|"renders"| node_votingperiod
node_electionpage -->|"renders"| node_winner
node_electionpage -->|"renders"| node_emergency
node_votingstatus -->|"reads contract state"| node_web3hook
node_votingstatus -->|"reads status"| node_votingcontract
node_results -->|"reads contract state"| node_web3hook
node_votingperiod -->|"reads contract state"| node_web3hook
node_winner -->|"reads contract state"| node_web3hook
node_emergency -->|"reads contract state"| node_web3hook
node_castvote -->|"reads contract state"| node_web3hook
node_castvote -.->|"casts vote"| node_votingcontract
node_marketpage -->|"reads wallet state"| node_web3hook
node_marketpage -->|"renders"| node_buytoken
node_marketpage -->|"renders"| node_selltoken
node_marketpage -->|"renders"| node_balance
node_marketpage -->|"renders"| node_price
node_marketpage -->|"initializes client"| node_marketcontract
node_marketpage -->|"initializes client"| node_erc20contract
node_buytoken -.->|"buys tokens"| node_marketcontract

click node_app "https://github.com/kshsri21/votingbootcamp/blob/main/src/App.jsx"
click node_routes "https://github.com/kshsri21/votingbootcamp/blob/main/src/routes/routes.jsx"
click node_navigation "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/Navigation/Navigation.jsx"
click node_wallet "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/Wallet/Wallet.jsx"
click node_web3provider "https://github.com/kshsri21/votingbootcamp/blob/main/src/context/Web3Provider.jsx"
click node_web3hook "https://github.com/kshsri21/votingbootcamp/blob/main/src/context/useWeb3Context.jsx"
click node_web3context "https://github.com/kshsri21/votingbootcamp/blob/main/src/context/web3Context.jsx"
click node_web3setup "https://github.com/kshsri21/votingbootcamp/blob/main/src/utils/getWeb3State.jsx"
click node_voterregister "https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Voter/RegisterVoter.jsx"
click node_voterlist "https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Voter/GetVoterList.jsx"
click node_candidateregister "https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Candidate/RegisterCandidate.jsx"
click node_candidatelist "https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Candidate/GetCandidateList.jsx"
click node_imageupload "https://github.com/kshsri21/votingbootcamp/blob/main/src/utils/uploadCandidateImage.jsx"
click node_electionpage "https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/ElectionCommision/ElectionCommision.jsx"
click node_votingstatus "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/VotingStatus.jsx"
click node_results "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/DisplayResult.jsx"
click node_votingperiod "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/VotingTimePeriod.jsx"
click node_winner "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/AnnounceWinner.jsx"
click node_emergency "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/EmergencyDeclare.jsx"
click node_castvote "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/Voter/CastVote.jsx"
click node_marketpage "https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/TokenMarketplace/TokenMarketplace.jsx"
click node_buytoken "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/BuyToken.jsx"
click node_selltoken "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/SellToken.jsx"
click node_balance "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/TokenBalance.jsx"
click node_price "https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/TokenPrice.jsx"

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,node_navigation,node_user toneBlue
class node_wallet,node_web3provider,node_web3hook,node_web3context,node_web3setup,node_votingcontract,node_marketcontract,node_erc20contract toneAmber
class node_voterregister,node_voterlist,node_candidateregister,node_candidatelist,node_imageupload,node_electionpage,node_votingstatus,node_results,node_votingperiod,node_winner,node_emergency,node_castvote,node_authservice toneMint
class node_marketpage,node_buytoken,node_selltoken,node_balance,node_price toneRose
class node_metamask toneIndigo
```

## Components

### Application flow

- [App shell](https://github.com/kshsri21/votingbootcamp/blob/main/src/App.jsx): `src/App.jsx`
- [Page routes](https://github.com/kshsri21/votingbootcamp/blob/main/src/routes/routes.jsx): `src/routes/routes.jsx`
- [Navigation](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/Navigation/Navigation.jsx): `src/components/Navigation/Navigation.jsx`

### Wallet and Web3

- [Wallet screen](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/Wallet/Wallet.jsx): `src/components/Wallet/Wallet.jsx`
- [Web3 provider](https://github.com/kshsri21/votingbootcamp/blob/main/src/context/Web3Provider.jsx): `src/context/Web3Provider.jsx`
- [Web3 hook](https://github.com/kshsri21/votingbootcamp/blob/main/src/context/useWeb3Context.jsx): `src/context/useWeb3Context.jsx`
- [Web3 context](https://github.com/kshsri21/votingbootcamp/blob/main/src/context/web3Context.jsx): `src/context/web3Context.jsx`
- [Wallet setup](https://github.com/kshsri21/votingbootcamp/blob/main/src/utils/getWeb3State.jsx): `src/utils/getWeb3State.jsx`

### Election workflows

- [Voter registration](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Voter/RegisterVoter.jsx): `src/pages/Voter/RegisterVoter.jsx`
- [Voter list](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Voter/GetVoterList.jsx): `src/pages/Voter/GetVoterList.jsx`
- [Candidate registration](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Candidate/RegisterCandidate.jsx): `src/pages/Candidate/RegisterCandidate.jsx`
- [Candidate list](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/Candidate/GetCandidateList.jsx): `src/pages/Candidate/GetCandidateList.jsx`
- [Candidate image upload](https://github.com/kshsri21/votingbootcamp/blob/main/src/utils/uploadCandidateImage.jsx): `src/utils/uploadCandidateImage.jsx`
- [Election administration](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/ElectionCommision/ElectionCommision.jsx): `src/pages/ElectionCommision/ElectionCommision.jsx`
- [Voting status](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/VotingStatus.jsx): `src/components/ElectionCommision/VotingStatus.jsx`
- [Election results](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/DisplayResult.jsx): `src/components/ElectionCommision/DisplayResult.jsx`
- [Voting period](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/VotingTimePeriod.jsx): `src/components/ElectionCommision/VotingTimePeriod.jsx`
- [Winner announcement](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/AnnounceWinner.jsx): `src/components/ElectionCommision/AnnounceWinner.jsx`
- [Emergency declaration](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/ElectionCommision/EmergencyDeclare.jsx): `src/components/ElectionCommision/EmergencyDeclare.jsx`
- [Cast vote](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/Voter/CastVote.jsx): `src/components/Voter/CastVote.jsx`

### Token marketplace

- [Marketplace page](https://github.com/kshsri21/votingbootcamp/blob/main/src/pages/TokenMarketplace/TokenMarketplace.jsx): `src/pages/TokenMarketplace/TokenMarketplace.jsx`
- [Buy tokens](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/BuyToken.jsx): `src/components/TokenMarketplace/BuyToken.jsx`
- [Sell and approve](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/SellToken.jsx): `src/components/TokenMarketplace/SellToken.jsx`
- [Token balance](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/TokenBalance.jsx): `src/components/TokenMarketplace/TokenBalance.jsx`
- [Token price](https://github.com/kshsri21/votingbootcamp/blob/main/src/components/TokenMarketplace/TokenPrice.jsx): `src/components/TokenMarketplace/TokenPrice.jsx`

### Other components

- **Dapp user**
- **MetaMask**
- **Authentication API**
- **Voting contract**
- **Marketplace contract**
- **ERC-20 contract**

## Connections

- Dapp user → Page routes: navigates (evidence: `src/routes/routes.jsx`)
- App shell → Web3 provider: provides state (evidence: `src/App.jsx`)
- App shell → Page routes: mounts router (evidence: `src/App.jsx`)
- Page routes → Wallet screen: routes to (evidence: `src/routes/routes.jsx`)
- Page routes → Navigation: renders (evidence: `src/routes/routes.jsx`)
- Page routes → Voter registration: routes to (evidence: `src/routes/routes.jsx`)
- Page routes → Voter list: routes to (evidence: `src/routes/routes.jsx`)
- Page routes → Candidate registration: routes to (evidence: `src/routes/routes.jsx`)
- Page routes → Candidate list: routes to (evidence: `src/routes/routes.jsx`)
- Page routes → Election administration: routes to (evidence: `src/routes/routes.jsx`)
- Page routes → Marketplace page: routes to (evidence: `src/routes/routes.jsx`)
- Web3 provider → Web3 context: provides context (evidence: `src/context/Web3Provider.jsx`)
- Web3 provider → Wallet setup: loads wallet state (evidence: `src/context/Web3Provider.jsx`)
- Web3 hook → Web3 context: reads context (evidence: `src/context/useWeb3Context.jsx`)
- Wallet setup → MetaMask: requests account (evidence: `src/utils/getWeb3State.jsx`)
- Wallet setup → Authentication API: authenticates account (evidence: `src/utils/getWeb3State.jsx`)
- Wallet setup → Voting contract: creates contract client (evidence: `src/utils/getWeb3State.jsx`)
- Wallet screen → Web3 hook: reads wallet state (evidence: `src/components/Wallet/Wallet.jsx`)
- Voter registration → Web3 hook: reads contract state (evidence: `src/pages/Voter/RegisterVoter.jsx`)
- Voter registration → Voting contract: registers voter
- Voter list → Web3 hook: reads contract state (evidence: `src/pages/Voter/GetVoterList.jsx`)
- Voter list → Voting contract: queries voters
- Candidate registration → Web3 hook: reads contract state (evidence: `src/pages/Candidate/RegisterCandidate.jsx`)
- Candidate registration → Candidate image upload: uploads image (evidence: `src/pages/Candidate/RegisterCandidate.jsx`)
- Candidate registration → Voting contract: registers candidate (evidence: `src/pages/Candidate/RegisterCandidate.jsx`)
- Candidate list → Web3 hook: reads contract state (evidence: `src/pages/Candidate/GetCandidateList.jsx`)
- Candidate list → Voting contract: queries candidates
- Election administration → Voting status: renders (evidence: `src/pages/ElectionCommision/ElectionCommision.jsx`)
- Election administration → Election results: renders (evidence: `src/pages/ElectionCommision/ElectionCommision.jsx`)
- Election administration → Voting period: renders (evidence: `src/pages/ElectionCommision/ElectionCommision.jsx`)
- Election administration → Winner announcement: renders (evidence: `src/pages/ElectionCommision/ElectionCommision.jsx`)
- Election administration → Emergency declaration: renders (evidence: `src/pages/ElectionCommision/ElectionCommision.jsx`)
- Voting status → Web3 hook: reads contract state (evidence: `src/components/ElectionCommision/VotingStatus.jsx`)
- Voting status → Voting contract: reads status (evidence: `src/components/ElectionCommision/VotingStatus.jsx`)
- Election results → Web3 hook: reads contract state (evidence: `src/components/ElectionCommision/DisplayResult.jsx`)
- Voting period → Web3 hook: reads contract state (evidence: `src/components/ElectionCommision/VotingTimePeriod.jsx`)
- Winner announcement → Web3 hook: reads contract state (evidence: `src/components/ElectionCommision/AnnounceWinner.jsx`)
- Emergency declaration → Web3 hook: reads contract state (evidence: `src/components/ElectionCommision/EmergencyDeclare.jsx`)
- Cast vote → Web3 hook: reads contract state (evidence: `src/components/Voter/CastVote.jsx`)
- Cast vote → Voting contract: casts vote
- Marketplace page → Web3 hook: reads wallet state (evidence: `src/pages/TokenMarketplace/TokenMarketplace.jsx`)
- Marketplace page → Buy tokens: renders (evidence: `src/pages/TokenMarketplace/TokenMarketplace.jsx`)
- Marketplace page → Sell and approve: renders (evidence: `src/pages/TokenMarketplace/TokenMarketplace.jsx`)
- Marketplace page → Token balance: renders (evidence: `src/pages/TokenMarketplace/TokenMarketplace.jsx`)
- Marketplace page → Token price: renders (evidence: `src/pages/TokenMarketplace/TokenMarketplace.jsx`)
- Marketplace page → Marketplace contract: initializes client (evidence: `src/pages/TokenMarketplace/TokenMarketplace.jsx`)
- Marketplace page → ERC-20 contract: initializes client (evidence: `src/pages/TokenMarketplace/TokenMarketplace.jsx`)
- Buy tokens → Marketplace contract: buys tokens
