Dokploy
Deploy the API on Dokploy with the Dockerfile at apps/api/Dockerfile.
This is now the recommended Dokploy path because the image build is owned by the repo:
- Turbo prunes the monorepo to the API dependency graph
- pnpm installs from the pruned workspace
pnpm turbo run build --filter=apibuilds the API- production dependencies are installed for the final image
- the container starts with
node apps/api/dist/server.js
Dokploy App Settings
Section titled “Dokploy App Settings”Use a Dockerfile-based application.
| Setting | Value |
|---|---|
| Build type | Dockerfile |
| Dockerfile path | apps/api/Dockerfile |
| Build context | repository root |
| Container port | 2742 |
The Dockerfile exposes API_PORT and defaults it to 2742. Keep Dokploy’s published/internal port aligned with API_PORT.
Required Runtime Env
Section titled “Required Runtime Env”Add the normal API environment variables in Dokploy:
INSTANCE_NAME="Dpg Api"INSTANCE_ENV="production"API_DOMAIN="https://api.example.com"API_PORT="2742"AUTH_SECRET="replace-this"SERVED_DOMAINS="yellow_dot/student"NETWORK_CONFIG_SOURCE="remote"NETWORK_CONFIG_URLS="yellow_dot=https://registry.example.com/yellow-dot/network.json"POSTGRES_URL="postgres://user:password@host:5432/dbname"REDIS_URL="redis://:password@host:6379"Use POSTGRES_URL and REDIS_URL for hosted services when possible. If you use separate host/user/password fields instead, make sure the container can resolve those hostnames from Dokploy’s network.
Optional Env
Section titled “Optional Env”ALLOWED_ORIGINS="https://app.example.com"SCHEMA_REGISTRY_URL="yellow_dot=https://registry.example.com/yellow-dot/network.json"NOTIFICATION_SERVICE_ENDPOINT="https://notifications.example.com"NOTIFICATION_SERVICE_KEY_ID="key-id"NOTIFICATION_SERVICE_SECRET="replace-this"SMS_TEMPLATE_ID="otp-template"In production, auth middleware is always enabled even if AUTH_MIDDLEWARE_ENABLED=false is present.
Health Checks
Section titled “Health Checks”Use the root endpoint as the basic health check:
GET /Expected response shape:
{ "service": "Dpg Api", "status": "ok", "served_domains": [{ "network": "yellow_dot", "domain": "student" }], "network_config_source": "remote"}The API reference is available at:
/api/referenceBuilding The Same Image Locally
Section titled “Building The Same Image Locally”Build from the repository root because the Dockerfile needs the full monorepo context for Turbo pruning:
docker build -f apps/api/Dockerfile -t dpg-api .Run it with an env file:
docker run --env-file .env -p 2742:2742 dpg-apiFor local container runs, remember that 127.0.0.1 inside the API container points to the API container itself. Use reachable database and Redis hosts, such as Docker Compose service names or host networking equivalents.
Nixpacks
Section titled “Nixpacks”Nixpacks-specific variables such as NIXPACKS_BUILD_CMD and NIXPACKS_START_CMD are no longer required for the API deployment. Prefer the Dockerfile path above so Dokploy builds the same image locally and in production.
Production Checklist
Section titled “Production Checklist”API_DOMAINis the public API domain, notlocalhostINSTANCE_ENVisproduction- Dokploy routes traffic to
API_PORT NETWORK_CONFIG_SOURCEisremote- every served network has a reachable config URL
POSTGRES_URLandREDIS_URLpoint to production servicesAUTH_SECRET, Redis password, database password, and notification secrets are real secrets