Overview
Nest is database-agnostic, so you can integrate it with any SQL or NoSQL database. At the most basic level, connecting Nest to a database means loading the appropriate Node.js driver for that database, just as you would with Express or Fastify, and making the client available to the rest of the application through a provider.
Most applications work at a higher level of abstraction, with an ORM or a query builder. The chapters in this category cover the following integrations:
- TypeORM (
@nestjs/typeorm): an ORM with decorator-based entities and the repository pattern. It supports most SQL databases, as well as MongoDB. - Drizzle (
@nestjs/drizzle): a lightweight, TypeScript-first ORM. You declare tables with plain functions and write queries with a SQL-like query builder, and Drizzle infers every result type from the schema. - MongoDB (
@nestjs/mongoose): Mongoose schemas and models for MongoDB. - Prisma: an ORM that generates a type-safe client from a schema file. It has no Nest-specific package: you expose the generated client through a provider.
- MikroORM (
@mikro-orm/nestjs, maintained by the MikroORM team): an ORM based on the Data Mapper, Unit of Work, and Identity Map patterns. - Sequelize (
@nestjs/sequelize): a promise-based ORM for SQL databases. With thesequelize-typescriptpackage, you declare models with decorators.
The Nest team maintains the @nestjs/typeorm, @nestjs/drizzle, @nestjs/mongoose, and @nestjs/sequelize packages. They add Nest-specific features, such as repository or model injection, testability, and asynchronous configuration.
You can also use any other library directly. For example, see how to build a Nest module for Knex.js. To cache query results, see Caching.

