# Cloudflare D1 [[Cloudflare]] D1 is a serverless SQL database built on [[SQLite]], deployed at the edge with read replicas across Cloudflare's network. Each database is a SQLite file managed by Cloudflare; queries run via HTTP from [[Cloudflare Workers]] bindings or REST API. Read replication is opt-in: you turn it on per database, and only queries that go through the Sessions API read from replicas (writes still land on the primary, and replicas catch up asynchronously). D1 sits in the same niche as Turso and LiteFS — SQLite-as-a-service, optimized for read-heavy edge workloads. It's not Postgres-class (no advanced types, limited concurrent writes per database) but for most application backends, it's enough — and it's free up to 5M rows read per day with no cold starts. ## Why It Matters SQLite is finally a credible primary database for production apps, and D1 makes it serverless-native: bindings, automatic backups (Time Travel: point-in-time restore over the last 30 days on Paid, 7 on Free), no connection pooling problems, no separate scaling concerns. For [[Cloudflare Workers]] apps, D1 is the default relational store. ## Common Use Cases - **App backends** with moderate write volume — SaaS, dashboards, content sites - **Per-tenant databases** — give each customer their own D1 (cheap, isolated) - **Edge-local reads** — replicas serve reads from the nearest POP - **Replacing Postgres** for apps that don't actually need Postgres features ## Limits Worth Knowing - Max database size: 10 GB (Paid), 500 MB (Free); 50,000 databases per account on Paid, 10 on Free - Single-writer model (writes serialize through the primary) - No PostgreSQL/MySQL features: no triggers across DBs, no extensions, limited JSON - Rows read: free 5M/day; paid includes 25 billion/month, then $0.001 per million - Rows written: free 100K/day; paid includes 50 million/month, then $1.00 per million - Storage: 5 GB included, then $0.75/GB-month on Paid - Since September 1, 2026 the Free plan limits are enforced: once you hit the daily rows read or written, queries fail until midnight UTC - Data location: a `us` jurisdiction joined the `eu` and `fedramp` ones in August 2026; it can only be set when the database is created ## References - D1 home: https://www.cloudflare.com/developer-platform/products/d1/ - Documentation: https://developers.cloudflare.com/d1/ - Pricing: https://developers.cloudflare.com/d1/platform/pricing/ - Limits: https://developers.cloudflare.com/d1/platform/limits/ - Read replication: https://developers.cloudflare.com/d1/best-practices/read-replication/ - Data location: https://developers.cloudflare.com/d1/configuration/data-location/ - Changelog, United States jurisdiction (2026-08-07): https://developers.cloudflare.com/changelog/post/2026-08-07-us-jurisdiction/ - Changelog, free tier daily limits enforced (2026-09-01): https://developers.cloudflare.com/changelog/post/2026-09-01-d1-free-tier-limit-enforcement/ - SQLite docs: https://sqlite.org/docs.html ## Related - [[Cloudflare]] - [[Cloudflare Workers]] - [[Cloudflare Hyperdrive]] - [[Cloudflare KV]] - [[Cloudflare Durable Objects]] - [[SQLite]] - [[Wrangler]]