drizzle-orm README

The project's README from github.com/drizzle-team/drizzle-orm. As one markdown file: README.md.


Headless ORM for NodeJS, TypeScript and JavaScript 🚀

Website • Documentation • Twitter • Discord


What's Drizzle?

Drizzle is a modern TypeScript ORM developers wanna use in their next project. It is lightweight at only ~7.4kb minified+gzipped, and it's tree shakeable with exactly 0 dependencies.

Drizzle supports every PostgreSQL, MySQL and SQLite database, including serverless ones like Turso, Neon, Xata, PlanetScale, Cloudflare D1, FlyIO LiteFS, Vercel Postgres, Supabase and AWS Data API. No bells and whistles, no Rust binaries, no serverless adapters, everything just works out of the box.

Drizzle is serverless-ready by design. It works in every major JavaScript runtime like NodeJS, Bun, Deno, Cloudflare Workers, Supabase functions, any Edge runtime, and even in browsers.
With Drizzle you can be fast out of the box and save time and costs while never introducing any data proxies into your infrastructure.

While you can use Drizzle as a JavaScript library, it shines with TypeScript. It lets you declare SQL schemas and build both relational and SQL-like queries, while keeping the balance between type-safety and extensibility for toolmakers to build on top.

Ecosystem

While Drizzle ORM remains a thin typed layer on top of SQL, we made a set of tools for people to have best possible developer experience.

Drizzle comes with a powerful Drizzle Kit CLI companion for you to have hassle-free migrations. It can generate SQL migration files for you or apply schema changes directly to the database.

We also have Drizzle Studio for you to effortlessly browse and manipulate data in your database of choice.

Documentation

Check out the full documentation on the website.

Our sponsors ❤️

drizzle-orm (drizzle-team/drizzle-orm)

Searching Database…

这是什么?Drizzle ORM 是一个现代、轻量的 TypeScript ORM,用于从 Node.js、Bun、Deno 或边缘/浏览器运行环境操作 SQL 数据库。
它是一个库,还是还附带其他工具?它主要是一个可以在代码中导入使用的库,同时还附带一个配套命令行工具(Drizzle Kit)用于数据库迁移,以及一个图形界面工具(Drizzle Studio)用于浏览数据。
我该怎么把它加到项目里?将 drizzle-orm 作为依赖安装,用 TypeScript 声明你的 SQL 数据结构(schema),然后就可以用关系型或类 SQL 的查询来操作数据。使用 Drizzle Kit 生成并执行迁移。
使用它需要 Rust 二进制文件或额外的适配器吗?不需要。它没有任何依赖,也不包含 Rust 二进制文件,开箱即用,无需单独的无服务器适配器。
它到底支持哪些数据库和运行环境?它支持 PostgreSQL、MySQL 和 SQLite(包括 Turso、Neon、Xata、PlanetScale、Cloudflare D1、Vercel Postgres、Supabase 和 AWS Data API 等无服务器版本),可在 Node.js、Bun、Deno、Cloudflare Workers、边缘运行时,甚至浏览器中运行。
我能只用普通 JavaScript 来用它,还是必须用 TypeScript?你可以把它当作普通 JavaScript 库使用,但它真正的优势在于配合 TypeScript,提供类型安全的 schema 和查询。
Drizzle 会在我的应用和数据库之间加一层数据代理吗?不会。它不会添加任何数据代理层,让你的基础设施保持简单,并适合无服务器部署。
这个库体积有多大?Drizzle ORM 非常轻量,压缩并 gzip 后约 7.4kb,并且支持摇树优化(tree-shaking)。
Drizzle Kit 是做什么的?Drizzle Kit 是配套的命令行工具,可以根据你的 schema 生成 SQL 迁移文件,或直接将 schema 变更应用到数据库。
Drizzle Studio 是什么?Drizzle Studio 是生态系统自带的工具,可以让你通过图形界面浏览和修改数据库中的数据。
我为什么要选它,而不选更重的 ORM?Drizzle 是直接构建在 SQL 之上的一层轻薄的类型化封装,没有依赖,也没有隐藏的运行时开销,因此无需额外适配器,就能在服务器、边缘函数到浏览器的任何地方运行。
What are similar projects?orm, directus, ent, sequelize, typeorm, crystal, sqlit, sqlx
Size
61.1 MB
Stars
36.1K
Age
5y
Commits · 90 Days