A political worldview quiz that assesses your beliefs without spin or leading questions, then shows you where you stand and presents evidence related to your positions.
- Neutral Quiz: Questions framed without political bias
- Evidence Network: Tag and link news articles, videos, and transcripts to topics
- Session Persistence: Save and track how your views evolve
- Admin Panel: Easy content management for questions and evidence
- Easy Hosting: Deploy to Vercel with one click
cd /Users/dan.maguire/Documents/Projects/Politics
npm install# Generate Prisma client and create database
npx prisma generate
npx prisma db push
# Seed with sample data
npm run db:seednpm run devFor mobile testing on the same Wi-Fi:
npm run dev:mobileThen open the printed http://<LAN-IP>:1776 URL on your phone.
Politics/
├── prisma/
│ ├── schema.prisma # Database schema
│ └── seed.ts # Sample data
├── src/
│ ├── app/
│ │ ├── api/ # API routes
│ │ │ ├── answers/
│ │ │ ├── categories/
│ │ │ ├── entities/
│ │ │ ├── evidence/
│ │ │ ├── questions/
│ │ │ ├── sessions/
│ │ │ └── tags/
│ │ ├── admin/ # Admin panel
│ │ ├── quiz/ # Quiz interface
│ │ ├── results/ # Results display
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx # Home page
│ └── lib/
│ ├── db.ts # Database client
│ └── utils.ts # Utilities
├── .env # Environment variables
└── package.json
Visit /admin to:
- Add/edit quiz questions
- Add evidence (articles, videos, transcripts)
- Create and manage tags
- Link evidence to questions
- Go to Admin → Questions tab
- Fill in:
- Question text: Neutral framing (e.g., "How should healthcare be funded?")
- Category: Topic area
- Left label: Left-leaning position description
- Right label: Right-leaning position description
- Go to Admin → Evidence tab
- Fill in:
- Title: Headline
- Summary: Brief description
- Source URL: Link to original
- Source Name: Publication name
- Tags: Select relevant tags
Currently done via database. To link evidence to a question:
// In prisma studio (npm run db:studio) or via API
await prisma.questionEvidence.create({
data: {
questionId: 'question-uuid',
evidenceId: 'evidence-uuid',
relationship: 'supports_left', // or 'supports_right', 'neutral'
note: 'Why this evidence is relevant'
}
});| Model | Purpose |
|---|---|
Category |
Quiz topic areas (Economic, Social, etc.) |
Question |
Quiz questions with spectrum labels |
Evidence |
News articles, videos, transcripts |
Tag |
Labels for organizing evidence |
Session |
User quiz sessions |
Answer |
Individual question responses |
PoliticalEntity |
Reference positions (parties, movements) |
- Questions belong to Categories
- Evidence can have multiple Tags
- Evidence can be linked to Questions (with relationship type)
- Sessions contain Answers to Questions
- Push to GitHub
- Import to Vercel
- Add environment variable:
DATABASE_URL="file:./prod.db" - Deploy
Note: For production, consider using a hosted database like:
- Turso (SQLite-compatible)
- PlanetScale (MySQL)
- Supabase (PostgreSQL)
To switch databases, update prisma/schema.prisma:
datasource db {
provider = "postgresql" // or "mysql"
url = env("DATABASE_URL")
}Works with any Node.js host:
- Netlify
- Railway
- Render
- DigitalOcean App Platform
npm run db:studioOr via API:
curl -X POST http://localhost:3000/api/categories \
-H "Content-Type: application/json" \
-d '{"name": "Healthcare", "description": "Views on healthcare policy", "order": 6}'Each question has an alignmentMap JSON field:
{
"economic": 1, // How much this affects economic score (0-1)
"social": 0.5 // How much this affects social score (0-1)
}Answer values range from -2 (strongly left) to +2 (strongly right).
Add reference points for comparison:
curl -X POST http://localhost:3000/api/entities \
-H "Content-Type: application/json" \
-d '{
"name": "Democratic Party",
"type": "party",
"economicScore": -0.5,
"socialScore": -0.3
}'GET /api/questions- List all active questionsPOST /api/questions- Create question
GET /api/evidence- List evidence (filter by?tagId=or?categoryId=)POST /api/evidence- Create evidence
POST /api/sessions- Create/resume sessionGET /api/sessions/[id]- Get session with answersPOST /api/sessions/[id]/complete- Calculate results
POST /api/answers- Save answer
GET /api/tags- List tagsPOST /api/tags- Create tag
GET /api/categories- List categoriesPOST /api/categories- Create category
GET /api/entities- List political entities
Potential additions:
- AI-assisted tag suggestions for uploaded articles
- Bulk evidence import from RSS/API
- Question weighting and importance
- Detailed breakdown by category
- Share results functionality
- Historical comparison charts
- Multi-language support
# Development
npm run dev # Start dev server
npm run build # Build for production
npm run start # Start production server
# Database
npm run db:push # Push schema changes
npm run db:seed # Seed sample data
npm run db:studio # Open Prisma Studio (GUI)
npm run db:reset # Reset and reseed databaseMIT