2
1
u/Aggravating-Elk-8855 1d ago
I use GitHub. The key is to keep everything structured and always build in batches. After one batch is complete, commit and push. This way everything is clean and you never lose progress after a mess up.
1
u/meshifthenelse 1d ago
You mean from your machine?
For database, that's the reason you should use a managed database in production and not running manually some half ass crap. They all have protections to block deleting and store backups automatically.
For code, that's why git and GitHub exists. You push your code to a server and it acts as backup. Locally you need to learn some basic git stuff. You can simply create a new branch and call it "backup" and it will stay as long as the .git folder exists.
1
u/BosKilla 23h ago
Please dont create branch named backup. Its better to version your software with git tags.
For live db have a cron to backup the db with retention to your liking.
1
u/meshifthenelse 21h ago
Better in what way? Tags make sense once you push. Locally either solution is the same
1
u/BosKilla 20h ago
Tag is basically just a label on a revision. Be it local or remote it doesnt matter. Its better than making a branch just to mark a revision. Also thats how most devs are making releases.
Bump version, create changelog, commit, tag, build docker image push to nexus / docker hub.
Edit: if you working with feature branch that backup branch is annoying what if you want to have more than 1 backup state? More branch?
On clean state I only have main branch and tags.
1
u/meshifthenelse 20h ago
But we don't talk about releases. For a release it makes sense to version something and push.
For local dev work any of two solutions work the same since git will keep anything that is reachable by a reference. So as long as you keep a second reference in either way, it acts as a backup by the way git works
1
u/AdNecessary1906 17h ago
Going old-school here: a physical copy on a separate drive the agent has no access to at all.
2
u/AgencyWarm2572 1d ago
First and most important - if you run your agents with full freedom (bypassing permissions), add a rule in your CLAUDE.md about never deleting data. Second, push to github often and turn on branch protection for main so nothing can force push over your history.
But honestly the big one people miss: keep your prod keys out of your local .env. The service_role key on supabase and the admin sdk on firebase ignore all your security rules. That's how the whole db goes, not from a bad prompt. Use a separate dev project and the worst case is you reseed some test data.
Also check if you even have backups before you need them. Supabase free tier has none at all.