GitHub

Storage and data

A database and object storage that arrive as bindings, with 100 MB and 1 GB ceilings.

An environment can have a SQLite database and S3-compatible object storage, but neither is there from the first deploy: storage is provisioned for preview or production separately, and a deploy then attaches it. Once it exists you do not create an account or copy connection strings — the database and the bucket arrive as bindings, available to your Worker as env.DB and env.FILES.

Isolation

  • Preview and production each have their own database and bucket, and each is provisioned on its own. A test that writes in preview cannot touch production data.
  • Provisioning and deploying are two steps: the binding appears only after a deploy that follows it, because bindings are baked into the deployment.
  • Bindings are only reachable from server-side code. The browser never sees credentials, because there are none to see.

The ceilings

ResourceLimit
Total database storage100 MB, shared across all sites
Total object storage1 GB, shared across all sites
Database row writes10,000 per day, 100,000 per month
Database row reads50,000,000 per month
Class A operations (list, write)2,500 per day, 25,000 per month
Class B operations (read)250,000 per month

100 MB of SQLite is a lot of text and surprisingly little of anything else: image blobs belong in object storage, and a table that stores base64 will hit the ceiling first. The counting rules for rows are Cloudflare's — see their definitions.

Schema and migrations

There is no arbitrary SQL console in Sites, and that is a feature: the schema lives in your code. Ask the agent to keep an idempotent migration path — create-if-not-exists statements run at startup, or a small migration table — so a fresh environment comes up correctly and an existing one is upgraded in place.

Query with bound parameters, never string interpolation, and scope every query by the signed-in user. A shared database plus a client-supplied id is the most common way to leak another user's rows.

Files

Object storage is for uploads and anything binary. Store metadata in the database, the bytes in the bucket, and check ownership on the way out — the key alone should never be treated as permission.

Backups and export

Database and files are as durable as the platform, and as portable as an export. Before you depend on them, know the exit: the database exports through an authenticated endpoint and imports with Wrangler, and files can be downloaded and copied to any S3-compatible service. The steps are in taking your project elsewhere.

Planning against the quota

  • Log every write path and estimate writes per user action; a "like" button is a row write per tap.
  • Cache reads in the Worker or the browser before adding an index — CPU seconds are the tighter constraint on a small plan.
  • Keep uploaded originals out of the database and serve resized copies from the bucket.