For a Nest + Prisma + PostgreSQL API the durable edge split is a reverse proxy owning 80/443 while Nest listens only on a private port or Compose network. Resolve the Nest service by internal name, keep the database unpublished on the host firewall, and pin proxy_http_version 1.1 with Connection cleared so keepalive into Node reuses sockets. Always forward Host, X-Forwarded-For, and X-Forwarded-Proto so Nest builds redirects, cookies, and absolute URLs against the public scheme. Run Prisma migrate deploy as a one-shot before the new process accepts traffic, and size the pool so each Nest replica does not open unbounded connections to Postgres.
After a rolling restart I hit a cheap readiness path that checks the Nest process and a Prisma ping from inside the proxy container first, then the same path through published 443, and compare status and timing. A short 502 window usually means the edge still talked to a draining worker; tighten max_fails / fail_timeout so a half-dead process leaves the pool quickly, and log upstream status beside request time to separate TLS or vhost drift from an event-loop hang. Prefer one upstream to the Nest listen port and let the process manager own fan-out rather than listing every worker in the proxy.
Node Edge Ops
For a Nest + Prisma + PostgreSQL API the durable edge split is a reverse proxy owning 80/443 while Nest listens only on a private port or Compose network. Resolve the Nest service by internal name, keep the database unpublished on the host firewall, and pin proxy_http_version 1.1 with Connection cleared so keepalive into Node reuses sockets. Always forward Host, X-Forwarded-For, and X-Forwarded-Proto so Nest builds redirects, cookies, and absolute URLs against the public scheme. Run Prisma migrate deploy as a one-shot before the new process accepts traffic, and size the pool so each Nest replica does not open unbounded connections to Postgres.
After a rolling restart I hit a cheap readiness path that checks the Nest process and a Prisma ping from inside the proxy container first, then the same path through published 443, and compare status and timing. A short 502 window usually means the edge still talked to a draining worker; tighten max_fails / fail_timeout so a half-dead process leaves the pool quickly, and log upstream status beside request time to separate TLS or vhost drift from an event-loop hang. Prefer one upstream to the Nest listen port and let the process manager own fan-out rather than listing every worker in the proxy.