---
title: "Discussion on \"NestJS + Prisma + PostgreSQL: My Go-To Freelance Backend Stack\" | Hashnode"
description: "Discussion on \"NestJS + Prisma + PostgreSQL: My Go-To Freelance Backend Stack\". Why I use NestJS, Prisma, and PostgreSQL on every freelance project. Real setup, folder structure, schema design, and lessons learned from production builds."
url: "https://hashnode.com/posts/nestjs-prisma-postgresql-backend-stack/69dc76b1be21b1bd01330ad4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [NestJS + Prisma + PostgreSQL: My Go-To Freelance Backend Stack](https://arihantjain916.hashnode.dev/nestjs-prisma-postgresql-backend-stack?utm_source=hashnode&utm_medium=feed)

Why I use NestJS, Prisma, and PostgreSQL on every freelance project. Real setup, folder structure, schema design, and lessons learned from production builds.

Apr 13 · 10 min read · arihantjain916.hashnode.dev  
Read the article

-   [#nestjs](https://hashnode.com/tag/nestjs)
-   [#prisma](https://hashnode.com/tag/prisma)
-   [#postgresql](https://hashnode.com/tag/postgresql)
-   [#backend](https://hashnode.com/tag/backend)
-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#typescript](https://hashnode.com/tag/typescript)
-   [#freelance](https://hashnode.com/tag/freelance)
-   [#webdev](https://hashnode.com/tag/webdev)

## Written by

[Arihant Jain](https://hashnode.com/@arihantjain916)

@arihantjain916 · Delhi, India

  
[View profile](https://hashnode.com/@arihantjain916)

## Responses 1

Markdown supported · ⌘↵ to post

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

[Nov 5](https://hashnode.com/posts/nestjs-prisma-postgresql-backend-stack/69dc76b1be21b1bd01330ad4/comment/6aec0b0bb1efaf4d45ab5c86)

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.
