The clock was ticking. The PromptWars Virtual Challenge 2 was in full swing, and
the stakes couldn't be higher. With over 4 million submissions expected, the
math was brutal: to rank in the top 400, you have to be in the top 0.01%.
"Good enough" was not going to cut it. I didn't just need a functional app; I
needed a masterpiece of innovation, execution, and social impact. Most
importantly, I needed to build it fast.
Here is the story of how I built VoteIQ—a production-ready, multi-lingual,
AI-powered Election Education Assistant—and equipped it with a
"Self-Improvement" engine that lets it evolve while I sleep. 🚀
- The Challenge: Standing Out in a Sea of Millions 🌊
The PromptWars challenge is a testament to the power of generative AI. Organized
by Google for Developers and Hack2skill, it tasks builders with creating
impactful solutions using the Gemini API.
The deadline: May 3rd, 2026. The competition: 4 million people. The goal:
Top 400.
When you are competing against 4 million people, your choice of problem matters
as much as your code. I chose Election Education. In a world of deepfakes and
misinformation, providing citizens with a clear, gamified, and accessible way to
understand the voting process is a high-impact mission. But to win, the
technical execution had to be flawless.
- The Strategy: Building the "Evolution Machine" 🧠
Most developers treat AI as a glorified autocomplete. They ask for a component,
copy-paste it, and move on. My strategy was different: I wanted the AI to be the
Architect, the Developer, and the QA Engineer.
To hit that top 0.01% bracket, I focused on three pillars:
- Accessibility at Scale: If a rural voter in India can’t use the app in their local language via voice, the app has failed.
- Gamified Education: People hate reading manuals but love playing games. I turned the election process into a simulator.
- The Self-Improving Loop: I built a CI/CD pipeline where Gemini audits the code every few hours, identifies UX friction points, and suggests (or commits) improvements.
This isn't just an app; it's a living software organism.
- The Tech Stack: Performance Meets Intelligence 🛠️
For a 1-hour build, there is no room for configuration hell. I chose a stack
optimized for speed and Vercel’s edge network:
- Next.js 14 (App Router): For Server Components, SEO, and lightning-fast routing.
- TypeScript: Because in a competition this big, a single undefined error can kill your ranking.
- Tailwind CSS: For that "Apple-meets-Election" aesthetic (Glassmorphism + Indian election colors).
- Gemini 1.5 Pro: The heavy lifter for real-time chat, profile analysis, and code auditing.
- Framer Motion: For those high-end, "premium" feeling animations.
- Lucide React: For consistent, beautiful iconography.
- Core Features: Beyond the Basics ⚡
🎙️ AI Voice Chatbot
Using the Web Speech API, VoteIQ allows users to speak directly to the AI.
Whether you ask in English or Hindi, the Gemini-powered brain responds with
accurate, non-partisan election data. It’s not just a chat; it’s a conversation.
👤 Personalized Voter Profile
Instead of a wall of text, users take a 10-question interactive quiz. Gemini
analyzes these responses to generate a "Voter Persona"—helping users identify
what issues they care about most and providing a custom checklist for election
day.
🗺️ Interactive Election Timeline
I used Framer Motion to build a vertical, animated progress tracker. As users
scroll, they see the journey from registration to the polling booth, complete
with "Where am I?" tracking.
🎮 Gamified Learning
The "Election IQ Quiz" features progressive difficulty levels. But the standout
is the Election Simulator, where users play as a candidate, making budget and
policy decisions to see how they impact "Public Trust" and "Support" metrics.
🌐 Multi-Language & PWA
Democracy is for everyone. VoteIQ supports English, Hindi, Tamil, and Telugu.
Furthermore, it’s a Progressive Web App (PWA), meaning voters in
low-connectivity areas can install it on their home screens and access cached
educational content offline.
- The Secret Weapon: Auto-Improvement 🤖
This is the feature that I believe puts VoteIQ in the top 400. I didn't just
write the code; I wrote a Self-Improvement script that runs via GitHub Actions.
How it works:
Every 8 hours, a GitHub Action triggers a Node.js script. This script reads the
core components of the app and sends them to Gemini with a specific prompt:
"Identify one UI improvement for accessibility and one performance bottleneck in
this code."
The AI then generates a patch. While I'm sleeping, the app is literally getting
better.
The GitHub Workflow (.github/workflows/auto-improve.yml):
name: AI Self-Improvement
on:
schedule:
- cron: '0 */8 * * *' # Runs every 8 hours
workflow_dispatch:
jobs:
improve:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- run: npm install
- name: Run AI Auditor
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: node .github/scripts/improve.js
- name: Commit Improvements
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "AI: Automated UI/UX Enhancement"
The Improvement Script (.github/scripts/improve.js):
const { GoogleGenerativeAI } = require("@google/generative-ai");
const fs = require("fs");
const path = require("path");
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
async function improveComponent(fileName) {
const model = genAI.getGenerativeModel({ model: "gemini-pro" });
const filePath = path.join(process.cwd(), fileName);
const code = fs.readFileSync(filePath, "utf8");
const prompt = You are a Senior Frontend Engineer. Analyze this Next.js component for accessibility (ARIA labels) and visual polish. Return ONLY the improved code. File: ${fileName}\n\nCode:\n${code};
const result = await model.generateContent(prompt);
const improvedCode = result.response.text();
// Basic validation to ensure we don't commit empty files
if (improvedCode.length > code.length * 0.5) {
fs.writeFileSync(filePath, improvedCode);
console.log(Successfully improved ${fileName});
}
}
improveComponent("components/VoiceChatbot.tsx");
- Building with AI: The Prompting Strategy 🎯
To build this in an hour, I couldn't afford a "back-and-forth" with the AI. I
used a Master System Prompt.
Instead of asking "Build me a navbar," I provided the full context:
"You are an expert full-stack developer competing in PromptWars. Build a
Next.js 14 navbar with Tailwind CSS. It must include a language toggle (EN, HI,
TA, TE), a dark mode toggle, and use Framer Motion for hover effects. Ensure
full TypeScript types and mobile responsiveness."
By providing the Role, Context, Constraints, and Technical Stack in a single
prompt, I reduced the iteration time by 90%.
- Deployment Journey: Edge-Ready 🚀
Deploying on Vercel was the final piece of the puzzle. With the next.config.js
optimized and PWA manifests in place, the deployment took less than 2 minutes.
- Environment Variables: I secured the GEMINI_API_KEY in Vercel's dashboard.
- Edge Runtime: For the Chat API route, I used the Edge runtime to ensure low latency for voice responses.
Analytics: I enabled Vercel Speed Insights to monitor the "Real Experience
Score," ensuring the app stays fast as it evolves.Results & Learnings: The Power of 1 Hour ⏱️
What surprised me most wasn't that I could build an app in an hour—it was the
depth of the app.
- Speed: AI scaffolding allowed me to spend 45 minutes on "Hard Logic" (like the Voice API) and only 15 minutes on "UI/UX."
- Quality: The Gemini-generated TypeScript interfaces were cleaner than what I would have written under pressure.
- Automation: Seeing the first "AI: Automated UI/UX Enhancement" commit hit my GitHub repository was a moment of pure magic.
- Impact & Future: Democracy 2.0 🗳️
VoteIQ isn't just a hackathon project. It’s a blueprint for how we can use AI to
bridge the gap between complex government processes and the everyday citizen. By
making the election process transparent, gamified, and voice-accessible, we can
increase voter turnout and reduce the power of misinformation.
The next step? Integrating a RAG (Retrieval-Augmented Generation) system to pull
in live candidate affidavits directly from official government PDFs.
- Try It Yourself 🔗
The revolution won't be televised; it will be coded.
Live Demo: https://election-assistant-xi.vercel.app/
Source Code: https://github.com/Majenayu/election-assistant
If you're competing in PromptWars or any AI challenge, remember: Don't just
build an app. Build a system that builds a better app.
Good luck to all 4 million participants. See you in the Top 400! 🏆
Top comments (0)