Skip to content

Deployment

Deploys as cloud-agnostic Docker so the host can be a Nepal-eligible provider (NRB data localization). The same image runs all three roles, differentiated by PROCESS_ROLE.

  • Dockerfile builds the image; docker-compose.prod.yml is the production composition.
  • Run one api, one scheduler (exactly one — it owns cron), and one or more worker containers.
  • Backing services: PostgreSQL 16 and Redis 7.
VarPurpose
PROCESS_ROLEapi | scheduler | worker
DATABASE_URLApp Postgres connection (least-privilege role).
MIGRATION_DATABASE_URLOwner role, used only to run migrations.
REDIS_URLRedis/BullMQ connection.
BETTER_AUTH_SECRET≥32-char secret for Better Auth.
BETTER_AUTH_URLPublic base URL of the API.
NODE_ENV, LOG_LEVELRuntime config.

Plus provider credentials (eSewa/Khalti/IME), SMTP/SMS, and Sentry/OTel exporter settings as configured per environment.

Run pnpm migrate (with MIGRATION_DATABASE_URL) as a release step before rolling the new image. Drizzle migrations are forward-only.

npm run build produces a fully static site in dist/ — host it anywhere static (the target is docs.trile.app). The build is reproducible without a live backend because the OpenAPI snapshot is committed; refresh it via the sync step as part of your release when the API changes.