Backups and Disaster Recovery

Restore a copy of sample data and its files in a separate place, then compare how long it took and how much you lost with the goals you set.

Content date: October 23, 2026.

Plain English

A backup only matters if you can get your data back. List what you depend on: database rows, uploaded files, the database structure, settings, the keys needed to read the backup, and outside services. A database copy without the files its rows point to is incomplete. Your recovery point objective is how much recent data you can afford to lose. Your recovery time objective is how long you can afford to be down. Set both from what your business needs. A common rule of thumb is 3-2-1: three copies, on two kinds of storage, one kept somewhere else.

Use this when

Do this before you store data people rely on and before risky changes to how it is stored. Repeat it on a calendar (see "Monthly Maintenance: Keys, Packages, and Hygiene").

If you are just starting

Use the practice recovery script, which uses made-up SQLite rows and a harmless text file. Take a consistent baseline copy, restore it into a separate empty folder, and compare rows and file fingerprints (hashes). Note which later change is missing, and time the restore and checks. Never erase live data to prove a backup works.

When your project grows

Test the whole chain: access to the backup, the keys to decrypt it, old data fitting your current code, file versions, settings, and app startup. Restore into a separate project, never over live data. Plans differ (as of October 2026): Supabase gives paid projects daily backups (7 days on Pro) and sells point-in-time recovery as an add-on, but doesn't back up Storage files, and free projects get no daily backups. Neon restores to any moment inside its history window: 6 hours on Free, up to 7 days on Launch and 30 on Scale. Cloudflare D1 offers Time Travel for database recovery; check its current retention and rehearse the documented recovery procedure safely. It does not recover an external Postgres database or uploaded files for you. Vercel can roll back code, which doesn't touch your data. Check each provider's page, and avoid replaying payments or emails by accident.

Worked example

A bakery's order database is saved at 10:00. A new order arrives at 10:05, then the database is restored from the 10:00 copy. Rows and the cake photo match the baseline, but the 10:05 order is gone. The owner said losing more than two minutes was unacceptable, so the five-minute gap fails even though the restore worked. The fix is more frequent backups, not a looser goal.

Practice

Restore data and its referenced asset

  1. Open section 3 of the Operations workbook and write down the practice goals: restore and check within 30 seconds, lose at most two simulated minutes.
  2. Save recovery.py in its own empty folder, read it, and run it as the workbook says.
  3. Record the restored row check, the file check, the measured time, and the missing later row.
  4. Compare the five-minute simulated loss with the two-minute goal, and mark it a miss.
  5. List what your real app needs beyond this: logins, keys, outside services, file versions, and provider retention.

Deliverable: A recovery evidence table (rows, files, time, lost changes) and a list of real-world dependencies still untested.

Common mistakes to watch for

  • A dashboard says "backup succeeded" nightly, but the first real restore shows empty files.
  • You restore the database but the photos its rows point to are missing.
  • The backups are encrypted and the key lived only on the laptop that died.
  • You promised two minutes of loss, but backups run nightly, so a 4 p.m. crash costs a day of orders.
  • An old backup restored into a new app version no longer matches the code.

Prompting

A weak prompt

Enable backups and mark disaster recovery complete.

A better prompt

My app uses [database provider] and [file storage]. List everything I'd need to recover it: data, files, settings, keys, and outside services. Help me set recovery point and recovery time goals, then compare them with my provider's current plan. Write a restore rehearsal for a separate project with made-up data that compares rows and file contents and records time and lost changes. Never touch live data.

A green status icon shows a copy was made. Only a restore proves you can get your business back.

Check before you move on

  • You listed the data, files, settings, and keys your app needs.
  • You wrote your recovery goals before testing.
  • You restored into a separate, empty place.
  • You compared both rows and file contents.
  • You recorded restore time and lost changes.

You are done when

  • You can compare the restored copy with its baseline and your goals.
  • If a goal was missed or a real-world dependency is untested, your notes say so, even though the practice script passed.

Questions to think about

Your provider shows a green "daily backup complete." Is your app recoverable?

Not proven. A green job means a copy was made. Restore it somewhere safe and check the data and the app.

A restored database lists 50 photos, but the photo files have different fingerprints than the originals. Is recovery finished?

No. Rows and files disagree, so records would show wrong or broken content.

You can lose at most two minutes of data, and your newest restorable copy is five minutes old. Did you meet the goal?

No. The restore worked, but the gap is longer than your goal, so you need more frequent backups or point-in-time recovery.

Official references