Local development
Backend (trile)
Section titled “Backend (trile)”The backend needs PostgreSQL 16, Redis 7, and (for OTP/email testing) MailHog. docker-compose
provides them.
Quick start
Section titled “Quick start”cd trile./start.sh # .env → infra up → wait healthy → migrate → build → api+scheduler+workerstart.sh copies .env.example to .env if missing, brings up infra, runs migrations, and
launches all three process roles with clean shutdown on Ctrl-C.
Manual / iterative
Section titled “Manual / iterative”cd triledocker compose up -d # infra only: postgres, redis, mailhogpnpm installpnpm migrate # apply Drizzle migrationspnpm dev # api process with watch# in separate shells, if you need them:pnpm start:workerpnpm start:scheduler| Service | URL |
|---|---|
| API | http://localhost:3000 |
| OpenAPI JSON | http://localhost:3000/docs-json |
| Swagger UI | http://localhost:3000/docs |
| MailHog (OTP/email inbox) | http://localhost:8025 |
| Health / readiness | /healthz, /readyz |
Useful scripts: pnpm typecheck, pnpm lint (Biome), pnpm test / pnpm test:e2e
(Testcontainers spins real Postgres + Redis), pnpm migrate:generate, pnpm seed:demo.
This docs site (docs)
Section titled “This docs site (docs)”cd docsnpm installnpm run dev # http://localhost:4321npm run build # static output in dist/npm run preview # serve the buildRegenerating the API Reference
Section titled “Regenerating the API Reference”The API Reference is rendered from src/openapi/trile.json. Refresh it from a running
backend:
cd trile && pnpm dev # backend on :3000 (in one shell)
cd docsTRILE_API_URL=http://localhost:3000 npm run sync:openapiThe committed trile.json is a curated snapshot so the docs build without a live API; the sync
script overwrites it with the full live spec. Re-run sync and commit the JSON whenever backend
endpoints or DTOs change.