Skip to content

emckenna/constitution-compass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

72 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Constitution Compass

Issues LinkedIn

Constitution Compass

Interactive quiz application for learning about the U.S. Constitution
Try it Live ยป

Report Bug ยท Request Feature ยท Send Feedback

About The Project

Constitution Compass is an interactive quiz application designed to test and improve your knowledge of the United States Constitution. Whether you're a student, educator, or civically engaged citizen, this tool makes learning about our founding document engaging and accessible.

Live Application: https://constitution-compass.vercel.app

Project Documentation:

  • ๐Ÿ“‹ CHANGELOG - View all releases and updates
  • ๐Ÿ“„ LICENSE - Copyright and usage terms

Key Features

  • ๐Ÿค– AI-Powered Question Generation - Dynamic questions using Google Gemini API
  • ๐Ÿ“Š Regional Analytics - Track quiz performance by geographic region
  • ๐ŸŽฏ Customizable Difficulty - Easy, Medium, and Hard levels
  • ๐Ÿ“š Topic-Specific Quizzes - Focus on specific Constitutional topics
  • ๐Ÿ’ก Detailed Explanations - Learn from each answer
  • ๐Ÿ“ฑ Responsive Design - Works on all devices
  • ๐Ÿ”’ Privacy-Focused - Only regional data collected, no personal information

Built With AI

This application was primarily built using Claude AI (Anthropic's large language model) as a development partner. The codebase demonstrates how AI can accelerate modern web development while maintaining code quality and best practices.

Technology Stack

  • Frontend: React 19, Tailwind CSS, Lucide React icons
  • Backend: Node.js 22, Vercel Serverless Functions
  • Database: Neon Serverless Postgres (via Vercel)
  • AI Services: Google Gemini API (gemini-2.0-flash-exp), Claude AI (development)
  • Analytics: Vercel Analytics
  • Hosting: Vercel
  • CI/CD: GitHub Actions with tag-based deployments
  • Geolocation: Vercel headers + ipapi.co fallback

Getting Started

Prerequisites

  • Node.js 22 or higher
  • npm or yarn
  • Google Gemini API key (for AI-generated questions)
  • Neon Postgres database (for score tracking)

Installation

  1. Clone the repository

    git clone https://github.com/emckenna/constitution-compass.git
    cd constitution-compass
  2. Install dependencies

    npm install
  3. Create a .env.local file with required environment variables

    GEMINI_API_KEY=your_gemini_api_key
    DATABASE_URL=your_neon_postgres_connection_string
    BLACKLIST_IPS=your.ip.address.here,another.ip.if.needed  # Optional: Exclude IPs from analytics
  4. Initialize the database

    # After deploying to Vercel, visit:
    https://your-app.vercel.app/api/init-db
  5. Run the development server

    npm start
  6. Open http://localhost:3000 in your browser

Note: AI-generated questions require the Gemini API and will only work in production (Vercel). For local development, the app falls back to hardcoded questions.

Deployment

This project uses a preview-then-promote workflow for safe deployments:

Development Workflow

  1. Create a feature branch

    git checkout -b feature/your-feature-name
  2. Make changes and push

    git add .
    git commit -m "Your changes"
    git push origin feature/your-feature-name
  3. Preview deployment automatically created

    • GitHub Actions automatically deploys to Vercel preview URL
    • Test your changes on the preview URL before merging
  4. Create Pull Request

    • Open PR to merge into main
    • Preview URL will be commented on the PR
  5. Merge and deploy to production

    git checkout main
    git pull
    npm run deploy-quick  # Auto-tags and deploys to production

Deployment Commands

Quick Deploy (Patch Version)

npm run deploy-quick

Interactive Deploy

npm run deploy

The deploy script:

  • Checks for uncommitted changes
  • Auto-pushes commits if needed
  • Creates and pushes version tags
  • Triggers GitHub Actions workflow
  • Deploys to Vercel production automatically

Deployment Environments

  • Preview: All feature branches and PRs โ†’ https://constitution-compass-<hash>.vercel.app
  • Production: Tagged releases on main โ†’ https://constitution-compass.vercel.app

API Endpoints

  • POST /api/generate-questions - Generate AI quiz questions
  • GET /api/get-region - Get user's geographic region
  • POST /api/save-score - Save quiz score to database
  • GET /api/stats - Get regional statistics
  • GET /api/init-db - Initialize database tables (run once)
  • GET /api/migrate-db - Run database migrations

Features Roadmap

  • Interactive analytics dashboard
  • Historical trending analysis
  • Regional leaderboards
  • Free-text questions with AI evaluation
  • Automated daily trivia posts to X/Twitter
  • More question topics and categories
  • User accounts and progress tracking

Contributing

This repository is for portfolio and demonstration purposes.

While I appreciate your interest, I am not accepting contributions at this time as this is a personal portfolio project. However, I welcome:

License & Copyright

ยฉ 2024-2025 Eric McKenna. All Rights Reserved.

This project is publicly viewable for transparency and educational purposes, but remains protected by copyright.

Usage Policy

  • โœ… View and learn from the code
  • โœ… Use the live application at constitution-compass.vercel.app
  • โœ… Report bugs and suggest features via GitHub Issues
  • โš ๏ธ Do NOT copy, fork, or redistribute this code without explicit permission
  • โš ๏ธ Do NOT use this code commercially without a license agreement

Why This Approach?

This is a portfolio project showcasing technical capabilities to employers and collaborators. Making it public allows:

  • ๐Ÿ“Š Transparency in demonstrating skills and coding practices
  • ๐Ÿค Community feedback and bug reports
  • ๐ŸŽ“ Others to learn from the implementation
  • ๐Ÿ”’ Protection of intellectual property and future opportunities

Want to Use This Code?

If you're interested in licensing this code or discussing collaboration:

For recruiters and hiring managers: I'm happy to walk through the architecture, discuss technical decisions, and demonstrate how these skills apply to your needs.

Contact

Eric McKenna

Portfolio Context: This project showcases full-stack development capabilitiesโ€”from React component architecture and state management to serverless functions, AI integration, and database design with Postgres. It demonstrates practical problem-solving and the ability to ship a polished, production-ready application.

Job Seeking? I know how challenging the market can be. I built this to showcase technical skills and connect with othersโ€”whether you're hiring, looking for opportunities yourself, or want to discuss building with AI and modern web tech.

Acknowledgments


๐Ÿ‡บ๐Ÿ‡ธ Learn the Constitution. Know your rights. Be an informed citizen.

About

Interactive Constitutional quiz app with AI-powered questions, regional analytics, and automated daily trivia posts to X/Twitter. Built with React, Vercel, and Claude AI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors