Standalone recovery runbook
How to recover a standalone website’s data and media with your provider’s own tools. Dee Wan has no backup service. Nothing on this page has been run against a live deployment by this project. Rehearse it on a disposable copy before you rely on it.
The Wrangler commands below are Cloudflare’s. They are checked against Cloudflare’s D1 and R2 Wrangler command references, D1 import and export guide and D1 Time Travel reference on 2026-09-23. This repository runs only wrangler d1 export itself (scripts/d1.ts).
What to recover
Section titled “What to recover”| Part | Where it lives | Recovered by |
|---|---|---|
| Code | Your repository | Git. A commit identifies it. |
| Generated content rows | Generated tables in your D1 database | Reloading the committed snapshot (npm run data:load), or a database restore |
| Your own rows | Your own tables in the same D1 database | A database restore only |
| Media | Your R2 bucket, if you moved media into your custody | Your own copy of the objects |
| Secrets | Your repository secrets and Worker secrets | Your secret store. Never in a backup file. |
A code rollback in Settings restores none of the rows or media above.
Capture
Section titled “Capture”First pause processes that write data: your own jobs and CMS deployments to this site.
Export the database to a file:
npx wrangler d1 export <database-name> --remote --output backup-<date>.sqlAn export blocks other requests to the database while it runs, and Cloudflare does not export databases that contain virtual tables. Numeric values pass through JavaScript numbers, so integers beyond 52 bits of precision can change.
Record the repository commit that was deployed, the export time and a checksum of the file. For media, copy every object key listed in data/media-manifest.json out of your bucket, for example with npx wrangler r2 object get <bucket>/<key> --remote --file <path>. Keep the copies outside the bucket.
Restore into isolation first
Section titled “Restore into isolation first”Create a new database and load the export into it:
npx wrangler d1 create <restore-database-name>npx wrangler d1 execute <restore-database-name> --remote --file backup-<date>.sqlThe generated deployment resolves its own database from its configuration, and this project has no command that targets a restored copy. Point a separate, non-production Worker configuration at the restored database yourself, deploy the recorded commit to it, then verify it with API_BEARER_TOKEN in the environment:
npm run verify:deployment -- --origin 'https://restore.example.com' --expect-commit <full-commit-sha>npm run verify:mediaverify:deployment compares the deployed content with the committed snapshot. verify:media checks media references in the committed projections. It does not download bytes. Open representative pages and media yourself.
Point-in-time restore of a D1 database
Section titled “Point-in-time restore of a D1 database”Cloudflare D1 Time Travel restores a database in place to an earlier point in time. It reaches up to 30 days back on the Workers Paid plan and 7 days on the Workers Free plan. --timestamp takes a Unix timestamp or an RFC 3339 time with a timezone. --bookmark takes a bookmark that info prints.
npx wrangler d1 time-travel info <database-name>npx wrangler d1 time-travel restore <database-name> --timestamp <time>This overwrites the live database, including your own tables, and cancels queries in flight. Export first. The restored schema may be older than the deployed code. Check that the deployed commit’s migrations match the restored database before you serve traffic from it.
Restore media
Section titled “Restore media”Put the copied objects back under the same keys with npx wrangler r2 object put <bucket>/<key> --remote --file <path>. While the CMS still holds the media, npm run backend:deliver with --media transfers its current public media as part of a full generation and delivery. It cannot bring back media the CMS no longer holds.
Cut over
Section titled “Cut over”After the isolated copy passes verification, point production at it or repeat the restore in production. Keep the old database until the owner accepts the result. Re-enable processes that write data last.
Related: rollback and recovery, CMS backup and restore, detachment runbook.
Next step
Section titled “Next step”Look up routes, authentication and deployment behavior in the API reference.
Unreleased / pre-MVP; no stable version
Source revision: fe23db481c422b40e317b92fc98116b4c0c26a87 (modified checkout)
Build date (UTC): 2026-10-18T09:22:34.630Z
Upgrade target: unavailable: modified checkout. Release notes