API
The API is a Node.js service that runs inside Docker Compose as part of the backend profile. It provides the legacy v1 REST and GraphQL API.
Running
pnpm dev:backendThe API is available at http://localhost:3001. Traffic routed through the API Gateway is available at http://localhost:8888/api.
Environment Variables
The API loads environment variables from two sources:
apps/api/.env-- mounted into the container via Docker Compose- Docker Compose
environmentblock -- overrides for container networking (database host, Redis host, etc.)
Key overrides set by Docker Compose:
| Variable | Value | Description |
|---|---|---|
MAIN_DB_CONNECTION_STRING | postgresql://postgres:postgres@postgres:5432/main | Postgres via Docker network |
REDIS_URL | redis://redis:6379 | Redis via Docker network |
GRAPHQL_SCHEMA | http://localhost:3000/api/graphql | GraphQL introspection endpoint |
OTEL_EXPORTER_OTLP_ENDPOINT | http://aspire-dashboard:18889 | OpenTelemetry — see Observability |
Hot Reload
The API runs in dev mode using tsup --watch. Source code is mounted via ./:/workspace:delegated, so file changes trigger an automatic rebuild and restart inside the container.
Database
The API connects to the postgres service (main database). To reset the database:
docker compose down -v
pnpm dev:backendWARNING
-v removes all named volumes including pnpm store and node_modules caches.
Logs
docker compose logs -f apiOutput is piped through pino-pretty for readable structured logs.