Deployment
Backend (trile)
Section titled “Backend (trile)”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.
Dockerfilebuilds the image;docker-compose.prod.ymlis the production composition.- Run one
api, onescheduler(exactly one — it owns cron), and one or moreworkercontainers. - Backing services: PostgreSQL 16 and Redis 7.
Required environment
Section titled “Required environment”| Var | Purpose |
|---|---|
PROCESS_ROLE | api | scheduler | worker |
DATABASE_URL | App Postgres connection (least-privilege role). |
MIGRATION_DATABASE_URL | Owner role, used only to run migrations. |
REDIS_URL | Redis/BullMQ connection. |
BETTER_AUTH_SECRET | ≥32-char secret for Better Auth. |
BETTER_AUTH_URL | Public base URL of the API. |
NODE_ENV, LOG_LEVEL | Runtime config. |
Plus provider credentials (eSewa/Khalti/IME), SMTP/SMS, and Sentry/OTel exporter settings as configured per environment.
Migrations
Section titled “Migrations”Run pnpm migrate (with MIGRATION_DATABASE_URL) as a release step before rolling the new
image. Drizzle migrations are forward-only.
Docs site (docs)
Section titled “Docs site (docs)”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.