Interface
Local development
Run, debug, and test Interface locally
Prerequisites
uvand Python 3.13.- Environment variables for
SPANNER_INSTANCE_IDandSPANNER_DATABASE_ID. - Google Application Credentials when targeting dev/prod Spanner (not required for the emulator).
Required environment
export SPANNER_INSTANCE_ID="..."
export SPANNER_DATABASE_ID="..."Optional environment
# Recommended for local dev when metadata is unavailable
export GCP_PROJECT_ID="..."Google Application Credentials
# Required for dev/prod Spanner access
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"If you're targeting the Spanner emulator, you do not need
GOOGLE_APPLICATION_CREDENTIALS. Configure the emulator endpoint instead.
Install dependencies
# From repo root
uv sync --all-packagesRun locally
# From repo root
uv run --package interface granian --interface asgi services.interface.main:app --host 0.0.0.0 --port 8080 --workers 1 --loop uvloopSanity checks
curl http://localhost:8080/api/v1/healthExample request
curl \
-H "Content-Type: application/json" \
-H "X-API-Key: $INTERFACE_API_KEY" \
-d '{"organization_id": "ORG_ID", "limit": 10, "offset": 0}' \
http://localhost:8080/api/v1/organizations/searchTests
# From repo root
uv run --package interface pytest -qDebugging tips
401 Unauthorizedusually indicates a missing or invalidX-API-Key.- Startup failures often come from missing secrets or Spanner connectivity.
Last updated on