Skip to content

Running And Docker

Run the API in watch mode:

Terminal window
pnpm dev:api

Build the API:

Terminal window
pnpm build:api

Preview the built API:

Terminal window
pnpm preview:api

Start the built API:

Terminal window
pnpm start:api

The API expects:

  • PostgreSQL
  • Redis

For local development:

Terminal window
docker compose up -d db redis

Run the API container against the Compose PostgreSQL and Redis services:

Terminal window
docker compose up -d db redis
DOCKER_NETWORK=dpg_internal pnpm docker:api

The docker:api script builds dpg-api:local, normalizes quoted values from .env for Docker, and runs the API container on the dpg_internal network.

You can still build the image directly with docker build -f apps/api/Dockerfile -t dpg-api:local . when needed.

The Dockerfile:

  • uses Node 24 Alpine
  • prunes the monorepo with Turbo for the api app
  • installs dependencies with pnpm
  • builds only apps/api
  • installs production dependencies for the final image
  • starts node apps/api/dist/server.js

The container listens on 0.0.0.0:${API_PORT}. API_PORT defaults to 2742 in the image.

VariablePurpose
INSTANCE_NAMEService name returned by health endpoint and used by auth
INSTANCE_ENVdevelopment or production
API_DOMAINPublic API base domain
API_PORTAPI listen port
AUTH_SECRETBetter Auth secret
SERVED_DOMAINSComma-separated network/domain bindings
NETWORK_CONFIG_SOURCElocal or remote
NETWORK_CONFIG_LOCAL_FILELocal network config path
NETWORK_CONFIG_URLSRemote network=url mappings
SCHEMA_REGISTRY_URLRegistry base URL or explicit mappings
POSTGRES_URLFull Postgres URL
REDIS_URLFull Redis URL

Use full POSTGRES_URL and REDIS_URL in container deployments when possible.