sharonashik005/votechain-ai
0
VoteChainAI
Civic Infrastructure for the AI Era
A production-grade, blockchain-backed voting platform with AI-assisted integrity monitoring.
๐๏ธ Architecture
VoteChainAI/
โ
โโโ frontend/ # React + TypeScript + Vite
โ โโโ src/
โ โ โโโ api/ # API client
โ โ โโโ components/ # NavBar, etc.
โ โ โโโ context/ # Auth context
โ โ โโโ pages/ # Landing, Login, Register, Dashboard, Admin, Verify
โ โ โโโ App.tsx # Router
โ โโโ package.json
โ
โโโ backend/ # FastAPI + SQLite
โ โโโ app/
โ โ โโโ api/ # Auth, Elections, Votes, Audit endpoints
โ โ โโโ models/ # SQLAlchemy models
โ โ โโโ schemas/ # Pydantic schemas
โ โ โโโ services/ # Blockchain, Auth services
โ โ โโโ main.py # App entry
โ โโโ requirements.txt
โ
โโโ blockchain/ # Solidity + Hardhat
โโโ contracts/
โ โโโ VoteLedger.sol
โโโ scripts/
โ โโโ deploy.js
โโโ test/๐ Security
๐ Quick Start
1. Backend (FastAPI + SQLite)
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
uvicorn app.main:app --reload --port 8000API Docs: http://localhost:8000/docs
2. Frontend (React + Vite)
cd frontend
npm install
npm run devApp: http://localhost:5173
3. Blockchain (Optional)
cd blockchain
npm install
npx hardhat node # Terminal 1
npm run deploy # Terminal 2๐ฑ Pages
๐ก API Endpoints
Authentication
POST /api/v1/auth/register - Register user
POST /api/v1/auth/login - Get JWT token
GET /api/v1/auth/me - Get profileElections
POST /api/v1/elections/create - Create (ADMIN)
GET /api/v1/elections/active - List active
POST /api/v1/elections/{id}/close - Close (ADMIN)Voting
POST /api/v1/vote/cast - Cast vote
GET /api/v1/vote/verify/{hash} - Verify vote๐งช Testing Flow
- Open http://localhost:5173
- Register as
adminrole - Login โ redirected to Admin Panel
- Create election + activate it
- Register another user as
voter - Login as voter โ Dashboard
- Cast a vote โ get receipt with hash
- Go to Verify โ enter hash โ see confirmation
๐ธ Project Demo
Below is a walkthrough of the application functionality:
1. Authentication & Onboarding
2. Face Liveness & Verification
3. Voting Process
4. Verification & Admin
๐ License
MIT License
