Skills / Engineering / Cloudflare D1

Cloudflare D1

Build on Cloudflare D1, the serverless SQLite database for Workers. Covers schema and migrations, the Workers binding and query API, prepared statements and batching, production seeding, read replication, and pairing D1 with Drizzle for type-safe access.

This skill helps you use Cloudflare D1 from Workers. It designs schemas and manages migrations with Wrangler, binds D1 to Workers, runs parameterized queries and batches, seeds production data safely, enables read replication for low-latency global reads, and integrates Drizzle ORM for type-safe queries on the edge.

cloudflare d1 sqlite edge-database workers

When to use

Use when building on Cloudflare D1 — schema design and migrations, the Workers binding and query API, prepared statements and batching, production seeding, read replication, or Drizzle integration.

Examples

Migrations + seeding

Safe production data

Set up Cloudflare D1 migrations with Wrangler and a repeatable production seeding script that only inserts missing reference rows

Query from a Worker

Bind and batch

Bind D1 to my Worker and write a batched, parameterized query to insert an order and its line items in one round trip
Added to wishlist