Production Deployment
The production checklist, hosting options, and what the Express layer already protects.
ngXpress is a single Node SSR app — there's no separate build for a frontend host and an API host. Build once, run pnpm start behind TLS.
Vercel, Netlify, and Docker adapters aren't first-class yet. A VPS, VM, or any Node 20+ host works — DigitalOcean, Linode, Hetzner, AWS EC2, GCP Compute, Azure VMs, and similar. Use a process manager such as PM2 in production.
Production checklist
- Copy
.env.example→.envand set a strongBETTER_AUTH_SECRET. - Set
BETTER_AUTH_URLto your public HTTPS origin. - Set
BETTER_AUTH_TRUSTED_ORIGINSto those exact origins — no trailing-slash mismatches. - Set
NODE_ENV=production. - Terminate TLS at a reverse proxy; run Node on an internal port (
PORT, default4000). - Replace the dev email logger (
src/api/lib/email.ts) before sending real password-reset mail — in production it throws until a provider is wired up.
pnpm build
pnpm startpnpm build only generates the Prisma client and compiles the app. pnpm start runs prisma migrate deploy before the Node server starts, so an empty production database gets the auth and task tables. If your host has a separate release command, point that at pnpm db:deploy — you can still use pnpm start as the run command, since a second migrate deploy is a no-op once everything is applied.
DATABASE_URL="postgresql://USER:PASS@HOST:5432/ngxpress"
BETTER_AUTH_SECRET="your_secret_key"
BETTER_AUTH_URL="https://yourdomain.com"
BETTER_AUTH_TRUSTED_ORIGINS="https://yourdomain.com"
NODE_ENV="production"
PORT=4000What the Express layer already does
- Stricter rate limits on
/api/auth - General rate limits on
/api - A 100kb JSON body size limit on non-auth API routes
Rate limiting is in-memory
Rate limiting lives in a single Node process — it doesn't share state across instances. Don't enable a naive trust proxy setting unless you understand spoofed X-Forwarded-For headers; doing so can let clients bypass rate limits entirely.
Hosting
Any host that can run Angular SSR plus Node works: DigitalOcean, Linode, Hetzner, AWS EC2, GCP Compute, Azure VMs, and similar. Run the process under PM2 (or an equivalent supervisor) so it restarts on crash and on deploy.
Related
- Environment Variables — full variable reference
- Database & Prisma — migration workflow and switching databases