Backups for side projects: the setup you will be glad you made
George · 2 min read
The short answer: back up your database automatically every day, keep copies somewhere other than the server itself, keep several days of history, and back up uploaded files and your configuration too. Then restore a backup into a fresh database once, so you know it works. A backup you have never restored is a hope, not a backup.
Losing data is the one mistake users rarely forgive. It can happen in many ordinary ways: a migration that drops the wrong column, a script run against production by accident, a hosting account problem, or a bad change from an AI assistant that nobody reviewed closely.
What to back up
- Your database. The most important part. Everything your users created lives here.
- Uploaded files, such as images and documents, if they are stored outside the database.
- Configuration and secrets, stored safely, so you can rebuild the app on a new host. Keep these encrypted and separate from your code.
- Your code is usually already safe in a git host, but make sure everything is pushed and nothing important lives only on your laptop.
How often, and how long
Daily automatic backups are a good default for a small product. Keep at least a week of them, and ideally a few weekly copies going back a month. Several days matter because some problems are noticed late: a bug that slowly corrupts records may only be spotted a few days after it started.
Many managed databases include automatic backups and point-in-time recovery. Check whether your plan has them turned on, and how far back they go.
Keep a copy somewhere else
A backup stored on the same server, or in the same account, can disappear together with the thing it was meant to protect. Keep at least one copy in a different place, such as a separate storage bucket or another provider.
Test a restore
Once, and then every few months:
- Take a recent backup.
- Restore it into a fresh, separate database, never over production.
- Point a local copy of your app at it and click around.
- Note how long it took and write the steps down.
The first time often reveals something: a missing permission, a step nobody wrote down, or files that were never included.
Protect yourself from yourself
- Use separate credentials for production and development, so a local script can not touch live data by accident.
- Back up before migrations that change or remove data.
- Prefer reversible changes: add a new column, move data, then remove the old one later.
The short version
- Back up the database daily and keep several days of history.
- Include uploaded files and configuration.
- Keep a copy outside your main account.
- Restore once into a fresh database to prove it works.
- Back up before risky migrations, and keep production credentials separate.
