Skip to content

Nandika-Gupta/Votely

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Votely - Blockchain-Powered Voting Platform

Secure, Transparent, Tamper-Proof Elections


πŸ—³οΈ About Votely

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.

Key Features

  • πŸ” 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

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/votely.git
    cd votely
  2. Install dependencies

    bun install
    # or
    npm install
  3. Set up environment variables

    cp .env.example .env

    Edit .env with your configuration (see Environment Variables)

  4. Start development server

    bun run dev
    # or
    npm run dev
  5. Open in browser

    http://localhost:5173
    

⛓️ Smart Contract Deployment

Local Development (Hardhat)

  1. Start local blockchain

    npx hardhat node
  2. Deploy contract

    npx hardhat run scripts/deploy.js --network localhost
  3. Update .env with the deployed contract address

    VITE_CONTRACT_ADDRESS=0x...
  4. Configure MetaMask

    • Add network with RPC URL: http://127.0.0.1:8545
    • Chain ID: 31337
    • Import test account using Hardhat private key

Testnet Deployment (Sepolia)

  1. Get Sepolia ETH from a faucet

  2. Configure deployment (⚠️ Never commit real private keys!)

    • Use environment variables or secure key management
    • See .env.example for required variables
  3. Deploy to Sepolia

    npx hardhat run scripts/deploy.js --network sepolia

πŸ” Environment Variables

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 .env files with real private keys or secrets!


πŸ› οΈ Tech Stack

Frontend

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

Backend

Technology Purpose
Supabase Authentication & Database
Edge Functions Serverless backend logic

Blockchain

Technology Purpose
Solidity Smart contract language
Hardhat Ethereum development environment
MetaMask Wallet integration

πŸ“œ Smart Contract API

ChainVote.sol

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

πŸ§ͺ Testing

# Run frontend tests
bun run test

# Run smart contract tests
npx hardhat test

πŸ“¦ Building for Production

# Build frontend
bun run build

# Preview production build
bun run preview

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❀️ for Indian Educational Institutions

Getting Started β€’ Deploy Contract β€’ Contributing

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors