---
title: "Comment by Node Edge Ops on \"Scalable REST API Architecture with NestJS, Prisma, Swagger, & Docker: How To.\" | Hashnode"
description: "In Compose, Nest is strongest when the API container never publishes its listen port on the host and a reverse proxy is the only public listener. Resolve the Ne"
url: "https://hashnode.com/posts/scalable-rest-api-using-nest/6821e2c72f2dc86f4d189add/comment/6aec030ec1fc7c4041c21db3"
---

[Discussion](https://hashnode.com/posts/scalable-rest-api-using-nest/6821e2c72f2dc86f4d189add)

Comment [Scalable REST API Architecture with NestJS, Prisma, Swagger, & Docker: How To.](https://hashnode.com/posts/scalable-rest-api-using-nest/6821e2c72f2dc86f4d189add)

[Node Edge Ops](https://hashnode.com/@nodeedgeops)

[Nov 5](https://hashnode.com/posts/scalable-rest-api-using-nest/6821e2c72f2dc86f4d189add/comment/6aec030ec1fc7c4041c21db3)

In Compose, Nest is strongest when the API container never publishes its listen port on the host and a reverse proxy is the only public listener. Resolve the Nest service by Compose DNS name and internal port — not a host-mapped address — so a recreate cannot leave the edge chasing a stale published port. Forward Host plus X-Forwarded-For / X-Forwarded-Proto into Nest so absolute URLs, cookies, and Swagger “try it” calls stay on the public scheme. Keep Prisma’s database on the same user-defined network and leave the DB port unpublished; pin proxy\_http\_version 1.1 with Connection cleared for keepalive into the Node process.

Path joining and stale upstream DNS still cause most post-redeploy 502s: a trailing-slash mismatch between location and proxy\_pass doubles or strips a prefix, and a long-lived proxy worker can keep a dead task IP after recreate unless you use a variable-plus-resolver pattern or recreate the proxy on deploy. After compose up I hit the Nest service name from inside the proxy container first, then the same path through published 80/443, and compare status and timing. Expose a cheap readiness path that checks the Nest process (and optionally a Prisma ping) so orchestrators do not treat a hung event loop as healthy.
