Skip to content

palakgoda/matdata-mitra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—ณ๏ธ Matdata Mitra โ€” เคฎเคคเคฆเคพเคคเคพ เคฎเคฟเคคเฅเคฐ

India's Most Inclusive Election Education Assistant

Built for Virtual Prompt War Challenge 2

Made with Gemini Firebase Cloud Run Node.js License: MIT


Matdata Mitra Banner


๐Ÿ‡ฎ๐Ÿ‡ณ The Problem

India has 96 crore+ registered voters โ€” but existing election tools fail most of them.

Who gets left behind Why
๐Ÿ‘ด Senior citizens (60+) No smartphone, Hindi needed, large text required
๐Ÿง‘ First-time voters (18-21) Lowest turnout nationally โ€” feel embarrassed to ask
โ™ฟ 8.6 crore PwD voters Saksham app barely anyone knows exists
๐ŸŒ Non-Hindi/English speakers ECI website mostly in two languages
๐Ÿ“ต Rural voters 45% of India has limited internet

Most election apps assume everyone is the same type of voter. India's voters are NOT.


๐Ÿ’ก The Solution

Matdata Mitra (Voter's Friend) โ€” one app, two complete experiences:

๐Ÿง‘ Young Voter Mode

For first-time voters aged 18-35 with smartphones.

  • ๐Ÿ’ฌ AI Chat โ€” Ask anything about elections in your language (Google Gemini)
  • ๐Ÿง  Gamified Quiz โ€” 8 questions, XP points, badge unlocks
  • ๐Ÿ“ Polling Booth Finder โ€” GPS-based using free OpenStreetMap
  • โœ… EVM Fact Checker โ€” Bust myths with verified ECI data
  • ๐Ÿ“… Election Timeline โ€” 8 step-by-step voting guide
  • ๐Ÿ—ณ๏ธ Impact Calculator โ€” See how close elections have been in your constituency
  • ๐ŸŒŸ Share Card โ€” Generate your "I'm Voting!" card

๐Ÿ‘ด Elder-Friendly Mode

For senior citizens, differently-abled voters, and first-time computer users.

  • ๐Ÿ”Š Voice Navigation โ€” Full TTS reads every section aloud
  • ๐ŸŽค Voice Input โ€” Ask questions by speaking (no typing needed)
  • ๐Ÿ“ Hindi First โ€” All content in Hindi with English below
  • ๐Ÿ–ผ๏ธ Giant Buttons โ€” Minimum 72px height, impossible to miss
  • ๐Ÿ–จ๏ธ Printable Voter Guide โ€” Personalised guide for election day
  • ๐Ÿ“ž Emergency Helpline โ€” One-tap 1950 button always visible
  • ๐Ÿ›๏ธ CSC Locator โ€” Find nearest Common Service Centre

๐Ÿ”ด Real Problems We Solve

โŒ Existing problem          โœ… Our solution
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Voter Helpline 1950          โ†’ AI chat (no wait time)
  has long wait times

ECI website confusing UI     โ†’ Simple step-by-step guide
                               in user's language

EVMs "rigged" WhatsApp       โ†’ Gemini-powered fact checker
  misinformation               with ECI verified data

Elderly can't find booth     โ†’ GPS + pincode booth finder
                               + printable guide

No internet on election day  โ†’ Printable voter kit
                               with all details

PwD voters don't know        โ†’ Dedicated elder mode
  their rights                 + postal ballot info

22 official languages        โ†’ Google Translate widget
  underserved                  + 10 Indian languages

๐Ÿ› ๏ธ Tech Stack

Google Services (Judges Criteria)

Service Usage
Google Gemini 2.0 Flash AI chat, fact checking, quiz generation
Firebase Authentication Google Sign-In
Firebase Firestore User progress, chat history, XP sync
Firebase Analytics Track learning behavior
Google Translate Widget 10 Indian languages
Google Cloud Run Deployment and hosting
Web Speech API Voice input + Text-to-Speech (browser built-in)

Free Map Stack (Zero Cost)

Service Usage
Leaflet.js Interactive map display
OpenStreetMap Free map tiles
Nominatim Pincode โ†’ GPS coordinates
Overpass API Find nearby govt buildings
OSRM Route directions

Backend

  • Node.js + Express โ€” Secure API proxy
  • Helmet โ€” Security headers
  • express-rate-limit โ€” Abuse prevention
  • dotenv โ€” Environment variable management

๐Ÿ” Security Architecture

BEFORE (insecure):
Browser โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Gemini API
        (API key visible in DevTools)

AFTER (secure):
Browser โ”€โ”€โ–บ server.js โ”€โ”€โ–บ Gemini API
            (API key        (key never
             server-only)    reaches browser)
  • โœ… Zero API keys in client-side code
  • โœ… All secrets in environment variables
  • โœ… Server-side input sanitization (second layer)
  • โœ… Rate limiting on all /api/* endpoints
  • โœ… Helmet security headers
  • โœ… .env blocked by .gitignore

๐Ÿ“ Project Structure

matdata-mitra/
โ”œโ”€โ”€ server.js               โ† Express server (security backbone)
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ Dockerfile              โ† Google Cloud Run deployment
โ”œโ”€โ”€ .env                    โ† secrets (never committed)
โ”œโ”€โ”€ .env.example            โ† template for setup
โ”œโ”€โ”€ .gitignore
โ”‚
โ”œโ”€โ”€ index.html              โ† Landing page (persona selector)
โ”œโ”€โ”€ young-voter.html        โ† First-time voter experience
โ”œโ”€โ”€ elder-voter.html        โ† Elder + accessible experience
โ”‚
โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ main.css            โ† Shared foundation styles
โ”‚   โ”œโ”€โ”€ young.css           โ† Modern gamified theme
โ”‚   โ””โ”€โ”€ elder.css           โ† Large text, high contrast theme
โ”‚
โ””โ”€โ”€ js/
    โ”œโ”€โ”€ app.js              โ† Core logic, quiz, TTS, voice
    โ”œโ”€โ”€ gemini.js           โ† AI client (calls /api/*)
    โ”œโ”€โ”€ firebase.js         โ† Auth + Firestore + Analytics
    โ””โ”€โ”€ maps.js             โ† Leaflet + free map services

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • Google AI Studio account (free Gemini API key)
  • Firebase project (free Spark plan)

1. Clone the repository

git clone https://github.com/yourusername/matdata-mitra.git
cd matdata-mitra

2. Install dependencies

npm install

3. Set up environment variables

cp .env.example .env

Edit .env with your real values:

GEMINI_API_KEY=your_gemini_key_from_aistudio
FIREBASE_API_KEY=your_firebase_api_key
FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_STORAGE_BUCKET=your_project.appspot.com
FIREBASE_MESSAGING_SENDER_ID=your_sender_id
FIREBASE_APP_ID=your_app_id
FIREBASE_MEASUREMENT_ID=G-your_measurement_id
PORT=8080
NODE_ENV=development

4. Get your API keys

Gemini API Key (Free): โ†’ aistudio.google.com โ†’ Get API Key โ†’ Create API Key

Firebase Config: โ†’ console.firebase.google.com โ†’ Add project โ†’ Authentication โ†’ Enable Google Sign-In โ†’ Firestore โ†’ Create database (test mode) โ†’ Project Settings โ†’ Your Apps โ†’ Web App โ†’ Copy config

5. Run locally

npm run dev

Open http://localhost:8080 ๐ŸŽ‰

6. Test the API

# Health check
curl http://localhost:8080/api/health

# Should return:
# {"status":"healthy","gemini":true,"firebase":true,...}

โ˜๏ธ Deploy to Google Cloud Run

# Build and push Docker image
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/matdata-mitra

# Deploy to Cloud Run
gcloud run deploy matdata-mitra \
  --image gcr.io/YOUR_PROJECT_ID/matdata-mitra \
  --platform managed \
  --region asia-south1 \
  --allow-unauthenticated \
  --set-env-vars GEMINI_API_KEY=your_key,\
                 FIREBASE_PROJECT_ID=your_project,\
                 NODE_ENV=production

โ™ฟ Accessibility Features

Feature Implementation
Skip navigation link Keyboard users jump to main content
ARIA labels Every interactive element labelled
High contrast mode WCAG AAA compliant
Large font mode 100% โ†’ 160% adjustable
Screen reader support All sections have role + aria-labelledby
Keyboard navigation Full tab order, focus-visible rings
Reduced motion Respects OS prefers-reduced-motion
Voice navigation Full TTS for elder mode
Voice input Speech recognition for all inputs
Print styles Voter guide printable without internet
Minimum touch targets 48ร—48px (elder buttons: 72px+)

๐ŸŒ Supported Languages

เคนเคฟเค‚เคฆเฅ€ ยท English ยท เฆฌเฆพเฆ‚เฆฒเฆพ ยท เฐคเฑ†เฐฒเฑเฐ—เฑ ยท เคฎเคฐเคพเค เฅ€ ยท เฎคเฎฎเฎฟเฎดเฏ ยท เช—เซเชœเชฐเชพเชคเซ€ ยท เฒ•เฒจเณเฒจเฒก ยท เจชเฉฐเจœเจพเจฌเฉ€ ยท เดฎเดฒเดฏเดพเดณเด‚


๐Ÿ“Š Judging Criteria Coverage

Criteria Implementation
Code Quality Modular JS, JSDoc, 'use strict', consistent naming
Security Server-side keys, Helmet, rate limiting, input sanitization, XSS prevention
Efficiency Lazy loading, debounced handlers, capped history, free APIs
Testing Pure functions, error boundaries, graceful degradation
Accessibility ARIA, skip links, voice, contrast, large text, print, reduced motion
Google Services Gemini + Firebase Auth + Firestore + Analytics + Translate + Cloud Run

๐Ÿ™ Important Contacts (Built Into the App)

๐Ÿ“ž Voter Helpline: 1950 (Toll-free, 24/7)
๐ŸŒ ECI Website: eci.gov.in
๐Ÿ—ณ๏ธ Voter Registration: voters.eci.gov.in
๐Ÿ“ Booth Search: electoralsearch.eci.gov.in
โ™ฟ PwD Assistance: saksham.eci.gov.in
๐Ÿ“ธ Report Violations: cVIGIL App
๐Ÿ›๏ธ CSC Locator: locator.csccloud.in

๐Ÿ“„ License

MIT ยฉ 2025 Matdata Mitra


โš ๏ธ Disclaimer

This is an educational tool built for a hackathon challenge. For official election information, always visit eci.gov.in or call the Voter Helpline at 1950.


Built with โค๏ธ for Indian Democracy

Jai Hind ๐Ÿ‡ฎ๐Ÿ‡ณ

Virtual Prompt War

About

๐Ÿ—ณ๏ธ Matdata Mitra (เคฎเคคเคฆเคพเคคเคพ เคฎเคฟเคคเฅเคฐ) โ€” India's most inclusive election education assistant. AI-powered Q&A, polling booth finder, gamified quiz & elder-friendly voice mode. Built with Google Gemini, Firebase & Cloud Run. Virtual Prompt War Challenge 2.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors