The website that will help you become a better citizen.
Track U.S. bills, understand them with AI-powered summaries, endorse what matters to you, and contact your representativesβall in one place.
- π Bill Feed: Browse current U.S. congressional bills
- π€ AI Summaries: Get human-friendly explanations of complex bills
- π Endorsements: Endorse bills you support
- π Saved Bills: Track bills you're interested in
- π Authentication: Secure user accounts with NextAuth
- Frontend: Next.js 14 (App Router) + React + TypeScript + Tailwind CSS
- Auth: NextAuth.js
- Database: Supabase (PostgreSQL + pgvector)
- AI: OpenAI & Anthropic (stubbed)
- External API: Congress.gov (stubbed)
- Python: Vector indexing and recommendations (pgvector)
- Node.js 18+ and npm/pnpm/yarn
- PostgreSQL database (Supabase recommended)
- Python 3.9+ (for Python package)
- OpenAI API key (optional, for AI summaries)
- Congress.gov API key (optional, for real bill data)
-
Clone the repository:
git clone <your-repo-url> cd Consensus
-
Install dependencies:
npm install # or pnpm install # or yarn install
-
Set up environment variables:
cp .env.example .env
Edit
.envand fill in your values:NEXTAUTH_URL: Your app URL (e.g.,http://localhost:3000)NEXTAUTH_SECRET: Generate a secret:openssl rand -base64 32SUPABASE_URL: Your Supabase project URLSUPABASE_ANON_KEY: Your Supabase anonymous keySUPABASE_SERVICE_ROLE_KEY: Your Supabase service role keyDATABASE_URL: PostgreSQL connection stringOPENAI_API_KEY: Your OpenAI API key (optional)ANTHROPIC_API_KEY: Your Anthropic API key (optional)CONGRESS_GOV_API_KEY: Your Congress.gov API key (optional)
-
Set up the database:
# Apply schema npm run db:apply # Seed sample data (optional) npm run db:seed
-
Run the development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
.
βββ app/ # Next.js App Router
β βββ (marketing)/ # Public pages
β βββ (auth)/ # Authentication pages
β βββ (app)/ # Protected app pages
β βββ api/ # API routes
βββ components/ # React components
β βββ ui/ # Reusable UI components
β βββ nav/ # Navigation components
β βββ bills/ # Bill-related components
βββ lib/ # Utility libraries
β βββ auth.ts # NextAuth configuration
β βββ supabase.ts # Supabase client
β βββ ai/ # AI providers (OpenAI, Anthropic)
β βββ congress/ # Congress.gov client
βββ db/ # Database files
β βββ schema.sql # Database schema
β βββ seed.sql # Sample data
βββ python/ # Python package
β βββ src/ # Python source code
β β βββ ingest.py # Bill ingestion
β β βββ recommend.py # Vector recommendations
β βββ README.md # Python package docs
βββ scripts/ # Utility scripts
βββ types/ # TypeScript types
npm run dev- Start development server (with env check)npm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run typecheck- Run TypeScript type checkingnpm run db:apply- Apply database schemanpm run db:seed- Seed sample data
See python/README.md for details on the Python package for vector indexing and recommendations.
cd python
# Using Poetry
poetry install
poetry run python src/ingest.py
poetry run python src/recommend.py --query "climate change"
# Using pip/venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python src/ingest.py
python src/recommend.py --query "climate change"The database includes the following tables:
users- User accounts and profilesbills- Congressional billsbill_summaries- AI-generated bill summariesbill_embeddings- Vector embeddings for similarity search (pgvector)endorsements- User bill endorsementssaved_bills- User saved bills
See db/schema.sql for the complete schema.
GET /api/bills- Get paginated list of billsGET /api/bills/[billId]- Get a specific billPOST /api/bills/[billId]/summary- Generate AI summary for a bill
GET /api/endorsements- Get user's endorsementsPOST /api/endorsements- Create an endorsementDELETE /api/endorsements- Delete an endorsement
GET/POST /api/auth/[...nextauth]- NextAuth endpoints
The app uses NextAuth.js with email (magic link) authentication.
Note: Email functionality requires SMTP configuration. For development, you can use a service like Mailtrap or Resend.
To configure email:
-
Add SMTP environment variables to
.env:SMTP_HOST=smtp.example.com SMTP_PORT=587 [email protected] SMTP_PASSWORD=your-password [email protected] -
Alternatively, use a Supabase adapter for authentication (see
lib/auth.tsfor TODO comments).
The dev server automatically runs scripts/load-env-check.ts to verify environment variables and show which features are available.
The app gracefully handles missing API keys and database connections by:
- Returning mock data when database is not configured
- Showing placeholder AI summaries when API keys are missing
- Using mock Congress.gov data when API key is not set
This allows development without full configuration, but you'll want to configure all services for production.
- Push your code to GitHub
- Import your repository in Vercel
- Add environment variables in Vercel dashboard
- Deploy
The app can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- AWS Amplify
- Docker (see Dockerfile example in TODO)
- Implement actual Congress.gov API integration
- Complete Supabase adapter for NextAuth
- Add email templates for magic links
- Implement vector similarity search in Python package
- Add user preference-based recommendations
- Add "contact representative" functionality
- Add bill tracking and notifications
- Add comprehensive error handling
- Add tests (unit, integration, e2e)
- Add Docker support
- Add CI/CD pipeline
Contributions are welcome! Please feel free to submit a Pull Request.
[Add your license here]
For support, please open an issue on GitHub.