Overview
Haggle consists of three main components:- Backend API (FastAPI) - Main service on port 8000
- Frontend (Next.js) - Web interface on port 3000
- Voice Backend (Optional) - Call service on port 6000
Quick Start
Start the Backend API
From the project root, start the FastAPI server:The API will be available at:
The server is ready when you see:
- Main: http://localhost:8000
- Docs: http://localhost:8000/docs (Swagger UI)
- ReDoc: http://localhost:8000/redoc
Start the Frontend
In a new terminal, navigate to the frontend directory and start Next.js:Open http://localhost:3000 in your browser.
The frontend is ready when you see:
Testing with the CLI
The CLI provides an interactive way to test the backend without the frontend:Interactive Mode
Run the CLI and answer prompts:- What do you need help with? (e.g., “fix my leaky faucet”)
- Your house address
- Your ZIP code
- Your budget
- When do you need this done?
- 3-5 clarifying questions
Demo Mode
Run with pre-filled test data:- Uses query: “fix my leaky faucet”
- Sets address: “123 Main St, San Jose, CA 95126”
- Sets budget: $200
- Answers clarifying questions
- Searches for providers
- Saves to database
View CLI Demo Output
View CLI Demo Output
API Endpoints
Health Check
Verify the API is running:Start a Job
Create a new service request:Complete a Job
Submit answers and search for providers:Get Providers for a Job
Retrieve all providers found for a job:Check Provider Status
Get real-time status of provider calls:Development Workflow
Make Code Changes
Both servers support hot reload:
- Backend: Uvicorn auto-reloads on .py file changes
- Frontend: Next.js fast refresh on component changes
Changes to
config.py or .env require manual server restart.Test Your Changes
Use the interactive API docs:
- Navigate to http://localhost:8000/docs
- Expand any endpoint
- Click “Try it out”
- Fill in parameters
- Click “Execute”
Check the Database
View stored data in Supabase:
- Open your Supabase Dashboard
- Navigate to Table Editor
- Select the
providerstable - View all entries created by your tests
Port Reference
| Service | Port | URL | Description |
|---|---|---|---|
| Backend API | 8000 | http://localhost:8000 | Main FastAPI service |
| Frontend | 3000 | http://localhost:3000 | Next.js web interface |
| Voice Backend | 6000 | http://localhost:6000 | Twilio voice calling |
| API Docs | 8000 | http://localhost:8000/docs | Swagger UI |
| ReDoc | 8000 | http://localhost:8000/redoc | API documentation |
Troubleshooting
Port already in use
Port already in use
If port 8000 or 3000 is already in use:Backend:Frontend:Update the frontend API calls to point to the new backend port.
Module not found errors
Module not found errors
Ensure you’ve installed dependencies:Backend:Frontend:If using a virtual environment, make sure it’s activated.
Database connection errors
Database connection errors
Verify your Supabase configuration:
- Check
SUPABASE_URLandSUPABASE_KEYinconfig.py - Ensure the
providerstable exists - Test connection:
Grok API errors
Grok API errors
If you see “No XAI_API_KEY set” warnings:
- This is normal - Haggle uses fallback logic when no API key is configured
- To use real Grok LLM, add your API key to
config.py: - Restart the server after adding the key
Next Steps
API Reference
Explore all API endpoints
Architecture
Understand the system architecture