# Drizzle ORM: A Headless TypeScript ORM for Modern Web Development

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/drizzle-team-drizzle-orm
Generated for open source discovery and AI-assisted research.

Drizzle ORM is a modern, lightweight, and headless TypeScript ORM designed for NodeJS, TypeScript, and JavaScript environments. It offers robust support for various SQL databases, including serverless options, and emphasizes type-safety and extensibility. With over 31,000 stars, Drizzle ORM is a popular choice for developers seeking a performant and flexible solution for their data interactions.

GitHub: https://github.com/drizzle-team/drizzle-orm
OSRepos URL: https://osrepos.com/repo/drizzle-team-drizzle-orm

## Summary

Drizzle ORM is a modern, lightweight, and headless TypeScript ORM designed for NodeJS, TypeScript, and JavaScript environments. It offers robust support for various SQL databases, including serverless options, and emphasizes type-safety and extensibility. With over 31,000 stars, Drizzle ORM is a popular choice for developers seeking a performant and flexible solution for their data interactions.

## Topics

- TypeScript
- ORM
- Node.js
- PostgreSQL
- MySQL
- SQLite
- Bun.js
- Serverless

## Repository Information

Last analyzed by OSRepos: Tue Nov 25 2025 16:00:31 GMT+0000 (Western European Standard Time)
Detail views: 7
GitHub clicks: 13

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction
Drizzle ORM is a powerful and lightweight headless ORM built for TypeScript and JavaScript. It provides a modern approach to interacting with SQL databases, focusing on performance, type-safety, and developer experience. Supporting PostgreSQL, MySQL, and SQLite, Drizzle ORM is designed to work seamlessly across various environments, including serverless functions and edge runtimes. Its zero-dependency architecture and tree-shakeable design make it an efficient choice for any project.

## Installation
Getting started with Drizzle ORM is straightforward. You can install the core package using npm or yarn:

bash
npm install drizzle-orm
# or
yarn add drizzle-orm


For database migrations and schema management, it's recommended to also install `drizzle-kit`:

bash
npm install drizzle-kit
# or
yarn add drizzle-kit


## Examples
Drizzle ORM allows you to define your SQL schemas using TypeScript and build both relational and SQL-like queries. Here's a basic example of defining a schema and performing a simple select query:

typescript
// schema.ts
import { pgTable, serial, text, varchar } from 'drizzle-orm/pg-core';

export const users = pgTable('users', {
  id: serial('id').primaryKey(),
  fullName: text('full_name'),
  phone: varchar('phone', { length: 256 }),
});

// query.ts
import { eq } from 'drizzle-orm';
import { db } from './db'; // Assume db is an initialized Drizzle client
import { users } from './schema';

async function getUserById(userId: number) {
  const result = await db.select().from(users).where(eq(users.id, userId));
  console.log(result);
}

getUserById(1);


## Why use Drizzle ORM?
Drizzle ORM stands out for several reasons:
*   **Lightweight and Zero Dependencies**: At only ~7.4kb minified+gzipped, it's highly efficient with no external dependencies.
*   **Serverless-Ready**: Designed to work in all major JavaScript runtimes, including NodeJS, Bun, Deno, and Cloudflare Workers, making it ideal for serverless architectures.
*   **Broad Database Support**: Compatible with every PostgreSQL, MySQL, and SQLite database, including popular serverless providers like Turso, Neon, PlanetScale, and Vercel Postgres.
*   **Type-Safe and Extensible**: Offers a robust TypeScript experience for declaring SQL schemas and building queries, balancing type-safety with flexibility.
*   **Powerful Ecosystem**: Comes with `Drizzle Kit` for hassle-free migrations and `Drizzle Studio` for effortless data browsing and manipulation.
*   **Performance**: Engineered for speed, allowing developers to build fast applications without introducing data proxies.

## Links
*   [Website](https://orm.drizzle.team){:target="_blank"}
*   [Documentation](https://orm.drizzle.team/docs/overview){:target="_blank"}
*   [Twitter](https://x.com/drizzleorm){:target="_blank"}
*   [Discord](https://driz.link/discord){:target="_blank"}