Skip to content
·7 min read

Database Backups for Web Apps

What to save besides database rows, and how to tell whether an isolated restore gets your app working

Share

Your repair booking app comes back after a database restore. The appointment list looks right, but the shop owner can't open the photos customers uploaded. The database had the bookings and the names of the files. The photos themselves were stored somewhere else.

Start with one job your app needs to do after a failure. For the repair shop, that means a customer can sign in, find the right appointment and open the photo they attached. Work backward from that result to decide what to copy and how you'll check it.

What do you need to get the app working again?

A database backup can recover saved records such as bookings and the table definitions that organize them, within the scope of the backup. A file backup holds copies of uploads such as photos or receipts. Git history records versions of the code you've committed, meaning saved as revisions in the repository. That history can help you find a working version to rebuild. Keep a recoverable copy of the repository itself and check whether you also need things it stores separately, such as issues or wikis. GitHub repository backup guide

Piece to recoverWhat to write downWhat you should see after a test restore
DatabaseWhere the bookings are stored, what the backup includes and who can restore itA known booking appears with the expected date and status.
UploadsWhich file store holds the photos and where an independent copy livesThe file opens from the restored booking.
Sign-in and permissionsWhere user accounts and roles live and how they'll be recoveredThe booking owner can open the record and its photo. A different ordinary user can't.
Code and service settingsWhich code version works with the records, where the settings are documented and who can recover credentialsThe practice app starts with the right database and file store. Its connected services stay in test mode or off.

If a service keeps its own records, add it to the inventory. A payment service may hold the original payment and refund details while your app saves a payment reference. Record what you would need to recover or reconcile. Write down where credentials are managed and who can retrieve or replace them. Keep the values out of the recovery document.

How do you keep a copy you can still reach?

The 3-2-1 backup pattern calls for three copies of important information including the original, two types of storage and one copy in a separate location. For a hosted app, also ask who controls those copies. A backup kept in another location can still be unavailable if it depends on the same account you just lost. Keep a protected copy of critical data that you can retrieve separately, and make sure an authorized person can get any keys they need to read it. Canadian Centre for Cyber Security backup guidance

Decide how far back you might need to go and how much recent work you could recreate. Retention is how long a service keeps recoverable copies. If a booking mistake could take two weeks to notice, seven days of history may leave you without a version from before the mistake. A separate question is how many new appointments could be missing after restoring to an earlier point. These two answers help you choose how often to make a copy and how long to keep it. Restrict access to copies that contain customer data, protect them with encryption and choose a retention period that fits what you need to keep.

What does your database provider actually back up?

Look at the backup history for your exact database. Find the most recent recoverable point, the oldest one you can use and the documented restore destination. Check file and sign-in storage separately. A few provider examples show why the details matter.

  • Supabase includes information about stored files in its database backup, such as the record of an upload. It doesn't include the contents of those files. A photo deleted from Supabase Storage needs its own recovery path. Supabase database backups
  • Neon documents that restoring a branch to an earlier time rolls back Postgres and Managed Better Auth data. The files in Neon Object Storage stay as they were just before the restore. Neon branch restore limits
  • PlanetScale Vitess supports restoring a saved backup to a new database branch. Check the saved backup, its retention and the branch you will restore to. PlanetScale Vitess backups
  • Amazon RDS uses different retention defaults for a database instance created through the console and one created through the API or command line. For a database instance where zero days is allowed, that setting turns off automated backups. Read the current setting for your instance or cluster. Amazon RDS backup retention

If you need the database as it was just before a mistake, check whether your service offers point-in-time recovery and still holds the history for that time. In PostgreSQL, this kind of recovery can use a starting backup and saved records of later changes. A logical export, which saves selected database contents in a file, can recover what's in that export. Plan a separate way to recover files and settings. See what a PostgreSQL export restores

How do you try a restore safely?

Start on paper if you can't confirm where a restore will write or what the app will do when it starts. You can still choose one invented booking, one sample photo and two test accounts, then write down which pieces would have to come back and what each account should see.

  1. Confirm the practice setup first. Use a trusted backup created with fictional records and files. Before starting the restore, confirm its exact destination is a separate empty test setup or a new isolated copy. Keep the practice setup disconnected from live services so it can't read or write live data, send real emails, take real payments or run live scheduled jobs. Before opening the restored app, check where its database, file storage and sign-in connections actually point. Each must use the intended disposable resources for this restore. If you can't verify the connections or set up separate test sessions, stop at the paper version.
  2. Recover the practice pieces. Restore the known database backup and recover the matching sample photo from the file copy. If the database and file copies were made at different times, check that the file still matches the restored booking. Set up or recover the two test accounts in the practice sign-in system.
  3. Open the app as a user. Sign in as the booking owner and check the known test booking and its private photo. Use the app's normal protected addresses for both and leave any temporary share link out of the check. In a fresh, separate session, sign in as the second ordinary test account and open those same two addresses directly. Confirm the app withholds both the booking and the photo. A hidden button alone can't show whether access is blocked.
  4. Write down the result. Record the point the data came back to, anything missing and the elapsed time until the app could do its job. Compare that time with how long the repair shop could afford to be without its booking system. Assign a person to fix any gap and repeat the check after a change that could affect recovery.

What should you do first?

Look at the inventory for one task your business depends on. If you can't say where a piece would come from during recovery, mark that gap and give someone the job of finding out. That's where your first backup check should start.

Written forIndie Hackers
PJ
Pranay Joshi

20+ years building products at scale. VP of Product & Engineering, startup founder, and AI coach. Helping dreamers turn ideas into reality with vibe coding.