Serverless SQLite database

Cloudflare D1

A managed serverless SQL database on Cloudflare built around SQLite semantics and integrated with Workers.

Editorial verdict

Choose Cloudflare D1 when the application is already designed around Workers, benefits from a scale-to-zero managed SQL service, and fits SQLite semantics plus D1's documented limits. Do not treat it as a generic replacement for PostgreSQL or as the default database outside a Cloudflare-native architecture.13

Best for

  • Cloudflare Workers applications that need a tightly integrated relational store
  • SQLite-compatible schemas and queries that stay within D1 database and request limits
  • Read-heavy or geographically distributed read workloads that can use D1 read replication deliberately
1345

Not ideal for

  • Applications that require PostgreSQL semantics, extensions, or broad PostgreSQL tooling compatibility
  • Single databases expected to exceed D1's current size or query limits
  • Write-heavy multi-region designs that have not validated D1's write path, consistency behavior, and failure handling
13
Main trade-off

D1 provides an integrated scale-to-zero SQL path for Workers, but the application accepts SQLite semantics, Cloudflare-specific APIs and limits, row-based pricing meters, and a platform-specific migration boundary.123

Product boundary

Whether a Cloudflare-native SQLite database is the right system of record for a Workers application.

D1 is a managed SQLite-based database with Workers and HTTP access. It is not PostgreSQL, does not provide PostgreSQL extensions or compatibility, and remains subject to documented per-database, query, invocation, and account limits.13

For: Cloudflare Workers teams whose data model and workload fit SQLite semantics, D1 limits, and Cloudflare's regional write model

  • The projected database size or request shape exceeds current D1 limits.
  • The product requires PostgreSQL-specific features, extensions, or ecosystem compatibility.
  • The workload has centralized writes or consistency requirements that have not been tested with D1 read replication.
  • Cloudflare platform portability is a primary architectural requirement.

Why teams consider Cloudflare D1

  • Workers integrationD1 can be bound directly to Workers and can also be accessed through its HTTP API.13
  • SQLite semanticsD1 uses SQLite's SQL dialect and storage semantics, giving teams a familiar lightweight relational model.134
  • Time Travel recoveryD1 includes Time Travel for restoring a database to a prior point within the plan's retention window.13
  • Read replicationRead replication can place read-only replicas closer to users when the application uses Sessions API consistency controls.135

Pricing

D1 meters rows read, rows written, and stored data instead of billing a continuously provisioned database instance. Free and Workers Paid plans have different included usage and limits; Workers runtime charges remain separate.2

Prototype and low usage

Workers Free

Includes 5 million rows read per day, 100,000 rows written per day, and 5 GB of total D1 storage under the current pricing page.2

Production usage

Workers Paid

Includes 25 billion rows read and 50 million rows written per month plus 5 GB storage, then currently lists $0.001 per million rows read, $1.00 per million rows written, and $0.75 per GB-month.2

Scale-to-zero
No D1 compute charge when the database is not queried2
Transfer boundary
D1 lists no additional D1 egress charge; Workers and other services are billed separately2
Paid database limit
10 GB per database on the current limits page2
Pricing checked View official pricing

Cloudflare D1 vs alternatives

Turso

Choose when
Choose it when a distributed SQLite/libSQL product and its replica or embedded-replica model fit better than a Workers-native database.
Compared with Cloudflare D1
The deployment and synchronization model differs, and application integration is not the same as a native D1 binding.6

Neon

Choose when
Choose it when PostgreSQL compatibility, branching, and a serverless managed PostgreSQL architecture matter more than SQLite and Workers-native integration.
Compared with Cloudflare D1
The application adds a networked PostgreSQL service and its connection, region, and provider boundary.7

PostgreSQL

Choose when
Choose PostgreSQL when relational compatibility, extensions, concurrency behavior, or provider portability require the PostgreSQL ecosystem.
Compared with Cloudflare D1
The team must choose and operate a hosting route rather than receiving a database bound directly to Workers.8

Resources and sources

Official product and architecture

  • Cloudflare D1 documentation
    Open
  • Cloudflare D1 limits
    Open
  • Query D1
    Open
  • D1 read replication
    Open

Official pricing

  • Cloudflare D1 pricing
    Open
  1. 1
    Cloudflare D1 documentation

    Cloudflare · Accessed Official

  2. 2
    Cloudflare D1 pricing

    Cloudflare · Accessed Official

  3. 3
    Cloudflare D1 limits

    Cloudflare · Accessed Official

  4. 4
    Query D1

    Cloudflare · Accessed Official

  5. 5
    D1 read replication

    Cloudflare · Accessed Official

  6. 6
    Turso introduction

    Turso · Accessed Official

  7. 7
    Why Neon

    Neon · Accessed Official

  8. 8
    What is PostgreSQL

    PostgreSQL Global Development Group · Accessed Official