Skip to content
Book a free 30-minute call with an engineer

NestJS development

Node.js backends with a clear structure

TypeScriptPrismaTypeORMclass-validatorSwagger / OpenAPIApollo GraphQLBullMQPassportJest

Backend

Building with NestJS

NestJS gives a Node.js codebase a fixed shape: modules, providers, controllers and dependency injection. We reach for it when several developers will work on the same backend for years and we want the fifth developer to find things where the first one put them.

We've used it for single APIs and for groups of services talking over queues. Our usual setup is NestJS on Fastify, Prisma or TypeORM, generated OpenAPI docs and tests that run on every pull request. For a tiny service or a quick prototype it's more framework than you need.

invoices.controller.tsTypeScript
1@Controller("invoices")​
2@UseGuards(JwtAuthGuard, TenantGuard)​
3export class InvoicesController {​
4 constructor(private readonly invoices: InvoicesService) {}​
5​
6 @Get()​
7 list(@Tenant() tenantId: string, @Query() q: ListDto) {​
8 return this.invoices.list(tenantId, q);​
9 }​
10​
11 @Post(":id/send")​
12 send(@Tenant() tenantId: string, @Param("id") id: string) {​
13 return this.invoices.send(tenantId, id);​
14 }​
15}​

The kind of NestJS code our team writes every week.

What we build with NestJS

  1. 01

    Modular API platforms

    One module per business domain, with guards for auth, interceptors for logging and OpenAPI docs generated from the code.

  2. 02

    GraphQL servers

    Code-first schemas with DataLoader batching, subscriptions and per-field permission checks.

  3. 03

    Microservices

    NestJS services over Redis, NATS, RabbitMQ or Kafka that share the same patterns, so moving between them is easy.

  4. 04

    Multi-tenant SaaS

    Tenant isolation, role-based access, subscription billing and an audit trail of who changed what.

  5. 05

    Background jobs & schedulers

    Queues, cron jobs and long-running workflows on BullMQ and @nestjs/schedule.

  6. 06

    Migrations to NestJS

    Breaking an overgrown Express app into NestJS modules route by route, while features keep shipping.

Why teams pick NestJS

01

Conventions out of the box

Everyone puts modules, providers and controllers in the same places, which cuts review time on big teams.

02

Easy to test

Dependency injection lets us swap the database or a payment provider for a fake in tests with one line.

03

TypeScript throughout

Typed DTOs and services catch mismatched fields at compile time.

04

One codebase, several transports

The same service classes can answer HTTP, GraphQL, WebSocket and queue messages.

Good fits

  • Enterprise SaaS backends
  • B2B platforms with complex permissions
  • Microservice architectures
  • GraphQL APIs for web and mobile

Where we use it

NestJS questions

When should I choose NestJS over plain Express?

Pick NestJS if the backend will grow past a couple of dozen endpoints, if more than two or three people will work on it, or if you need GraphQL, WebSockets or queues next to REST. The structure costs a day or two up front. For a single small service, Fastify or Express on its own is enough.

Does NestJS hurt performance?

Barely. It can run on Fastify instead of Express, and in practice slow endpoints come from database queries, network calls or missing caches. We profile those first. Fixing a missing index usually saves far more time than any framework change.

Can NestJS power a GraphQL API for our mobile app?

Yes. We build code-first schemas with batching to avoid N+1 queries, cursor pagination, subscriptions for live updates and permission checks per field. Your Flutter or React Native app then asks for exactly what each screen shows.

How do you structure a NestJS project for long-term maintenance?

Folders follow business domains, not technical layers. Controllers stay thin and logic lives in services. Databases and third-party APIs sit behind adapters so they can be replaced. Linting, CI tests and short architecture decision records keep it that way as the team changes.

Pairs well with