A secure, modern, government-grade digital voting platform built with Next.js, React, Express.js, and PostgreSQL. Enables eligible Indian citizens to participate in elections digitally with Aadhaar/PAN verification, face recognition (eKYC), and Voter ID validation.
-
Multi-Level Identity Verification
- Aadhaar OTP verification
- PAN number validation
- Face eKYC verification (liveness detection)
- Voter ID validation
-
Election Browsing
- View eligible elections based on location
- National, State, and Local elections
- Real-time election status (Draft, Published, Active, Ended)
- Filter by category
-
Voting
- Candidate selection with visual feedback
- Vote confirmation dialog
- Anonymous vote casting (vote not linked to voter)
- Instant receipt generation
-
Results
- View election results with vote counts
- Percentage calculations
- Visual progress bars for easy comparison
-
Dashboard
- Real-time statistics (total elections, voters, votes cast)
- Pending verifications counter
- Quick action buttons
-
Election Management
- Create new elections with location criteria
- Edit election details
- Manage election status (Draft β Published β Active β Ended)
- Candidate management within elections
- Support for National, State, and Local elections
-
Voter Management
- View all registered voters
- Filter by verification status
- Approve/reject voter registrations
- Monitor verification progress
-
Results Dashboard
- View live voting results for all elections
- Vote counts and percentages
- Status tracking per election
- Frontend: Next.js 14, React 18, TypeScript, Tailwind CSS
- State Management: Zustand (with persistence)
- Forms: React Hook Form + Zod validation
- Backend: Express.js, PostgreSQL, Redis
- Security: JWT, AES-256-GCM encryption, Rate limiting
- UI Components: Radix UI, Custom components
apps/
βββ frontend/ # Next.js React frontend
β βββ src/
β β βββ app/ # Pages and routes
β β βββ components/# React components
β β βββ store/ # Zustand state
β β βββ lib/ # Utilities (API client, etc)
β βββ public/ # Static assets
βββ backend/ # Express.js backend
βββ src/
β βββ routes/ # API endpoints
β βββ lib/ # Business logic
β βββ migrations/# Database migrations
βββ scripts/ # Utility scripts
- Node.js >= 20.0.0
- PostgreSQL 12+
- Redis (for OTP storage and rate limiting)
- Clone and Install Dependencies
cd /c/Users/A.Surya/Desktop/fakir
npm install- Setup Environment Variables
# Backend (.env in apps/backend/)
DATABASE_URL=postgresql://user:password@localhost:5432/voting_system
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-secret-key-here
NODE_ENV=development
# Frontend (.env.local in apps/frontend/)
NEXT_PUBLIC_API_URL=http://localhost:4000/api/v1- Setup Database
# Navigate to backend directory
cd apps/backend
# Run migrations
npm run migrate
# Seed test data (optional)
npm run seed- Start Development Servers
Terminal 1 - Backend:
npm run dev:backendTerminal 2 - Frontend:
npm run dev:frontendThe application will be available at:
- Frontend: http://localhost:3000
- Backend: http://localhost:4000
- Register β Provide name, email, mobile, DOB
- Verify Aadhaar β Receive and confirm OTP
- Verify PAN β Enter PAN number
- Verify Face β Upload/capture face image
- Verify Voter ID β Enter Voter ID
- View Elections β Browse eligible elections
- Cast Vote β Select candidate and confirm
- View Results β See election results
- Create Election β Set title, dates, location criteria
- Add Candidates β Add candidate details and photos
- Publish Election β Move from Draft to Published
- Monitor Results β Watch votes come in real-time
- View Analytics β Check voter statistics and trends
- Encryption: AES-256-GCM for PII and vote data
- Authentication: JWT with role-based access control
- Vote Anonymity: Vote records don't contain voter identifiers
- Rate Limiting: 100 requests/minute per IP
- Audit Logging: Complete audit trail of all actions
- One Vote Per Voter: Prevents duplicate voting
- Device Fingerprinting: Flags suspicious voting patterns
voters- Voter profiles with encrypted PIIvoter_verifications- 4-step verification statuselections- Election events and schedulingcandidates- Candidate master dataelection_candidates- Candidates in specific electionsvote_records- Anonymous votes (no voter_id)vote_cast_status- One-vote-per-election enforcementaudit_logs- Complete action historyadmin_users- Admin accounts
-
Color Palette
- Primary: Deep Blue (#1E3A8A)
- Secondary: Indigo (#4F46E5)
- Success: Emerald Green (#10B981)
- Destructive: Red
-
Animations
- Smooth page transitions
- Progress indicators
- Loading spinners
- Fade-in effects
-
Responsive Design
- Mobile-first approach
- Tablet optimized
- Desktop enhanced
# Backend unit tests
npm run test:backend
# Backend property-based tests
npm run test:pbt
# Frontend (coming soon)
npm run test:frontendPOST /api/v1/auth/register- Register new voterGET /api/v1/auth/me- Get current user
POST /api/v1/verify/aadhaar/initiate- Start Aadhaar OTPPOST /api/v1/verify/aadhaar/confirm- Confirm Aadhaar OTPPOST /api/v1/verify/pan- Verify PANPOST /api/v1/verify/face- Verify facePOST /api/v1/verify/voter-id- Verify Voter ID
GET /api/v1/elections- List eligible elections (voter)GET /api/v1/elections/:id- Get election detailsGET /api/v1/results/:id- Get election results
GET /api/v1/admin/dashboard/stats- Dashboard statisticsPOST /api/v1/admin/elections- Create electionGET /api/v1/admin/elections- List all electionsGET /api/v1/admin/voters- List all votersGET /api/v1/admin/results- Get all results
GET /api/v1/votes/eligibility/:electionId- Check voting eligibilityPOST /api/v1/votes/cast- Cast a vote
RegisterForm- Voter registration with validationAadhaarVerificationForm- Aadhaar OTP flowPANVerificationForm- PAN validationFaceVerificationForm- Face image uploadVoterIDVerificationForm- Voter ID validationVerificationProgress- 4-step progress indicatorErrorBoundary- Global error handlingMainHeader- Role-based navigation
apiRequest- Typed API client with authuseAuthStore- Auth state managementuseToast- Toast notificationsErrorBoundary- Error boundary wrapperSkeletons- Loading state components
interface AuthState {
token: string | null;
user: AuthUser | null;
setAuth: (token, user) => void;
clearAuth: () => void;
isAuthenticated: () => boolean;
}- Form Validation: Real-time Zod validation
- API Errors: Typed error responses with retry logic
- Network Errors: Graceful error messages
- Error Boundary: Catches React component errors
- 404 Pages: Custom not-found page
/- Home/landing page/register- Voter registration
/verify/aadhaar- Aadhaar OTP/verify/pan- PAN verification/verify/face- Face eKYC/verify/voter-id- Voter ID verification
/dashboard- Voter dashboard/elections- Browse elections/elections/[id]- Voting interface/elections/[id]/results- Election results
/admin/dashboard- Admin dashboard/admin/elections- Election management/admin/elections/new- Create election/admin/voters- Voter management/admin/results- Results dashboard
/not-found- 404 page/loading- Loading state
- Create page file in
src/app/your-route/page.tsx - Use client components with
'use client'directive - Implement loading and error states
- Add role-based access guards if needed
- Create in
src/components/your-component.tsx - Use TypeScript interfaces for props
- Mark as
'use client'if using hooks - Include error handling and loading states
import { apiRequest } from '@/lib/api';
const data = await apiRequest<ResponseType>('/endpoint', {
method: 'POST',
body: { /* data */ },
requireAuth: true,
});# Kill process on port 3000 (frontend)
lsof -i :3000 | grep LISTEN | awk '{print $2}' | xargs kill -9
# Kill process on port 4000 (backend)
lsof -i :4000 | grep LISTEN | awk '{print $2}' | xargs kill -9# Check PostgreSQL is running
pg_isready -h localhost
# Check Redis is running
redis-cli ping# Clear cache and rebuild
rm -rf .next apps/backend/dist
npm run build:frontend
npm run build:backendnpm run build:frontendnpm run build:backendSet all required environment variables:
DATABASE_URL- PostgreSQL connectionREDIS_URL- Redis connectionJWT_SECRET- Secure secret keyNEXT_PUBLIC_API_URL- Backend API URLNODE_ENV- Set toproduction
- Frontend:
GET http://localhost:3000 - Backend:
GET http://localhost:4000/api/v1/health
- Backend API documentation available in
/apps/backend/src/routes/ - Frontend component storybook (coming soon)
- Test files in
*.test.tsfiles - Requirements mapping in code comments
- Real SMS/Email notifications
- Integration with real UIDAI Aadhaar API
- Integration with NSDL PAN API
- AWS Rekognition for advanced face verification
- Blockchain-based vote recording
- Multi-language support
- Progressive web app (PWA)
- Advanced reporting and analytics
- Biometric authentication
- QR code based voting
Government of India - Election Commission of India
Built with modern security practices and government-grade standards for digital voting in India.
Version: 1.0.0
Last Updated: June 9, 2026
Status: Production Ready