Secure, Transparent, Tamper-Proof Elections
Votely is a modern, blockchain-powered voting platform designed for educational institutions across India. It provides a secure, transparent, and tamper-proof election system for schools, colleges, and universities.
- π Blockchain Security - Votes recorded on Ethereum blockchain for immutability
- π Multi-Institution Support - Handle elections for multiple schools and colleges
- π MetaMask Integration - Secure wallet-based voter authentication
- π Real-Time Results - Live vote counting with beautiful visualizations
- π Dark/Light Mode - Beautiful UI with theme support
- π± Responsive Design - Works seamlessly on desktop and mobile
votely/
βββ π src/ # Frontend Application (React + TypeScript)
β βββ components/ # Reusable UI components
β β βββ ui/ # shadcn/ui component library
β β βββ Header.tsx # Navigation header
β β βββ CandidateCard.tsx # Candidate display component
β β βββ ResultsChart.tsx # Vote visualization charts
β βββ contexts/ # React Context providers
β β βββ AuthContext.tsx # Authentication state
β β βββ ElectionContext.tsx # Election data & voting logic
β β βββ ThemeContext.tsx # Theme management
β β βββ WalletContext.tsx # MetaMask wallet integration
β βββ pages/ # Application pages
β β βββ Home.tsx # Landing page
β β βββ VotePage.tsx # Voting interface
β β βββ ResultsPage.tsx # Election results
β β βββ AuthPage.tsx # Login/Signup
β βββ hooks/ # Custom React hooks
β βββ integrations/ # Third-party integrations
β β βββ supabase/ # Supabase client & types
β βββ lib/ # Utility functions
β
βββ π contracts/ # Smart Contracts (Solidity)
β βββ ChainVote.sol # Main voting contract
β
βββ π scripts/ # Deployment Scripts
β βββ deploy.js # Hardhat deployment script
β
βββ π supabase/ # Backend Configuration
β βββ config.toml # Supabase configuration
β
βββ π public/ # Static Assets
β βββ favicon.ico
β βββ robots.txt
β
βββ π Configuration Files
βββ hardhat.config.js # Hardhat (Ethereum) configuration
βββ vite.config.ts # Vite bundler configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
-
Clone the repository
git clone https://github.com/yourusername/votely.git cd votely -
Install dependencies
bun install # or npm install -
Set up environment variables
cp .env.example .env
Edit
.envwith your configuration (see Environment Variables) -
Start development server
bun run dev # or npm run dev -
Open in browser
http://localhost:5173
-
Start local blockchain
npx hardhat node
-
Deploy contract
npx hardhat run scripts/deploy.js --network localhost
-
Update
.envwith the deployed contract addressVITE_CONTRACT_ADDRESS=0x...
-
Configure MetaMask
- Add network with RPC URL:
http://127.0.0.1:8545 - Chain ID:
31337 - Import test account using Hardhat private key
- Add network with RPC URL:
-
Get Sepolia ETH from a faucet
-
Configure deployment (
β οΈ Never commit real private keys!)- Use environment variables or secure key management
- See
.env.examplefor required variables
-
Deploy to Sepolia
npx hardhat run scripts/deploy.js --network sepolia
| Variable | Description | Required |
|---|---|---|
VITE_CONTRACT_ADDRESS |
Deployed ChainVote contract address | Yes |
VITE_RPC_URL |
Ethereum RPC URL (default: localhost:8545) | No |
VITE_SUPABASE_URL |
Supabase project URL | Auto |
VITE_SUPABASE_PUBLISHABLE_KEY |
Supabase anon key | Auto |
β οΈ Security Warning: Never commit.envfiles with real private keys or secrets!
| Technology | Purpose |
|---|---|
| React 18 | UI library |
| TypeScript | Type safety |
| Vite | Build tool & dev server |
| Tailwind CSS | Utility-first styling |
| shadcn/ui | Component library |
| React Router | Client-side routing |
| Recharts | Data visualization |
| Technology | Purpose |
|---|---|
| Supabase | Authentication & Database |
| Edge Functions | Serverless backend logic |
| Technology | Purpose |
|---|---|
| Solidity | Smart contract language |
| Hardhat | Ethereum development environment |
| MetaMask | Wallet integration |
| Function | Description | Access |
|---|---|---|
startElection(name, candidates[]) |
Start a new election | Admin |
vote(candidateId) |
Cast a vote | Voter |
endElection() |
End the active election | Admin |
getCandidates() |
Get all candidates | Public |
getResults() |
Get election results | Public |
checkVoterStatus(address) |
Check if address has voted | Public |
# Run frontend tests
bun run test
# Run smart contract tests
npx hardhat test# Build frontend
bun run build
# Preview production build
bun run preview- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Getting Started β’ Deploy Contract β’ Contributing