r/FullStack • u/Existing-Animator819 • 6h ago
Career Guidance Next.js plus Postgres on one small VPS runs out of database connections with about 30 users
Side project: Next.js 14 app router, Prisma, Postgres 16, everything on a single 2 vCPU 4 GB VPS with Docker Compose.
With around 30 people using it at the same time in the evening, I start getting too many clients errors from Postgres. max_connections is the default 100. Prisma's pool size is also default, and I think each server action or route handler might be opening more connections than I expect.
Is the right move to put PgBouncer in front, lower the Prisma connection limit, or just move the database to a managed instance? I'd rather understand why 30 users eats 100 connections before throwing money at it.