A web-based election opinion poll for Kerala, India. This is a public survey tool designed to capture voting preferences across various constituencies using a simple, interactive interface.
- Interactive Map: Navigate through Kerala's districts and constituencies using a clickable SVG map.
- Anti-Duplicate Voting: Multi-layered protection to ensure fair polling without requiring user login:
- LocalStorage flags for immediate feedback.
- Device fingerprinting via FingerprintJS.
- IP-based rate limiting using Upstash Redis.
- Live Results: Real-time aggregated vote counts visualized with interactive bar charts (Recharts).
- Responsive Design: Mobile-first UI styled with Tailwind CSS 4 and modern aesthetics.
- Framework: Next.js 16 (App Router)
- Database: PostgreSQL (Supabase) with Prisma 7
- Cache/Rate Limit: Upstash Redis
- Styling: Tailwind CSS 4
- Realtime: Supabase Realtime for live updates.
- Node.js (v18+)
- Supabase account (PostgreSQL + Realtime)
- Upstash account (Redis)
Create a .env.local file in the root directory with the following variables:
DATABASE_URL="postgresql://..."
REDIS_URL="https://..."
REDIS_TOKEN="..."
NEXT_PUBLIC_SUPABASE_URL="https://..."
NEXT_PUBLIC_SUPABASE_ANON_KEY="..."
HASH_SALT="your-random-secret"- Clone the repository.
- Install dependencies:
npm install
- Synchronize the database schema:
npx prisma db push
- Start the development server:
npm run dev
Visit http://localhost:3000 to view the application.
app/: Application routes, layouts, and API endpoints.component/: Reusable UI and visualization components.data/: Geographic data (districts/constituencies) and party information.hooks/: Custom hooks for fingerprinting, polling status, and live results.lib/: Shared utilities for database, cache, and hashing.prisma/: Prisma schema and database configuration.public/: Static assets.
Disclaimer: This is an opinion poll tool and not an official election system.