An interactive, gamified platform to teach election processes, timelines, and civic engagement through gameplay. Transform voters into election strategists.
Tech Stack: Next.js 15+ | FastAPI | PostgreSQL | Google Cloud Run
Most election resources are dry, static, and forgettable. VoteQuest gamifies the learning experience โ users progress through levels as virtual campaign managers, earning points and badges while mastering real election processes.
- Interactive โ Drag-and-drop, puzzle-based learning
- Personalized โ State-specific rules embedded in gameplay
- Engaging โ Points, badges, leaderboards, time pressure
- Educational โ Master real deadlines, requirements, logistics
- Shareable โ Compete with friends, viral potential
- Mobile-First โ Works on any device
- Frontend: https://willowy-pie-72be93.netlify.app/
- Backend API: https://votequest-api-393608700696.us-central1.run.app
- Mechanics: Drag voter profiles to correct registration centers
- Duration: 3-minute timer
- Challenge: 8/10 voters must be registered correctly
- State Rules: ID requirements, eligibility checks vary by state
- Scoring: Base 100 + time bonus + accuracy multiplier
- Learning Outcome: Understand registration deadlines and requirements
- Resource management (budget, volunteers, time)
- Navigate state-specific voting rules
- Boss battle: Debate opponent with election trivia
- Early voting mechanics puzzle
- Polling place logistics challenges
- Day-of problem-solving scenarios
- Results calculation mechanics
- Vote counting process simulation
- Final scoring and achievements
| Feature | Implementation |
|---|---|
| Points System | +100 base per level, +time bonus, +accuracy multiplier |
| Achievements | 6 badges: "First Vote", "Early Bird", "Accessibility Champion", "On Fire", "All States Master", "Speed Racer" |
| Leaderboard | Global top 10, weekly rankings, state-by-state competition |
| Progression | 4 levels, unlock new content, save game state |
| Streaks | Consecutive level completions = bonus multiplier |
| Narrative | Unique storyline for each state (political lore) |
| Time Pressure | Countdown timers simulate real deadline urgency |
| Consequences | Wrong choices = time/point penalties (teaches real impact) |
- ๐ "First Vote" โ Complete Level 1
- โฐ "Early Bird" โ Register 30+ days early
- ๐ฅ "Accessibility Champion" โ Help all voters with accessibility needs
- ๐ฅ "On Fire" โ 5-level streak without mistakes
- ๐ "All States Master" โ Complete levels in all 50 states
- โก "Speed Racer" โ Complete level in under 2 minutes
Framework: Next.js 15+ (React 18+)
Language: TypeScript
Styling: Tailwind CSS + Framer Motion
State Management: Zustand (game state) + React Query (server state)
Game Mechanics: Konva.js (drag-and-drop), react-beautiful-dnd
Testing: Vitest + React Testing Library
Deployment: Netlify
Framework: FastAPI (Python 3.10+)
Database: PostgreSQL + SQLAlchemy ORM
Authentication: JWT (stateless) with OAuth2PasswordRequestForm
Validation: Pydantic
Testing: pytest
Deployment: Google Cloud Run
Primary: PostgreSQL
ORM: SQLAlchemy
Migrations: Alembic
votequest/
โ
โโโ frontend/ # Next.js App
โ โโโ next.config.js
โ โโโ tsconfig.json
โ โโโ tailwind.config.js
โ โโโ package.json
โ โโโ public/
โ โ โโโ assets/
โ โ โโโ flags/ # State flags
โ โ โโโ avatars/ # Voter avatars
โ โ โโโ icons/ # UI icons
โ โ
โ โโโ src/
โ โโโ app/
โ โ โโโ layout.tsx # Root layout
โ โ โโโ page.tsx # Homepage
โ โ โโโ auth/
โ โ โ โโโ login/page.tsx
โ โ โ โโโ signup/page.tsx
โ โ โโโ game/
โ โ โ โโโ page.tsx # Game hub
โ โ โ โโโ level/[id]/page.tsx
โ โ โ โโโ results/page.tsx
โ โ โโโ leaderboard/page.tsx
โ โ โโโ profile/page.tsx
โ โ โโโ about/page.tsx
โ โ
โ โโโ components/
โ โ โโโ Game/
โ โ โ โโโ GameContainer.tsx
โ โ โ โโโ LevelSelector.tsx
โ โ โ โโโ Level1_Registration.tsx
โ โ โ โโโ Level2_Campaign.tsx
โ โ โ โโโ Level3_GOTV.tsx
โ โ โ โโโ Level4_Results.tsx
โ โ โโโ UI/
โ โ โ โโโ PointsDisplay.tsx
โ โ โ โโโ ProgressBar.tsx
โ โ โ โโโ TimerWidget.tsx
โ โ โ โโโ AchievementPopup.tsx
โ โ โ โโโ Button.tsx
โ โ โ โโโ Card.tsx
โ โ โ โโโ Modal.tsx
โ โ โโโ Leaderboard/
โ โ โ โโโ LeaderboardTable.tsx
โ โ โ โโโ StateRanking.tsx
โ โ โโโ Layout/
โ โ โโโ Header.tsx
โ โ โโโ Sidebar.tsx
โ โ
โ โโโ hooks/
โ โ โโโ useGameState.ts
โ โ โโโ useTimer.ts
โ โ โโโ usePoints.ts
โ โ โโโ useLeaderboard.ts
โ โ โโโ useAchievements.ts
โ โ
โ โโโ store/
โ โ โโโ gameStore.ts # Zustand store
โ โ
โ โโโ lib/
โ โ โโโ api.ts # API client
โ โ โโโ utils.ts # Helper functions
โ โ
โ โโโ types/
โ โ โโโ index.ts # TypeScript interfaces
โ โ
โ โโโ styles/
โ โโโ globals.css
โ
โโโ backend/ # FastAPI App
โ โโโ main.py
โ โโโ requirements.txt
โ โโโ .env.example
โ โ
โ โโโ app/
โ โ โโโ main.py
โ โ โโโ config.py
โ โ โโโ database.py
โ โ โโโ api/
โ โ โ โโโ auth.py
โ โ โ โโโ game.py
โ โ โ โโโ leaderboard.py
โ โ โ โโโ states.py
โ โ โโโ models/
โ โ โ โโโ user.py
โ โ โ โโโ game.py
โ โ โ โโโ score.py
โ โ โ โโโ achievement.py
โ โ โโโ schemas/
โ โ โโโ utils/
โ โ โ โโโ scoring.py
โ โ โ โโโ validation.py
โ โ โ โโโ auth.py
โ โ โโโ crud/
โ โ
โ โโโ migrations/
โ โโโ tests/
โ โ โโโ test_auth.py
โ โ โโโ test_game.py
โ โ โโโ test_scoring.py
โ โ โโโ conftest.py
โ โ
โ โโโ data/
โ โโโ election_data.json # Seed data for all 50 states
โ
โโโ docker-compose.yml
โโโ .gitignore
โโโ README.md
- id (PK)
- username (UNIQUE, VARCHAR)
- email_hash (VARCHAR)
- password_hash (VARCHAR)
- state (CHAR(2), Foreign Key)
- total_score (INT, default 0)
- created_at (TIMESTAMP)
- updated_at (TIMESTAMP)- id (PK)
- user_id (FK -> users)
- state (CHAR(2))
- current_level (INT)
- progress_json (JSONB)
- started_at (TIMESTAMP)
- completed_at (TIMESTAMP, nullable)- id (PK)
- user_id (FK -> users)
- level (INT)
- points (INT)
- accuracy (FLOAT)
- time_taken (INT, seconds)
- timestamp (TIMESTAMP)- id (PK)
- user_id (FK -> users)
- badge_name (VARCHAR)
- unlocked_at (TIMESTAMP)- id (PK)
- state_code (CHAR(2), UNIQUE)
- state_name (VARCHAR)
- registration_deadline (DATE)
- early_voting_start (DATE)
- early_voting_end (DATE)
- election_day (DATE)
- polling_info (JSONB)
- id_requirements (JSONB)
- accessibility_rules (JSONB)def calculate_score(
base_points: int = 100,
time_taken: int, # seconds
correct_answers: int,
total_answers: int,
accessibility_bonus: bool = False
) -> int:
# Time bonus: Up to +100 points for finishing under 3 minutes
time_bonus = max(0, (300 - time_taken) / 3)
# Accuracy multiplier (0 to 1)
accuracy_multiplier = correct_answers / total_answers
# Base calculation
score = (base_points * accuracy_multiplier) + time_bonus
# Accessibility bonus: +50 points for inclusive gameplay
if accessibility_bonus:
score += 50
return int(score)| Scenario | Base | Time Bonus | Accuracy | Accessibility | Total |
|---|---|---|---|---|---|
| Perfect run (2:30) | 100 | +23.3 | ร1.0 | +50 | 173 |
| Good run (3:00) | 100 | +0 | ร0.9 | - | 90 |
| Moderate run (3:30) | 100 | -10 | ร0.8 | - | 70 |
- Initialize Next.js with TypeScript
- Configure Tailwind CSS + Prettier + ESLint
- Setup Zustand store structure
- Initialize FastAPI project with SQLAlchemy + PostgreSQL
- Configure JWT authentication with automatic table creation
- Seed election data (50 states)
- Implement
/api/game/startendpoint - Build scoring calculation engine
- Implement achievement checking and leaderboard queries
- Build GameContainer and all four Level components
- Implement drag-and-drop mechanics, timer, and results screen
- Full TypeScript type coverage across all React components
- Points calculation and achievement unlock logic
- Global and state-by-state leaderboard API
- Leaderboard UI components
- Badge display system
- Game state save/load to database
- Home/splash page, auth pages, level gameplay pages, results screen
- Reusable component library
- Game hub page, leaderboard page, profile/stats page
- Dark mode, level transition animations, toast notifications
- All 50 states populated with real election data
- State-specific rule engine
- Voter profile generator, election trivia database
- Unit + integration tests (backend: pytest, frontend: Vitest)
- E2E tests with Playwright
- CI/CD pipeline
| Milestone | Status |
|---|---|
| Level 1 fully playable | โ Done |
| Level 2โ4 component structure | โ Done |
| User authentication | โ Done |
| Scoring system | โ Done |
| Full TypeScript coverage | โ Done |
| All 50 states with election data | โ Done |
| Frontend deployed | โ Live |
| Backend deployed | โ Live |
| Leaderboard UI | โณ Pending |
| Achievement badge display | โณ Pending |
| Mobile responsiveness testing | โณ Pending |
| Test suite (>80% coverage) | โณ Pending |
POST /api/auth/register
POST /api/auth/login
POST /api/auth/logout
GET /api/auth/me
POST /api/game/start
GET /api/game/session/{id}
POST /api/game/level/{level}/submit
POST /api/game/level/{level}/action
GET /api/game/history
GET /api/leaderboard
GET /api/leaderboard/weekly
GET /api/leaderboard/state/{state}
GET /api/achievements
GET /api/stats
GET /api/states
GET /api/states/{state}
GET /api/voters/generate
GET /api/election-facts
NEXT_PUBLIC_API_URL=http://localhost:8000
DATABASE_URL=postgresql://votequest_user:password123@localhost:5432/votequest_db
SECRET_KEY=your-secret-key-min-32-chars-change-in-production
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440
CORS_ORIGINS=["http://localhost:3000"]
ENVIRONMENT=development
DEBUG=true
User lands on / โ Splash page
โ clicks "Start Playing"
/auth/signup โ Creates account (username, email, password, state)
โ auto-login
/game โ Game Hub
โ selects state + clicks "Play Level"
/game/level/1 โ Level 1: Voter Registration Challenge
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ PLAYING: drag voter cards โ registration zones โ
โ โ Timer counts down from 3:00 โ
โ โ Feedback: โ green / โ red per placement โ
โ โ Submit early after 8+ placements OR wait for timer โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ level complete
/game/results โ Score tier (S/A/B/C/D/F), accuracy, time, achievements
โ
/leaderboard โ Global / weekly rankings
/profile โ Stats, achievement badges
interface VoterProfile {
id: string;
name: string;
age: number;
emoji: string;
situation: string;
detail: string;
answer: 'online' | 'mail' | 'in-person';
hint: string;
}| Situation | Correct Zone | Reason |
|---|---|---|
| Has internet + valid ID | Online | Fast, standard path |
| Homebound / rural no internet | Mail-In | No alternative access |
| First-time voter (some states) | In-Person | State law requirement |
| Expired / lost ID | In-Person | Staff assistance needed |
| Language assistance needed | In-Person | Bilingual staff available |
| Overseas military (UOCAVA) | Mail-In | Federal provision |
- Node.js 18+
- Python 3.10+
- PostgreSQL 13+
- Git
cd frontend
npm install
cp .env.example .env.local
npm run dev
# http://localhost:3000cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
python -m app.seed
uvicorn app.main:app --reload
# http://localhost:8000/docsdocker-compose up -d
# Frontend: http://localhost:3000
# Backend: http://localhost:8000/docs
# PostgreSQL: localhost:5432
docker-compose exec backend python -m app.seed| Route | Purpose |
|---|---|
/ |
Homepage / Splash screen |
/auth/login |
Login page |
/auth/signup |
User registration |
/game |
Game hub |
/game/level/1 |
Level 1 (Voter Registration) |
/game/results |
Post-level results screen |
/leaderboard |
Global + state rankings |
/profile |
User stats & achievements |
/about |
How elections work |
- JWT tokens: 24-hour expiry. Currently stored in
localStorage(acceptable for MVP; switch tohttpOnlycookies for production). - Passwords: bcrypt-hashed via
passlib. - CORS: Restricted to
CORS_ORIGINSlist โ never use*in production. - Rate limiting: Not implemented in MVP. Add
slowapibefore production. - SQL injection: SQLAlchemy ORM parameterizes all queries.
By playing VoteQuest, users will understand:
- Registration Process โ Deadlines, requirements, where to register
- Eligibility โ Age, citizenship, residency requirements
- Accessibility โ ADA accommodations, language assistance
- Voting Methods โ Early voting, mail-in, in-person
- State Variations โ Why each state has different rules
- Logistics โ Why counting takes time, how audits work
- Deadlines โ Why they matter and what happens if missed
- Civic Responsibility โ The work behind fair elections
- Levels 2, 3, 4 fully implemented
- Multiplayer mode (real-time challenges)
- Teacher dashboard
- Mobile app (React Native)
- AI opponent (trivia battles, strategy)
- Internationalization (other countries' election processes)
- Social features (friend challenges, team mode)
- Election Assistance Commission (EAC)
- Rock the Vote
- Common Cause
- Inspired by Civilization and Among Us
MIT License โ see LICENSE for details.
Version: 1.0.0