An AI-powered interactive assistant designed to simplify the Indian election process through professional explanations, legal troubleshooting, and integrated Google services.
Built for the PromptWars Solution Challenge 2026 — Challenge Two: Civic Education.
Civic Education — Election Process Simplification
VoterSense acts as an authoritative, conversational guide that breaks down complex electoral processes into digestible explanations for everyday citizens, making democratic participation accessible to all.
The Indian election process involves complex legal frameworks, technical systems (EVMs, VVPATs), and multi-phase timelines that can be challenging for citizens to navigate. When voters encounter issues (such as personation or missing names), they often lack clear guidance on their legal rights or procedural remedies.
VoterSense serves as an informed guide that:
- Context-Aware Interactions: Leverages Google Gemini AI to provide clear, objective responses tailored to user inquiries.
- Statutory Citations: Every troubleshooting scenario includes precise legal references (e.g., Section 49P for tendered votes, Section 135A for booth capturing).
- Process Visualization: An interactive roadmap details the 7 phases of the electoral cycle—from official notification to government formation.
- Authoritative Resources: Integrates Google Maps for locating polling stations and provides direct links to official Election Commission of India (ECI) portals.
- Professional AI Persona: The assistant utilizes a specialized system prompt that enforces non-partisan, factually accurate, and professional communication.
- Resilient Fallback System: In the absence of an API configuration, the application utilizes a keyword-matching engine with a comprehensive knowledge base covering common electoral questions.
- Legal Knowledge Base: All troubleshooting scenarios are grounded in the Representation of the People Act, the IPC, and the Conduct of Elections Rules.
VoterSense is structured as a single-page application with specialized modules for different aspects of civic education:
- Dashboard: High-level statistics and navigation.
- AI Assistant: Conversational interface powered by Gemini.
- Election Roadmap: Procedural timeline with statutory details.
- Troubleshooter: Scenario-based legal guidance.
- Station Locator: Geographical visualization via Google Maps.
- Frontend: React 19, Vite 8
- Design: Vanilla CSS with professional dark-mode aesthetics and Framer Motion animations
- AI Engine: Google Gemini API (gemini-2.0-flash)
- Geospatial: Google Maps JavaScript API
- Testing: Vitest for robust logic verification
- Typography: Google Fonts (Inter, Space Grotesk)
VoterSense operates as a single-page React application that integrates directly with Google Services without requiring a traditional backend.
- User Interaction: Users navigate through an intuitive, dark-themed dashboard to access different modules (Timeline, Chat, Troubleshooter, Polling Locator).
- AI Processing: When a user asks a question, the input is sent to the Gemini API (
gemini-2.0-flash-liteby default). The system uses a strict system prompt to constrain the AI to professional, accurate civic education responses. - Resiliency: If the primary AI model hits a rate limit, the application automatically falls back to alternative models (
gemini-2.0-flash,gemini-1.5-pro), and ultimately to a pre-built static knowledge base if all API calls fail. - Geospatial Features: The Polling Station Locator uses the Google Maps API to render geographical data based on sample datasets, demonstrating real-world usability.
- Node.js 18+ and npm
git clone https://github.com/hnikhil-dev/VoterSense.git
cd VoterSense
npm install
npm run devYou can configure the application in two ways:
- Environment Variables (Recommended): Create a
.envfile in the root directory and add your keys (VITE_GEMINI_API_KEYandVITE_MAPS_API_KEY). - In-App Settings: Alternatively, navigate to the Settings section in the application and enter your keys directly into the browser session.
To scope the project for this hackathon, the following assumptions and design decisions were made:
- Geographical Focus: The assistant is strictly tuned for the Indian electoral system (Lok Sabha, Vidhan Sabha, and local body elections).
- Legal Timeliness: All statutory references (e.g., Conduct of Elections Rules, IPC sections) are based on the legal framework active as of 2024-2025.
- Non-Partisanship: The AI is assumed to safely reject any partisan or candidate-specific inquiries based on its system instruction constraints.
- Data Privacy: It is assumed that users prefer not to have their queries logged. Therefore, all API communication happens directly from the client to Google servers, and API keys are stored only in volatile browser memory or build-time environment variables.
- API Limits: The fallback architecture assumes that free-tier API rate limits may be frequently hit during a hackathon evaluation, necessitating the robust multi-model fallback chain implemented.
VoterSense adheres to a professional, "non-AI generated" look by:
- Avoiding informal emojis and casual language.
- Utilizing professional iconography (Feather Icons).
- Implementing a structured, authoritative tone in all AI responses.
- Ensuring a premium, accessible UI with clear hierarchy and navigation.
- Local Storage: API credentials are stored only within the browser session and are never transmitted to external servers (except for direct Google API calls).
- Direct Integration: Communication with Google services occurs directly from the client's browser.
- Data Minimization: No personal user data is collected or stored.
- Standardized Navigation: Full keyboard support and focus management.
- Semantic HTML: Proper use of ARIA roles and landmarks.
- Responsive Design: Mobile-first architecture with a collapsible sidebar.
- Motion Control: Respects
prefers-reduced-motionsystem settings.
| Criteria | Implementation Detail |
|---|---|
| Code Integrity | Modular React architecture with clean separation of concerns. |
| Security | Browser-local key management and direct API calls. |
| User Experience | Fast, streaming AI responses and interactive visual elements. |
| Testing | 12 unit tests covering fallback logic and data integrity. |
| Google Services | Gemini API, Google Maps API, and Google Fonts integration. |
Developed for the PromptWars Solution Challenge 2026