A FastAPI gateway service that routes requests between the frontend and backend services.
cd api
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activatepip install -r requirements.txtCreate a .env file:
cp .env.example .envEdit .env and configure service URLs:
BACKEND_URL=http://localhost:8000
STORYBOOK_GENERATOR_URL=http://localhost:8001
SUPABASE_URL=your-supabase-url
SUPABASE_KEY=your-anon-key
uvicorn main:app --reload --port 3001The service will start on http://localhost:3001
# From project root
docker-compose up apiThe API gateway will be available at http://localhost:3001
- Routes frontend requests to the appropriate backend services
- Handles paper uploads and forwards to the backend
- Proxies claims extraction with SSE streaming
- Manages plan generation and execution requests
- Routes storybook generation to the dedicated storybook service
- Provides a unified API interface for the frontend
GET /papers # List all papers
GET /papers/{id} # Get paper details
POST /papers/ # Upload paper
GET /papers/{id}/extract # Extract claims (SSE)
GET /papers/{id}/claims # Get extracted claims
POST /papers/{id}/plan # Generate plan
GET /papers/{id}/plans # List plans for paper
GET /papers/{id}/plans/{plan_id} # Get specific plan
GET /plans/{plan_id}/materialize # Generate notebook
GET /plans/{plan_id}/download-urls # Get signed URLs
GET /plans/{plan_id}/run # Execute notebook
GET /runs/{run_id}/events # Stream execution events (SSE)
POST /explain/kid # Generate storybook
POST /explain/kid/{id}/refresh # Update storybook with results
- FastAPI for REST API
- httpx for service-to-service communication
- Supabase for database queries
- Server-Sent Events for streaming