Interactive quiz application for learning about the U.S. Constitution
Try it Live ยป
Report Bug
ยท
Request Feature
ยท
Send Feedback
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:
- ๐ค 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
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.
- 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
- Node.js 22 or higher
- npm or yarn
- Google Gemini API key (for AI-generated questions)
- Neon Postgres database (for score tracking)
-
Clone the repository
git clone https://github.com/emckenna/constitution-compass.git cd constitution-compass -
Install dependencies
npm install
-
Create a
.env.localfile with required environment variablesGEMINI_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
-
Initialize the database
# After deploying to Vercel, visit: https://your-app.vercel.app/api/init-db -
Run the development server
npm start
-
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.
This project uses a preview-then-promote workflow for safe deployments:
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make changes and push
git add . git commit -m "Your changes" git push origin feature/your-feature-name
-
Preview deployment automatically created
- GitHub Actions automatically deploys to Vercel preview URL
- Test your changes on the preview URL before merging
-
Create Pull Request
- Open PR to merge into
main - Preview URL will be commented on the PR
- Open PR to merge into
-
Merge and deploy to production
git checkout main git pull npm run deploy-quick # Auto-tags and deploys to production
Quick Deploy (Patch Version)
npm run deploy-quickInteractive Deploy
npm run deployThe 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
- Preview: All feature branches and PRs โ
https://constitution-compass-<hash>.vercel.app - Production: Tagged releases on
mainโhttps://constitution-compass.vercel.app
POST /api/generate-questions- Generate AI quiz questionsGET /api/get-region- Get user's geographic regionPOST /api/save-score- Save quiz score to databaseGET /api/stats- Get regional statisticsGET /api/init-db- Initialize database tables (run once)GET /api/migrate-db- Run database migrations
- 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
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:
- ๐ Bug reports via GitHub Issues
- ๐ก Feature suggestions via GitHub Issues
- ๐ฌ General feedback via GitHub Issues
ยฉ 2024-2025 Eric McKenna. All Rights Reserved.
This project is publicly viewable for transparency and educational purposes, but remains protected by copyright.
- โ 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
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
If you're interested in licensing this code or discussing collaboration:
- ๐ง Email: eric.mckenna@gmail.com
- ๐ผ LinkedIn: linkedin.com/in/ericmckenna
- ๐ฆ X/Twitter: @USConstCompass
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.
Eric McKenna
- ๐ผ LinkedIn: linkedin.com/in/ericmckenna - Open to opportunities
- ๐ฆ X/Twitter: @USConstCompass
- ๐ป GitHub: @emckenna
- ๐ Live App: constitution-compass.vercel.app
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.
- Built primarily with Claude AI by Anthropic
- Powered by Google Gemini API
- Hosted on Vercel
- Database by Neon
- Icons by Lucide
- Versioning follows Semantic Versioning
- Changelog format based on Keep a Changelog
- README template inspired by Best-README-Template
๐บ๐ธ Learn the Constitution. Know your rights. Be an informed citizen.