GraphQL in NestJS, for Spring Developers: Production Mode Is Not Enough

1 October 2026 nestjstypescriptnodejsjavaspring-bootgraphql
PDF The design sheet The full architecture and the verified references. Free, no email.
Thumbnail for GraphQL in NestJS, for Spring Developers: Production Mode Is Not Enough 3:53
Watch on YouTube, or read on below.
Run this yourself → Clone the repo, docker compose up, and watch it happen

A GraphQL query hits a resolver whose SQL fails. Spring for GraphQL gave the client a generic internal error and an id to look up. NestJS with Apollo gave the client the raw Postgres error and a seven line stack trace. Measured on 1 October 2026 against one Postgres. Your GraphQL error contract depends on more than your resolver.

Production mode hid the stack, not the database error

With NODE_ENV=production, the stack trace was gone and the Postgres message was still there. A formatError that masks anything GraphQL itself did not raise made it Internal server error. Production mode is not an error masking policy; if the client must not see infrastructure errors, make that policy explicit.

The rest of the delta

N plus one is the same on both stacks: 21 statements for 20 orders, and 2 with @BatchMapping or a DataLoader created per request. The same invalid query answered HTTP 200 or 400 on Spring depending on the media type the client accepted, and 400 for both on Apollo, so test monitors and retries during the move. Introspection answered on both until NODE_ENV=production on the Apollo-backed Nest setup.

The full Spring GraphQL deep dive is on the channel. The full code for every measurement is in the repository, and the free design sheet above has the checklist on one page.


Watch next

New videos land on Code with Sam - subscribe there if this was useful.

Get the interview pack

A free, practical pack for engineers preparing for senior backend interviews - the questions that actually get asked, and how to answer them like someone who has done the work.

New articles and videos when they land. No spam, and one click to leave.