Real-Time Political Sentiment Intelligence for India
Track, analyze, and forecast political sentiment across all 28 states and 8 union territories
Live Demo Β· Documentation Β· Report Bug Β· Request Feature
VoterPulse is a sophisticated political analytics platform that leverages real-time web intelligence to monitor and forecast political sentiment across India. Built for the 2029 Indian General Elections, it combines the power of Perplexity's Sonar API with interactive visualizations to deliver actionable political insights.
- π΄ Real-Time Data β No stale polls. Live sentiment from news, social media, and public discourse
- πΊοΈ Complete Coverage β All 28 states + 8 union territories with state-specific analysis
- π Visual Intelligence β Interactive maps, charts, and trend visualizations
- β‘ Instant Results β AI-powered analysis in seconds, not days
- πΎ Smart Caching β Optimized API usage with SQLite-backed response caching
The home page provides a powerful search interface for real-time political intelligence.
- Natural language queries β Ask about any party, leader, issue, or region
- Entity extraction β Automatic detection of politicians, parties, states, and topics
- Source citations β Every insight backed by verifiable sources
- Trending topics β Quick access to hot political discussions
Example queries:
- "What is the sentiment towards BJP in Maharashtra?"
- "How is Congress performing in South India?"
- "Public opinion on farm laws in Punjab"
Monitor how political sentiment evolves over time with the Drift page.
- 7-day rolling analysis β Track daily sentiment changes
- Trend visualization β Line charts with positive/negative/neutral breakdown
- Key events timeline β Understand what drove sentiment shifts
- Summary insights β AI-generated analysis of drift patterns
The Map page displays a color-coded political sentiment map of India.
- State-level visualization β Every state colored by ruling party/sentiment
- Click-to-explore β Click any state to see detailed analysis
- Real-time data β Live sentiment scores for each region
- Party-wise breakdown β See BJP, Congress, AAP, and regional party standings
- Full coverage β All states including northeastern states and union territories
Color Legend:
| Color | Party |
|---|---|
| π Orange | BJP |
| π΅ Blue | Congress (INC) |
| π’ Green | Regional/Other |
| π‘ Yellow | AAP |
| π΄ Red | Left Parties |
The Forecast page provides predictive analytics for upcoming elections.
- Seat projections β Estimated seat counts with confidence intervals
- Vote share analysis β Predicted vote percentages by party
- Trend indicators β Up/down momentum for each party
- Confidence levels β High/Medium/Low certainty ratings
- Key battleground states β Focus on decisive regions
Stay informed about critical political developments.
- Breaking news detection β Instant alerts for major events
- Sentiment anomalies β Unusual shifts trigger notifications
- Custom thresholds β Configure sensitivity levels
- Historical log β Review past alerts and their accuracy
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VOTERPULSE ARCHITECTURE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β FRONTEND (Next.js 14) β β
β β β β
β β βββββββββββ βββββββββββ βββββββββββ βββββββββββ β β
β β β Search β β Drift β β Map β βForecast β β β
β β β Page β β Page β β Page β β Page β β β
β β ββββββ¬βββββ ββββββ¬βββββ ββββββ¬βββββ ββββββ¬βββββ β β
β β β β β β β β
β β ββββββββββββββ΄ββββββ¬βββββββ΄βββββββββββββ β β
β β β β β
β βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API LAYER (Route Handlers) β β
β β β β
β β /api/search /api/data/drift /api/data/map β β
β β /api/data/forecast /api/health β β
β β β β
β βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββΌβββββββββββββββββ β
β βΌ βΌ βΌ β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β PERPLEXITY β β PROMPTS β β CACHE β β
β β SONAR API β β ENGINE β β LAYER β β
β β β β β β β β
β β β’ sonar-pro β β β’ Search β β β’ SQLite β β
β β β’ sonar β β β’ Map Data β β β’ Drizzle β β
β β β’ Real-time β β β’ Forecast β β β’ 1hr TTL β β
β β web search β β β’ Drift β β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
User Query β Cache Check β [Cache Hit] β Return Cached Data
β
[Cache Miss]
β
Perplexity API (sonar-pro/sonar)
β
Parse & Validate Response
β
Store in SQLite Cache
β
Return to Frontend
| Category | Technology | Purpose |
|---|---|---|
| Framework | Next.js 14.2 | React framework with App Router |
| Language | TypeScript 5.3 | Type-safe development |
| Styling | Tailwind CSS 3.4 | Utility-first CSS |
| UI Components | Radix UI | Accessible component primitives |
| Charts | Recharts 2.15 | React charting library |
| Animations | Framer Motion 12 | Production-ready animations |
| Icons | Lucide React | Beautiful SVG icons |
| Database | SQLite + Drizzle ORM | Local caching layer |
| AI/Search | Perplexity Sonar API | Real-time web intelligence |
| Map | Custom SVG | Interactive India map |
- Node.js 18.17 or later
- npm, pnpm, or yarn
- Perplexity API Key (Get one here)
-
Clone the repository
git clone https://github.com/yourusername/VoterPulse.git cd VoterPulse -
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env.local
Edit
.env.local:# Required PERPLEXITY_API_KEY=pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Optional (for future features) GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
Initialize the database
npm run db:generate
-
Start the development server
npm run dev
-
Open in browser
Navigate to http://localhost:3000
VoterPulse/
βββ src/
β βββ app/ # Next.js App Router
β β βββ page.tsx # Home - Search page
β β βββ layout.tsx # Root layout with navigation
β β βββ globals.css # Global styles
β β βββ drift/
β β β βββ page.tsx # Sentiment drift tracker
β β βββ map/
β β β βββ page.tsx # Interactive India map
β β βββ forecast/
β β β βββ page.tsx # Election forecasting
β β βββ alerts/
β β β βββ page.tsx # Alert notifications
β β βββ api/
β β βββ search/
β β β βββ route.ts # Search endpoint
β β βββ data/
β β β βββ map/route.ts # Map data endpoint
β β β βββ forecast/route.ts # Forecast endpoint
β β β βββ drift/route.ts # Drift data endpoint
β β βββ health/
β β βββ route.ts # Health check
β β
β βββ components/
β β βββ ui/ # Reusable UI components
β β β βββ button.tsx
β β β βββ card.tsx
β β β βββ input.tsx
β β β βββ ...
β β βββ layout/
β β βββ navigation.tsx # Main navigation
β β
β βββ lib/
β βββ perplexity/
β β βββ client.ts # Perplexity API client
β β βββ prompts.ts # System prompts for each feature
β βββ db/
β β βββ schema.ts # Drizzle schema
β β βββ client.ts # Database client
β βββ utils.ts # Utility functions
β
βββ public/
β βββ india-states.svg # SVG map of India
β
βββ drizzle/ # Database migrations
βββ .env.example # Environment template
βββ VoterPulse-ProjectPlan.md # Original project specification
βββ tailwind.config.ts # Tailwind configuration
βββ next.config.mjs # Next.js configuration
βββ package.json # Dependencies & scripts
Search for political sentiment and information.
Request:
{
"query": "BJP sentiment in Gujarat"
}Response:
{
"answer": "BJP enjoys strong support in Gujarat...",
"citations": ["https://source1.com", "https://source2.com"],
"entities": {
"politicians": ["Narendra Modi", "Bhupendra Patel"],
"parties": ["BJP"],
"states": ["Gujarat"],
"topics": ["governance", "development"]
}
}Get sentiment data for all Indian states.
Response:
{
"states": [
{
"code": "IN-MH",
"name": "Maharashtra",
"sentiment": 62,
"trend": "up",
"rulingParty": "Mahayuti (BJP+)",
"chiefMinister": "Devendra Fadnavis",
"keyIssues": ["Infrastructure", "Farmers"]
}
// ... all 36 states/UTs
],
"nationalSentiment": 58,
"lastUpdated": "2026-01-20T12:00:00Z"
}Get election forecasting data.
Response:
{
"projections": [
{
"party": "BJP",
"seats": { "low": 280, "mid": 310, "high": 340 },
"voteShare": 38.5,
"trend": "stable",
"confidence": "high"
}
// ... other parties
],
"battlegroundStates": ["Maharashtra", "UP", "West Bengal"],
"lastUpdated": "2026-01-20T12:00:00Z"
}Get 7-day sentiment drift for a topic.
Response:
{
"topic": "BJP",
"dailyData": [
{ "date": "2026-01-14", "positive": 45, "negative": 30, "neutral": 25 }
// ... 7 days
],
"overallTrend": "improving",
"keyEvents": [
{ "date": "2026-01-16", "event": "PM announces new policy", "impact": "positive" }
],
"summary": "Sentiment has improved by 5% over the week..."
}| Variable | Required | Description |
|---|---|---|
PERPLEXITY_API_KEY |
β Yes | Your Perplexity API key for Sonar |
GROQ_API_KEY |
β No | Groq API key (reserved for future use) |
| Command | Description |
|---|---|
npm run dev |
Start development server on port 3000 |
npm run build |
Build for production |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npm run db:generate |
Generate Drizzle migrations |
npm run test |
Run tests (when configured) |
VoterPulse follows a data-forward, insight-driven design inspired by modern analytics platforms:
- Clarity over complexity β Clean interfaces that surface insights, not noise
- Real-time authenticity β Fresh data beats cached assumptions
- Visual storytelling β Charts and maps that tell the political story at a glance
- Mobile-first responsive β Works seamlessly on any device
- Accessible design β WCAG-compliant components via Radix UI
VoterPulse provides complete coverage of India:
Major States: Maharashtra, Uttar Pradesh, Bihar, West Bengal, Madhya Pradesh, Tamil Nadu, Rajasthan, Karnataka, Gujarat, Andhra Pradesh, Odisha, Telangana, Kerala, Punjab, Haryana, Jharkhand, Chhattisgarh, Assam
Northeastern States: Arunachal Pradesh, Nagaland, Manipur, Mizoram, Tripura, Meghalaya, Sikkim
Union Territories: Delhi, Jammu & Kashmir, Ladakh, Chandigarh, Puducherry, Goa, Himachal Pradesh, Uttarakhand
| Phase | Feature | Status |
|---|---|---|
| v1.0 | Core search, map, forecast, drift | β Complete |
| v1.1 | Enhanced alerts system | π In Progress |
| v1.2 | Historical data comparison | β¬ Planned |
| v1.3 | Constituency-level analysis | β¬ Planned |
| v1.4 | Social media sentiment integration | β¬ Planned |
| v2.0 | What-if scenario simulator | β¬ Planned |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please ensure your code follows the existing style and includes appropriate tests.
This project is licensed under the MIT License β see the LICENSE file for details.
- Radix UI β For accessible, unstyled component primitives
- Recharts β For beautiful React charting
- Tailwind CSS β For rapid UI development
- India SVG Map β Based on simplemaps.com data
Built with β€οΈ for Indian Democracy
Empowering citizens with political intelligence