Skip to content
mentoor

Topic 3 of 5 · 5 min read

Keeping a vibe-coded project recoverable

Goal: Set up version history and backups for a vibe-coded project and restore it after a bad change.

Make every working state of your project easy to get back, because an AI tool can break a working app with one prompt and cannot always undo it. If you can restore in two minutes, a bad prompt costs you little. If you cannot, it can cost the whole project.

Check yourself · 1 of 3

What is the best protection against one bad prompt breaking your working app?

Choose one answer

Why it matters

AI tools rewrite many files at once. A prompt such as "make the header bigger" can change the login code, drop a database column or delete a file. Chat history is not a backup, and a tool's built-in "undo" may only go back a few steps. Data is worse: if the AI runs a command that deletes rows, the code can be restored but the rows are gone unless you kept a copy.

How to do it

Protect two things separately: the code and the data.

Code

  1. Use version control from day one. Put the project in Git and host it on GitHub, GitLab or similar. Many app builders have a button to connect a repository. Use it.
  2. Commit after every working step. Write a plain message: "login works". Commit before you ask for the next big change.
  3. Work on a branch for risky changes, so the main version stays safe.
  4. Keep the tool's own checkpoints (most builders have a history or restore panel), but treat them as a second layer.

Data

  1. Export or back up the database on a schedule, and on demand before any change that touches the database structure.
  2. Store the backup somewhere else, not in the same account that could be wiped.
  3. Test one restore. A backup you have never restored is a hope, not a backup.

Also keep a short file in the project that says how to run it and where the keys live, so you can rebuild without the chat.

Before and after

Weak: Jo prompts an app builder 40 times over a week. On the 41st, the AI "cleans up" the data model and the customer table is gone. No export, no repository. Four months of notes are lost.

Better: Jo connects a repository on day one, commits at each working step, and exports the database every Friday and before schema changes. The same prompt breaks things, and Jo restores the last commit and last export in ten minutes.

What goes wrong

  • Trusting the undo button. It may not cover database changes or older states.
  • Backups in the same place. One deleted project or account removes the data and its copies.
  • Never testing a restore. The file is empty or the format cannot be loaded back.

Recoverability is the cheapest safety step you can take.

Examples

A minimal safety routine

Before a big prompt:

  1. Run the app and check the main path still works.
  2. Commit with a clear message such as working: signup and login.
  3. Export the database.
  4. Create a branch for the experiment.

If the result is bad, drop the branch. If it is good, merge it and commit again.

The recovery commands

# see recent working states
git log --oneline -n 5

# throw away the bad changes and go back to the last commit
git restore .

# or look at the old state of one file
git show HEAD~2:src/login.js

These work only because earlier states were committed.

Key points

  • Chat history and tool undo buttons are not backups; use version control for the code.
  • Commit after every working step and before every large prompt, so each good state can be restored.
  • Back up the data separately from the code, store it elsewhere, and export before any change to the database structure.
  • Try a real restore once; an untested backup may not work.
  • Work on a branch for risky changes so the working version stays untouched.

Common mistakes

  • Relying on the AI tool's chat or undo as the only history.
  • Committing only at the end of the week, so one bad prompt wipes out days of work.
  • Keeping the only database backup inside the same account and project.
  • Skipping a restore test until the day it is needed.

Check yourself · 2 of 3

An AI deletes rows from your database. Your code is safely in Git. What else do you need to recover?

Choose one answer

Check yourself · 3 of 3

When is a backup truly trustworthy?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic