Drizzle | Cloudflare D1 HTTP API with Drizzle Kit
This guide assumes familiarity with:
- Drizzle Kit
- Drizzle Studio
- Drizzle Chrome Extension
- You should have installed
[email protected]
or higher - You should have Cloudflare account, deployed D1 database and token with D1 edit permissions
To use Drizzle kit with Cloudflare D1 HTTP API, you need to configure the drizzle.config.ts
file like this:
You can find accountId
, databaseId
and token
in Cloudflare dashboard.
- To get
accountId
go to Workers & Pages -> Overview -> copy Account ID from the right sidebar. - To get
databaseId
open D1 database you want to connect to and copy Database ID. - 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.