Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Neon · Const

Drizzle Kit

Drizzle Kit is the CLI companion used with Drizzle ORM to manage schema migrations for a Neon Postgres database. Configure it in drizzle.config.ts, generate migration SQL, and apply those migrations with the CLI.

How it works

Drizzle Kit is the migration-focused CLI used alongside Drizzle ORM and Neon. A drizzle.config.ts file defines the schema location, migration output directory, SQL dialect, and database credentials; generated SQL migrations can then be applied to Neon with the migrate command.

Syntax

npx drizzle-kit migrate

Key points

  • Drizzle Kit centralizes schema and migration settings in drizzle.config.ts.
  • The configuration connects the source schema location with the directory that receives generated migrations.
  • After generating SQL migration files, use Drizzle Kit to apply them to the Neon database.
  • The documented CLI command for applying the generated migrations is npx drizzle-kit migrate.

Common mistakes

  • The migration command depends on drizzle.config.ts for its connection settings, so keep that file correctly configured before applying migrations.

Example: Configure Drizzle with Neon

import 'dotenv/config';
import { neon } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';

const sql = neon(process.env.DATABASE_URL!);
const db = drizzle(sql);

console.log('Drizzle client configured for Neon');

This initializes a Drizzle ORM client using Neon's serverless HTTP driver; run migrations separately with Drizzle Kit.

When to use it

Generate schema migrations

You changed a Drizzle schema and need reproducible SQL changes tracked in a migration directory.

Apply migrations to Neon

A deployment or development database must receive previously generated schema changes.

Centralize migration configuration

A project needs migration behavior shared consistently across developers and environments.

Interview questions

QWhat role does Drizzle Kit play in a Neon application?

Drizzle Kit is installed as a development dependency and is used for database migrations. It reads drizzle.config.ts to locate the schema and determine where migration files should be written.

Follow-up: How are generated migrations applied? Run npx drizzle-kit migrate; the command reads the configuration and applies the generated SQL files to Neon.

QWhat belongs in drizzle.config.ts?

The configuration file specifies the schema path, migration output directory, PostgreSQL dialect, and database URL. This separates migration configuration from the application code that creates the Drizzle client.

Follow-up: Why should the schema and output paths be explicit? Drizzle Kit needs them to discover schema changes and know where to create migration files.

QHow do you run Drizzle Kit migrations?

Install drizzle-kit with the package manager as a development dependency, then run its CLI through npx. The documented migration workflow uses npx drizzle-kit migrate after the configuration and migration files are ready.

Follow-up: What is the distinction between generating and applying migrations? Generation creates SQL from schema changes; migration executes those SQL changes against Neon.

  • Drizzle ORM
  • drizzle.config.ts
  • @neondatabase/serverless
  • drizzle-kit generate
  • drizzle-kit migrate

Source: Connect from Drizzle to Neon. Checked 2026-10-16.