Deployment
Shipping the API and sites to production
Nothing is deployed yet. This page records the intended shape so the first deploy is boring.
API (apps/api)
Any Node 20+ host works (Railway is the likely first home). The build is a single bundled ESM file:
pnpm --filter api build # → apps/api/dist/index.js
pnpm --filter api start # runs it (from apps/api/, so drizzle/ resolves)Required in production (the server refuses to boot without them):
| Variable | Value |
|---|---|
NODE_ENV | production |
DATABASE_URL | Managed Postgres URL |
BETTER_AUTH_SECRET | openssl rand -base64 32 |
BETTER_AUTH_URL | Public API URL, e.g. https://api.beinghuman.game |
CORS_ORIGINS | The web origin(s), comma-separated |
Optional: DISCORD_WEBHOOK_URL, STEAM_WEB_API_KEY, STEAM_APP_ID.
Migrations run on boot — deploying a schema change is just deploying.
Start command caveat: run from apps/api/ (migrations folder resolves from cwd), or set MIGRATIONS_DIR=/app/apps/api/drizzle explicitly.
Web + Docs
Standard Next.js apps — Vercel or any Next-capable host. The docs site is internal; put it behind auth (Vercel password protection / Cloudflare Access) or keep it out of public DNS.
Scaling notes (future, not now)
- The wishlist rate limiter is in-memory → per-instance. More than one API instance needs a Redis-backed limiter.
- PGlite is a dev convenience only; production is always real Postgres via
DATABASE_URL. - Realtime multiplayer gets its own server and its own deployment story (architecture).