Cloudflare D1
Serverless SQLite database for Workers with Time Travel point-in-time recovery.
- Provider
- cloudflare
- Kind
- SQL database
- Category
- Data
| property | type | values | required | kind default | this component |
|---|---|---|---|---|---|
| appendOnly | boolean | — | no | false | inherited |
| backupEnabled | boolean | — | no | false | ▸ true |
| backupRetentionDays | integer | — | no | — | ▸ 30 |
| commitProtocol | enum | single | two-phase | no | single | inherited |
| concurrencyControl | enum | pessimistic | optimistic | constraint | no | — | inherited |
| distributed | boolean | — | no | false | ▸ false |
| encryptionAtRest | boolean | — | no | false | inherited |
| idEncodesShard | boolean | — | no | false | inherited |
| instances | integer | — | no | — | inherited |
| locationHint | enum | enam | wnam | weur | eeur | apac | oc | no | — | inherited |
| managed | boolean | — | no | false | ▸ true |
| maxColumnsPerTable | integer | — | no | 100 | inherited |
| maxDatabaseSizeGb | integer | — | no | 10 | inherited |
| maxDatabasesPerAccount | integer | — | no | 50000 | inherited |
| multiWriter | boolean | — | no | false | ▸ false |
| readReplication | boolean | — | no | false | inherited |
| replicaFanout | integer | — | no | — | inherited |
| replicaOf | ref | — | no | — | inherited |
| replication | enum | none | async | sync | no | none | ▸ none |
| shardKey | string | — | no | — | inherited |
| sharded | boolean | — | no | false | ▸ false |
Every rule whose selector covers this component's kind or its category. Whether a rule fires depends on the design: its properties, its edges and its groups.
Application servers write this database and the design keeps a search index, but nothing captures the database's changes. The index then depends on the application writing to both places, and the two drift apart silently.
- — all of these hold:
- — the node has at least one synchronous incoming edge from an app-server
- — the design contains a node of kind search-index
- — this does not hold:
- — the node has at least one outgoing edge to a change-data-capture
A system of record with backups off, or with no retention period stated, cannot be restored. The loss is discovered on the day it matters.
- — any of these hold:
- — the node's `backupEnabled` is false
- — the node's `backupRetentionDays` has no value
The design promises multi-region availability, but this datastore sits in one region and does not replicate. A region outage takes the system of record with it.
- — all of these hold:
- — the design requirement `availability.multiRegion` is true
- — the node sits inside exactly 1 region group
- — the node's `replication` is "none"
The design states a read-heavy workload and application servers read this datastore directly, yet the design has no cache anywhere. Every read pays a database round trip.
- — all of these hold:
- — the design requirement `traffic.readWriteRatio` is a number greater than 10
- — the node has at least one synchronous incoming edge from an app-server
- — this does not hold:
- — the design contains a node of kind cache
Asynchronous read replicas scale reads only. When the store is neither sharded nor distributed the writes still land on one primary, so the replicas add nothing at the declared peak.
- — all of these hold:
- — the node's `replication` is "async"
- — the node's `sharded` is false
- — the node's `distributed` is false
- — the node's declared requests per second is more than 5000
A single-writer, unsharded relational primary has a throughput ceiling. Declaring more than five thousand requests per second against it means the peak finds that ceiling in production.
- — all of these hold:
- — the node's `multiWriter` is false
- — the node's `sharded` is false
- — the node's declared requests per second is more than 5000
nodes:
- { id: "d1", component: "cloudflare-d1" }# yaml-language-server: $schema=../../schema/component.schema.json # D1: a serverless SQLite database for Workers. "D1 - Limits" gives 10 GB per database and 30 days of # Time Travel point-in-time recovery on paid plans, which is on without configuration; "Read # replication" is off until it is turned on, and gives sequential consistency through the Sessions API. schemaVersion: "1" type: "component" id: "cloudflare-d1" kind: "sql-database" provider: "cloudflare" docs: "https://developers.cloudflare.com/d1/platform/limits/" defaults: managed: true backupEnabled: true backupRetentionDays: 30 replication: "none" sharded: false multiWriter: false distributed: false properties: readReplication: type: "boolean" default: false maxDatabaseSizeGb: type: "integer" default: 10 maxColumnsPerTable: type: "integer" default: 100 locationHint: type: "enum" values: ["enam", "wnam", "weur", "eeur", "apac", "oc"] maxDatabasesPerAccount: type: "integer" default: 50000