Python/FastAPI version of the VAC demo upstream API. Same endpoints and response shapes as the Rust demo-api, so the VAC sidecar can use this as upstream interchangeably.
- API Key auth:
Authorization: Bearer <key>(sidecar injects this when forwarding) - Endpoints:
GET /health,POST /search,POST /charge(same as Rust demo-api) - Config:
DEMO_API_KEY,DEMO_API_PORT(default:demo-api-key,8080)
cd demo-api-python
pip install -r requirements.txt
python main.py
# Or: uvicorn main:app --host 0.0.0.0 --port 8080Server runs at http://localhost:8080. Set env if needed:
export DEMO_API_KEY="demo-api-key"
export DEMO_API_PORT=8080
python main.py- Start this API:
python main.py(or use the Rust demo-api). - In sidecar config, set
upstream_url = "http://localhost:8080"andapi_key = "demo-api-key". - Send requests to the sidecar (e.g.
http://localhost:3000/search) with a Root Biscuit; the sidecar forwards to this API with the API key.
| Method | Path | Auth | Body |
|---|---|---|---|
| GET | /health | No | - |
| POST | /search | Bearer | {"query": "string"} |
| POST | /charge | Bearer | {"amount": int, "currency": "string", "description?": "string"} |
Responses match the Rust demo-api: { "success": bool, "message": str, "data": ... }.
From repo root:
docker-compose --profile fastapi build demo-api-python
docker-compose --profile fastapi up demo-api-python
# API on host port 8082. To use as sidecar upstream:
# VAC_UPSTREAM_URL=http://demo-api-python:8080 docker-compose --profile fastapi up