Overview
Introduction to Configuration
Configuring Drizzle Kit allows you to define how database commands—such as generating migrations, pushing schema updates, and running Drizzle Studio—interact with your database. By setting up a configuration file, you can specify your database dialect, connection credentials, file paths, and advanced options in one centralized place.
Creating a Configuration File
To get started, create a configuration file named in your project's root directory.
- Create a file named
drizzle.config.tsin your project root. - Define and export your configuration object using the required
dialect,schema, and credential settings.
Here is a sample configuration file for a PostgreSQL database:
import type { Config } from 'drizzle-kit';
export default {
dialect: 'postgresql',
schema: './src/schema.ts',
out: './drizzle',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
} satisfies Config;Note
Make sure you have installed the required database driver packages in your project before running commands with your configuration file.
Configuration Options Reference
The configuration options available for your setup control how Drizzle Kit connects to and processes your database schema.
| Option | Type | Description |
|---|---|---|
dialect | string | Mandatory database dialect. Supported dialects: postgresql, mysql, sqlite, singlestore, gel, turso. |
schema | string | string[] | Path or glob pattern to your database schema file or files. |
out | string | Output folder for generated migration files and database snapshots. Defaults to ./drizzle. |
driver | string | Optional driver used when accessing specific services. Supported drivers: aws-data-api, d1-http, expo, turso, pglite. |
dbCredentials | object | Connection credentials required to connect to your database (such as connection strings or host details). |
breakpoints | boolean | Enables or disables SQL statement breakpoints in generated migrations. True by default. |
verbose | boolean | Prints all statements that will be executed during push commands. |
strict | boolean | Always asks for confirmation before executing statements to sync your schema with the database. |
casing | string | Controls column casing for serialization. Supported values: camelCase, snake_case. |
tablesFilter | string | string[] | Glob pattern or array of patterns to filter tables during push commands. |
schemaFilter | string | string[] | Defines which schema in PostgreSQL to use for introspection or push commands. |
Database Credentials by Dialect
Depending on the chosen dialect, the dbCredentials object expects specific properties:
- PostgreSQL: Can use a connection URL (
url) OR individual fields (host,port,user,password,database,ssl). Alternatively, when using theaws-data-apidriver, it requiresdatabase,secretArn, andresourceArn. - MySQL: Can use a connection URL (
url) OR individual fields (host,port,user,password,database,ssl). - SQLite: Requires a database file path or URL (
url). - Turso / LibSQL: Requires a database URL (
url) and an optional authentication token (authToken). - SingleStore: Can use a connection URL (
url) OR individual fields (host,port,user,password,database).
Tip
Use environment variables (via process.env.DATABASE_URL) inside your configuration file to keep sensitive credentials secure and out of version control.