Deployment
Environment variables, infrastructure, and the Turbo build pipeline.
Infrastructure requirements
| Service | Notes |
|---|---|
| PostgreSQL 15+ | Must have the pgvector extension. Get from: Railway, Supabase, or self-hosted. |
| Redis | Used by BullMQ job queues. Get from: Railway Dashboard → Redis service → Connect. |
| Hetzner Object Storage | S3-compatible. Used for brief export files (PDF, PNG). Get from: Hetzner Console → Object Storage → Access Keys. |
| Stripe | Used for subscription management and webhook handling. Get from: dashboard.stripe.com → Developers. |
| AI provider | Anthropic or Gemini API key. At least one required. |
| OpenAI | Required for embedding generation (text-embedding-3-small). |
Build
pnpm buildTurbo builds all apps in dependency order:
packages/db— generates Drizzle clientpackages/types,packages/env,packages/ui,packages/api-clientapps/server— NestJS build vianest buildapps/web— Next.js buildapps/fumadocs— Next.js build
Environment variables
All server-side variables are validated at startup by packages/env/src/server.ts using Zod. The server will not boot if a required variable is missing or invalid.
Server (apps/server)
Prop
Type
Running migrations in production
Migrations must be applied before the server starts. In a Railway-style deployment, add a release command:
pnpm db:migrateEnsure DATABASE_URL is available in the migration runner environment. The pgvector extension must already be installed in the database.
BullMQ workers
The NestJS server runs BullMQ workers in the same process as the HTTP server (@Processor classes). No separate worker process is needed for the current workload. Worker classes:
BriefPromptsProcessor— handles AI prompt generation jobsBriefExportsProcessor— handles PDF/PNG export jobs
Both queues use the REDIS_URL connection.
Generating the API client
After deploying a new version of the server, regenerate the typed API client so the web app stays in sync:
pnpm generate-spec # boots NestJS in-process (no HTTP, no DB) and writes openapi.json
pnpm openapi-ts # generates packages/api-client/src/*.gen.tsThis is safe to run locally before a release — no live server is required.