A full-stack web application for exploring U.S. Congressional bills with AI-powered features.
🚀 Deploy to Production (Render.com) | 📚 Quick Start Guide
- 📊 Browse Bills - Explore U.S. Congress legislation with detailed information
- 🔍 Smart Search - Filter by tags, keywords, status, and stage
- 📈 Track Progress - Visual bill progress through the legislative process
- 🤖 AI Summaries - Auto-generated detailed summaries using OpenAI GPT-3.5-turbo
- 💬 AI Chatbot - Interactive Q&A about specific bills
- 🏷️ Intelligent Tags - Multiple categorization for easy discovery
- 📱 Responsive - Works on desktop, tablet, and mobile
Create backend/.env file:
OPENAI_API_KEY=sk-proj-YOUR_API_KEY_HEREGet your API key from https://platform.openai.com/api-keys
cd backend
mvn spring-boot:runBackend runs on http://localhost:8080
You should see:
✓ Loaded environment variables from .env file
Started BillsApplication in X seconds
cd frontend
npm install
npm run devFrontend runs on http://localhost:5173 (or 5174 if 5173 is busy)
Visit http://localhost:5173 in your browser
When you open a bill detail page:
- System checks if AI summary exists in database
- If empty, automatically generates detailed 1 paragraph summary using GPT-3.5-turbo
- Summary is saved to database for instant future access
- Cost: ~$0.001 per summary (cached forever after first generation)
What makes it special:
- ✅ Explains what the bill ACTUALLY proposes
- ✅ Describes main provisions and key changes
- ✅ Written in clear, accessible language
- ✅ 200-400 words of detailed content
- ✅ Only generated once, then cached
Click on any bill to access the AI chatbot:
- Ask questions about the bill
- Get context-aware responses
- Chatbot knows bill details, sponsor, status, etc.
- Powered by GPT-3.5-turbo
Example questions:
- "What is this bill about?"
- "Who sponsored this?"
- "What's the current status?"
- "Explain this in simple terms"
Legis-lator/
├── backend/ # Spring Boot API
│ ├── src/main/java/
│ │ └── com/congress/bills/
│ │ ├── BillsApplication.java # Main app + .env loader
│ │ ├── controller/
│ │ │ ├── BillController.java # Bill CRUD endpoints
│ │ │ ├── ChatController.java # AI chatbot
│ │ │ └── SummaryController.java # AI summary generation
│ │ ├── model/
│ │ │ └── Bill.java # Bill entity
│ │ └── repository/
│ │ └── BillRepository.java # Database queries
│ ├── .env # ⚠️ YOUR API KEY HERE
│ ├── LegisLatorDEMO.db # Database
│ └── pom.xml # Dependencies
│
└── frontend/ # Vue.js SPA
├── src/
│ ├── components/
│ │ ├── Bill/ # Bill components
│ │ │ ├── BillSummary.vue # AI summary display
│ │ │ └── ...
│ │ └── Chatbot/
│ │ └── Chatbot.vue # AI chatbot component
│ ├── pages/ # Page views
│ ├── services/
│ │ └── api.js # Backend API calls
│ └── store/ # State management
└── package.json
File: backend/src/main/resources/application.properties
# Server
server.port=8080
# Database
spring.datasource.url=jdbc:sqlite:LegisLatorDEMO.db
# CORS (Frontend URLs)
spring.web.cors.allowed-origins=http://localhost:5173,http://localhost:5174
# OpenAI API Key (loaded from .env)
openai.api.key=${OPENAI_API_KEY}File: frontend/.env (optional)
VITE_API_URL=http://localhost:8080/apiDefaults to http://localhost:8080/api if not specified.
GET /api/bills- Get all billsGET /api/bills/{billId}- Get specific billGET /api/bills/search?q={query}- Search billsGET /api/bills/tag/{tag}- Filter by tagGET /api/bills/stage/{stage}- Filter by stageGET /api/bills/recent- Get recent bills
POST /api/chat/message- Send message to AI chatbotPOST /api/summary/generate- Generate AI summary for billDELETE /api/summary/clear- Clear all summaries (force regeneration)
Windows:
cd backend
.\clear_summaries.ps1Mac/Linux:
cd backend
chmod +x clear_summaries.sh
./clear_summaries.shOr via API:
curl -X DELETE http://localhost:8080/api/summary/clearBackend:
cd backend
mvn clean package -DskipTests
java -jar target/bills-api-1.0.0.jarFrontend:
cd frontend
npm run buildOutput in frontend/dist/
File: backend/src/main/java/com/congress/bills/controller/SummaryController.java (line 75)
requestBody.put("model", "gpt-3.5-turbo"); // Change to gpt-4, etc.File: backend/src/main/java/com/congress/bills/controller/ChatController.java (line 52)
requestBody.put("model", "gpt-3.5-turbo"); // Change to gpt-4, etc.Problem: Port 8080 already in use
Solution: Change port in application.properties:
server.port=8081Problem: "OpenAI API key is not configured"
Solution:
- Check
backend/.envexists - Verify key format:
OPENAI_API_KEY=sk-proj-... - Restart backend
Problem: Java version error
Solution: Install Java 21
java -version # Should show 21.x.xProblem: "Failed to fetch bills"
Solution: Ensure backend is running on port 8080
Problem: CORS errors
Solution: Add your frontend URL to backend's application.properties:
spring.web.cors.allowed-origins=http://localhost:5173Problem: "OpenAI quota exceeded"
Solution:
- Go to https://platform.openai.com/account/billing
- Add payment method
- Add credits ($5-10 recommended)
Problem: "Invalid API key"
Solution:
- Get new key from https://platform.openai.com/api-keys
- Update
backend/.env - Restart backend
Problem: Summaries too short/long
Solution: Adjust max_tokens in SummaryController.java:
requestBody.put("max_tokens", 800); // Increase/decreaseGPT-3.5-turbo Pricing:
- $0.002 per 1,000 tokens
Typical Usage:
- AI Summary: ~600 tokens = $0.001 per bill
- Chatbot message: ~200 tokens = $0.0004 per message
Example Costs:
- 100 bills with summaries: $0.10
- 1,000 chatbot messages: $0.40
- Total for 150 bills + 500 messages: ~$0.35
Free tier: New accounts get $5 in credits (enough for ~5,000 summaries!)
- ✅ API key stored in
.envfile (gitignored) - ✅ Key never exposed to frontend
- ✅ Summaries cached in database (no repeated API calls)
- ✅ CORS configured for specific origins only
.env file to Git!
- Java 21
- Spring Boot 3.5.0
- SQLite with JPA/Hibernate
- dotenv-java for environment variables
- RestTemplate for OpenAI API calls
- Vue 3 (Composition API)
- Vite (build tool)
- Tailwind CSS (styling)
- Pinia (state management)
- Vue Router (routing)
- OpenAI GPT-3.5-turbo
- Context-aware prompts
- Response caching
- OpenAI API Docs: https://platform.openai.com/docs
- Spring Boot Docs: https://spring.io/projects/spring-boot
- Vue.js Docs: https://vuejs.org/
- Tailwind CSS: https://tailwindcss.com/
This project is for educational purposes.
- Bill data structure based on Congress.gov schema
- UI inspired by modern legislative tracking platforms
- AI features powered by OpenAI
Ready to explore legislation? Start the servers and visit http://localhost:5173! 🚀