drizzle-orm

v0.45.2 Apache-2.0

Drizzle ORM package for SQL databases

Weekly Downloads
5.6M
Stars
33.7K
Forks
1.3K
Open Issues
1.7K
Gzip Size
8.6 kB
Unpacked Size
10.4 MB
Dependencies
0
Last Updated
1mo ago

drizzle-orm Download Trends

Download trends for drizzle-orm06.8M13.6M20.4M27.2MFeb 2025MayAugNovFebApr 2026
drizzle-orm

About drizzle-orm

Drizzle ORM is a TypeScript-first SQL ORM designed to provide a type-safe database access layer for Node.js and other JavaScript runtimes. It addresses the common challenge of bridging the gap between application code and relational databases, offering a compile-time guarantee against common SQL-related errors.

The core philosophy of Drizzle ORM is to provide a developer experience that feels native to TypeScript, with minimal abstraction and a focus on developer productivity without sacrificing performance. It aims to be intuitive for developers familiar with SQL and TypeScript, offering a familiar yet type-enhanced way to interact with databases.

Drizzle ORM achieves type safety through its unique schema definition API, which allows you to define your database schema in TypeScript. This schema definition is then used to generate type-safe query builders, such as `select`, `insert`, `update`, and `delete`. It also introduces concepts like `pg`, `mysql`, and `sqlite` for database interactions, and its query builder offers a declarative way to construct SQL queries.

This ORM integrates seamlessly with various JavaScript and TypeScript environments, including Node.js runtimes, Bun.js, and serverless functions. It has a flexible integration strategy, allowing it to be used with popular frameworks and runtime environments without imposing significant constraints. Its companion package, `drizzle-kit`, provides tools for schema migration and database interaction management.

With a bundle size of only 8.6 kB (gzip), Drizzle ORM is highly performant and has a minimal impact on application load times. Its robust tooling and strong community support, evidenced by 33.5K GitHub stars, indicate a mature and actively developed project, though the 1.6K open issues suggest areas for ongoing development and community engagement.

While Drizzle ORM excels in type safety and performance, developers should be aware that it is primarily a SQL query builder. It does not include features like automatic data mapping to complex object structures found in some other ORMs, requiring developers to manage data transformations more explicitly. Its focus on SQL means that developers must have a solid understanding of SQL concepts to leverage it effectively.

When to use

  • When building applications requiring strict compile-time type safety for database operations across TypeScript projects.
  • When leveraging Drizzle ORM's schema definition to generate type-safe query builders for `select`, `insert`, `update`, and `delete` statements.
  • When integrating with Node.js, Bun.js, or serverless environments that benefit from a lightweight ORM.
  • When needing to define database schemas in TypeScript and manage migrations using the `drizzle-kit` tool.
  • When working with multiple SQL database dialects like PostgreSQL, MySQL, or SQLite and requiring a unified, type-safe API.
  • When a minimal bundle size is critical for client-side or edge functions.

When NOT to use

  • If your primary need is an ORM that abstracts away raw SQL entirely and provides automatic complex object-relational mapping, a different approach might be more suitable.
  • When you are working in an environment that strictly forbids or does not support TypeScript.
  • If you only need basic data storage and retrieval without complex query logic, consider simpler solutions like direct SQL drivers or minimal query builders.
  • When your team is not comfortable with SQL concepts or TypeScript, as Drizzle ORM's effectiveness is tied to proficiency in both.
  • For projects that require features like automatic schema generation from existing databases without custom tooling or significant setup.

drizzle-orm Alternatives

drizzle-orm Categories