Skip to main content

brizzle init

The init command sets up Drizzle ORM in your Next.js project with an interactive setup wizard.

Usage​

brizzle init

This launches an interactive wizard that guides you through:

  1. Select database dialect - SQLite, PostgreSQL, or MySQL
  2. Select driver - Choose from supported drivers for your dialect
  3. Configure paths - Set database directory location
  4. Optional files - Create .env.example and docker-compose.yml
  5. Install dependencies - Automatically install required packages

Generated Files​

The init command creates:

FileDescription
drizzle.config.tsDrizzle Kit configuration
db/index.tsDatabase client with schema
db/schema.tsEmpty schema file for your models
.env.exampleEnvironment variable template (optional)
docker-compose.ymlLocal database setup (PostgreSQL/MySQL only)

It also adds helper scripts to your package.json:

{
"scripts": {
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:push": "drizzle-kit push",
"db:studio": "drizzle-kit studio"
}
}

Supported Drivers​

SQLite​

DriverPackageDescription
better-sqlite3better-sqlite3Native SQLite for Node.js
libsql@libsql/clientTurso edge database or local LibSQL
bun:sqlite(built-in)Bun's native SQLite driver

PostgreSQL​

DriverPackageDescription
postgrespostgrespostgres.js (recommended)
pgpgTraditional node-postgres driver
neon@neondatabase/serverlessNeon serverless PostgreSQL
vercel-postgres@vercel/postgresVercel's managed PostgreSQL

MySQL​

DriverPackageDescription
mysql2mysql2Standard MySQL/MariaDB driver
planetscale@planetscale/databasePlanetScale serverless MySQL

Options​

OptionDescription
-f, --forceOverwrite existing files without prompting
-n, --dry-runPreview changes without writing files
-d, --dialect <dialect>Database dialect (non-interactive mode)
--driver <driver>Database driver (non-interactive mode)
--no-installSkip automatic dependency installation

Non-Interactive Mode​

For CI/CD or scripting, use --dialect and --driver to skip prompts:

# SQLite with better-sqlite3
brizzle init --dialect sqlite --driver better-sqlite3

# PostgreSQL with postgres.js
brizzle init --dialect postgresql --driver postgres

# MySQL with mysql2
brizzle init --dialect mysql --driver mysql2

Examples​

Basic Setup (Interactive)​

npx brizzle init

Follow the prompts to configure your database.

PostgreSQL with Docker​

brizzle init
# Select: PostgreSQL > postgres.js
# Answer "Yes" to docker-compose.yml

Then start your database:

docker compose up -d
cp .env.example .env
# Edit .env with your credentials

Preview Changes​

brizzle init --dry-run

Shows what files would be created without writing anything.

Force Regenerate​

brizzle init --force

Overwrites all existing configuration files.

Next Steps​

After running brizzle init:

  1. Copy the environment file: cp .env.example .env
  2. Set your database connection string in .env
  3. Create your first model:
    npx brizzle model user name:string email:string:unique
  4. Generate and run migrations:
    npm run db:generate
    npm run db:migrate