hono-drizzle-cloudflare-d1-practical-recipes ×

Hono + Drizzle + Cloudflare D1 — practical recipes

Three posts, three layers. Each one can stand alone; read in order they compound into the full working picture.

  1. Setting up D1 with Drizzle in Hono — wiring it up. wrangler.jsonc, Drizzle config, the first migration, a basic Hono handler, Drizzle Studio against the local Miniflare SQLite, pushing to production.

  2. Drizzle with Cloudflare D1 — the everyday usage guide — the read, write, and soft-delete patterns you reach for every day. Dynamic where composition, joins with projected fields, RETURNING, audit columns, and the sql template.

  3. D1 has no transactions — using client.batch() for multi-step writes — the first real gotcha. D1 has no BEGIN/COMMIT; client.batch([...]) is the answer, and it has four subtle rules worth writing down.

The examples in parts 2 and 3 come from DuitGee — a fund-based expense tracker I’m building on this stack. Real schema names, real handlers, real production code.

Posts in this series

  1. 1. Setting up D1 Database with Drizzle in a Hono Cloudflare Worker App
  2. 2. Drizzle with Cloudflare D1 — the everyday usage guide
  3. 3. D1 has no transactions — using client.batch() for multi-step writes