NestJS Logo

Batteries included

Nest is a batteries-included Node.js framework, with first-party packages for authentication, data access, queues, mail, file storage, observability and AI. Together with the core, they cover what a backend needs beyond routing, from validation and configuration to GraphQL, WebSockets, microservices, OpenAPI and testing. This page lists them by need, with the chapter that documents each one.

Each battery is its own package, so a project installs only what it uses, and they plug in the same way: a module you import, providers you inject, and decorators on your classes.

What a new project starts with#

nest new generates a TypeScript project with modules, dependency injection, an HTTP server, a test setup, and scripts to build, run and watch it. The CLI also sets up NestJS Observe for tracing and error monitoring, and the official agent skills for coding agents. See First steps.

These come with the core, with no extra package:

NeedWhat Nest gives you
Validate request bodies, parameters and queriesValidation pipes, with class-validator classes or Zod, Valibot, ArkType and other Standard Schema libraries
Shape and filter responsesSerialization
Protect routes and handle errorsGuards, interceptors and exception filters
Security headers, CSRF protection and CORSSecurity headers, CSRF protection and CORS, on every HTTP adapter
CookiesCookies, on every HTTP adapter
File uploadsFile upload and streaming, with type and size validators. On Fastify, install @fastify/multipart as well
Stream responses and server-sent eventsStreaming responses and Server-Sent Events
Version an APIVersioning
LoggingLogger
Lifecycle hooks and graceful shutdownLifecycle events
An interactive console into a running applicationREPL
Run on Express, Fastify or node:httpHTTP adapters

First-party packages, by need#

The packages below are maintained by the Nest core team. Install the ones a project needs with npm.

Security

NeedPackageChapter
Sign-in with passwords, sessions, access and refresh tokens, two-factor authentication, magic links, OpenID Connect and API keys@nestjs/authenticationAuthentication
Permissions checked in policies@nestjs/authorizationAuthorization
Rate limiting@nestjs/throttlerRate limiting
Sign and verify JWTs@nestjs/jwtPassport (auth)

Data

NeedPackageChapter
SQL with Drizzle ORM@nestjs/drizzleDrizzle
SQL with TypeORM@nestjs/typeormTypeORM
SQL with Sequelize@nestjs/sequelizeSequelize
MongoDB with Mongoose@nestjs/mongooseMongoDB
Caching@nestjs/cache-managerCaching

Application services

NeedPackageChapter
Configuration and environment variables@nestjs/configConfiguration
Background jobs@nestjs/bullmqQueues
Cron jobs, intervals and timeouts@nestjs/scheduleTask scheduling
In-process events@nestjs/event-emitterEvents
Calls to other HTTP APIs@nestjs/http-clientHTTP client
Email from templates, over SMTP or an email API@nestjs/mailMail
Files in a local folder, S3 or an S3-compatible store, with signed URLs@nestjs/storageFile storage
Translations@nestjs/i18nInternationalization
Static files@nestjs/serve-staticServe static
Commands, queries and events kept apart@nestjs/cqrsCQRS

Reliability

NeedPackageChapter
Retries, timeouts and circuit breakers@nestjs/resilienceResilience
Requests that are safe to repeat@nestjs/idempotencyIdempotency keys
Messages sent in the same transaction as the data@nestjs/outboxTransactional outbox
Long-running processes that survive restarts@nestjs/workflowsDurable workflows
One instance at a time doing a piece of work@nestjs/locksDistributed locks
Webhooks: signed and retried when you send them, verified when you receive them@nestjs/webhooksWebhooks
Health checks@nestjs/terminusHealth checks

APIs and transports

NeedPackageChapter
OpenAPI documents and Swagger UI@nestjs/swaggerOpenAPI
GraphQL, with Apollo or Mercurius@nestjs/graphqlGraphQL
WebSockets, with Socket.IO or ws@nestjs/websocketsGateways
Redis, MQTT, NATS, RabbitMQ, Kafka and gRPC transports@nestjs/microservicesMicroservices
MCP servers for AI assistants@nestjs/mcpMCP

AI

NeedPackageChapter
Language models, agents that call your providers as tools, and embeddings@nestjs/aiAI

Observability and operations

NeedPackageChapter
Tracing, error monitoring and logs, with NestJS Observe@nestjs/observeObservability
A live graph of modules, providers and routes@nestjs/devtools-integrationDevtools
Deployment to AWS with Mau@nestjs/mauDeployment

Tooling

NeedPackageChapter
Generate projects, modules, resources and libraries@nestjs/cliCLI
Unit and end-to-end tests that replace providers@nestjs/testingTesting

Works with what you already use#

The batteries plug into the services and libraries your team already runs:

  • Your database. First-party packages integrate Drizzle, TypeORM, Sequelize and Mongoose, and Prisma and MikroORM have integrations of their own, so you work with the ORM your team knows. Data compares them.
  • Your infrastructure. Background jobs run on Redis, through BullMQ. Mail goes out over SMTP or an email provider's API, and files are kept in a local folder or a bucket such as S3 or R2.
  • Any model provider. @nestjs/ai builds on the AI SDK, so it works with the provider package of the models you use, such as @ai-sdk/anthropic or @ai-sdk/openai.
  • Your frontend. Nest builds the backend for web and mobile apps alike. It renders server-side pages with Model-View-Controller, and a separate frontend such as Next.js can share types with the API.

Common questions#

What does batteries-included mean?#

A batteries-included framework ships, next to routing, the pieces most applications need: sign-in, permissions, data access, configuration, background jobs, email and testing, maintained by one team and built to work together. A minimal framework, such as Express, leaves each of those choices to you. Nest takes the batteries-included approach, and keeps each battery an optional package.

Is NestJS batteries-included?#

Yes. Besides routing, validation and dependency injection in the core, the Nest team maintains the packages listed on this page, from authentication and queues to webhooks, workflows, GraphQL, WebSockets, mail and translations. Nest is written in TypeScript and every package is typed, so it's also a batteries-included TypeScript framework.

Does Nest have an ORM?#

Nest has first-party packages for four: Drizzle, TypeORM and Sequelize for SQL databases, and Mongoose for MongoDB. Each registers the database connection, and the ORM's models or repositories, as providers you inject. Most of the tutorials use Drizzle, and Data compares them.

Does Nest have built-in authentication?#

Yes: @nestjs/authentication signs users in with passwords, sessions, access and refresh tokens, two-factor authentication, magic links, OpenID Connect providers such as Google, and API keys, with no Passport strategies to configure. @nestjs/authorization checks permissions in policies.

Is Nest a full-stack framework?#

Nest is a backend framework. It can render server-side pages with Model-View-Controller, but most applications pair it with a separate frontend, such as Next.js, a mobile app, or both.

How do I add a battery?#

Install its package with npm and import its module in your AppModule, as each chapter shows. First steps creates the project, and the tutorials add the packages an application needs one chapter at a time.

See them together#

Each tutorial builds a complete application from an empty project, and most combine several of these packages: the multi-tenant SaaS backend and the e-commerce backend, for example. Each tutorial has a matching example repository on GitHub.

To compare Nest with minimal frameworks, see Nest vs Fastify, Express and Hono. If you're coming from another batteries-included framework, the guides for Laravel, Django, Spring Boot and ASP.NET Core map its concepts to Nest.

Edit on GitHub

Support us

Nest is an MIT-licensed open source project. It can grow thanks to the support of these awesome people. If you'd like to join them, please read more here.

Principal Sponsors

SerpApi LogoTrilon LogoMojam Logo

Sponsors / Partners

Become a sponsor