Skip to main content

Quick installation

Install Drizzle ORM and Drizzle Kit using your preferred package manager:
drizzle-orm: The core ORM library for your applicationdrizzle-kit: CLI companion for migrations and database management (dev dependency)

Database drivers

Drizzle ORM requires a database driver to connect to your database. Install the driver that matches your database:

PostgreSQL drivers

The most popular PostgreSQL driver for Node.js.

MySQL drivers

Fast MySQL driver for Node.js with prepared statement support.

SQLite drivers

Fast synchronous SQLite driver for Node.js.

Project setup

After installing Drizzle ORM and your database driver, set up your project structure:
1

Create schema directory

Create a directory for your database schema files:
2

Configure Drizzle Kit

Create a drizzle.config.ts file in your project root:
3

Set up environment variables

Create a .env file with your database connection string:
.env
Never commit your .env file to version control. Add it to .gitignore.

Verify installation

Create a simple test file to verify your installation:
src/db/test.ts
Run the test:

Optional dependencies

TypeScript

Drizzle works best with TypeScript. If you haven’t installed it:

Schema validation

Integrate with runtime validation libraries:

Next steps

Quickstart

Build your first application with Drizzle ORM

Schema Declaration

Learn how to define your database schema

Database Connection

Configure database connections for different drivers

Migrations

Set up database migrations with Drizzle Kit
Having issues? Check our best practices guide or join our Discord community for help.