~/VibeHandbook
$39

Cloudflare

developers.cloudflare.com

D1

What it is

Think of a spreadsheet with neat rows and columns that your app can ask precise questions of, like "show every paid order from June." D1 is Cloudflare's — that organized, queryable table store — built on SQLite. ("Serverless" means there are no servers for you to set up or keep running; the provider handles all of that.) SQL (Structured Query Language) is the standard language for asking a database questions. You create a database, bind it to a Worker or Pages project, and query it with plain SQL over a small JavaScript (Application Programming Interface — the set of commands you call). There are no servers to size or connection pools to manage — Cloudflare handles storage, replication, and scaling, and you pay for the rows you read and write.

Strengths

  • Real SQL (SQLite dialect) — familiar SELECT, JOIN, transactions, and indexes.
  • Serverless: no provisioning, no connection limits, scales to zero.
  • Tight integration with Workers and Pages via a single binding.
  • Read replication places copies near users for low-latency reads.
  • Cheap for typical app workloads, with a usable free tier.

Trade-offs

  • SQLite semantics: huge datasets and very heavy write concurrency are not its sweet spot.
  • Per-database size limits mean very large data may need sharding (splitting across several databases) or R2 (Cloudflare's file storage).
  • Newer than Postgres/MySQL, so tooling and ecosystem are still maturing.
  • Best accessed from the ; using it from outside Cloudflare is less natural.

When to use it

Pick D1 for app data in a Cloudflare-hosted project: user records, content, settings, metadata — anything that fits a relational model and lives alongside your Workers or Pages app.

Vibe coding fit

D1 is a strong default when an is already building on Workers, because the database, schema, and queries all live in the same project. Ask the agent to keep migrations in versioned .sql files and apply them with Wrangler, so the schema is reproducible. The binding makes querying a one-liner inside the handler.

# wrangler.toml
[[d1_databases]]
binding = "DB"
database_name = "app-db"
database_id = "your-d1-id"
# Create a DB and run a migration
npx wrangler d1 create app-db
npx wrangler d1 execute app-db --file=./schema.sql