Drizzle | Cloudflare D1 HTTP API with Drizzle Kit
This guide assumes familiarity with:

To use Drizzle kit with Cloudflare D1 HTTP API, you need to configure the drizzle.config.ts file like this:

import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './src/schema.ts',
  out: './migrations',
  dialect: 'sqlite',
  driver: 'd1-http',
  dbCredentials: {
    accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
    databaseId: process.env.CLOUDFLARE_DATABASE_ID!,
    token: process.env.CLOUDFLARE_D1_TOKEN!,

You can find accountId, databaseId and token in Cloudflare dashboard.

  1. To get accountId go to Workers & Pages -> Overview -> copy Account ID from the right sidebar.
  2. To get databaseId open D1 database you want to connect to and copy Database ID.
  3. To get token go to My profile -> API Tokens and create token with D1 edit permissions.

After you have configured drizzle.config.ts file, Drizzle Kit lets you run migrate, push, introspect and studio commands using Cloudflare D1 HTTP API.

You can also use Drizzle Chrome Extension to browse Cloudflare D1 database directly in their admin panel.