LEAKCADE

Lovable app maintenance: back it up before it breaks

Updated 10 min read

Lovable app maintenance starts before something breaks. The code, the database and the files in storage are three different copies, and Lovable backs them up in different ways. This guide shows how to keep a Lovable app backup you can restore, what to run on a schedule, how to rescue a broken Lovable app, and what to do when a Lovable app is not deploying.

QUICK CHECKLIST

  • Connect Git sync, or download the codebase on a paid plan
  • Bookmark a known-good version in History before a big change
  • Export the database and download storage files to somewhere else
  • Treat daily backups as a roughly 14-day restore window
  • When a publish fails, read the dialog before clicking again
  • Run the Quick scan and, from time to time, the Deep scan

Why Lovable app maintenance starts with a backup

Lovable app maintenance is easier when you can put the project back the way it was. The code, the database and the files in storage are backed up separately.

If you connected your own Supabase project, Lovable's daily backups do not apply to it. Use Supabase's backups and supabase db dump instead.

Three copies in a Lovable app backupA complete backup has three parts: the code in Git sync or a download, a database export plus the daily backups, and the files downloaded from Storage.CODEGit sync or adownloadDATABASEDaily backup plusexportFILESDownload fromStorageKEEPStore the exportoff the projectCODEGit sync or a downloadDATABASEDaily backup plus exportFILESDownload from StorageKEEPStore the export off the project
One of these is not a substitute for the other two.

Lovable app backup for the code

Git sync connects the project to a GitHub, GitLab or Bitbucket repository you own and keeps the two in sync. Lovable's docs describe this as a way to back up your code. Lovable creates a new repository when you first connect; you cannot import an existing one.

The repository holds the code, including migration files that describe the database structure. It never holds the data inside the database, and it does not hold secrets you store in Lovable.

You do not need Git just to get a copy. On paid plans, download the codebase from Project settings, then Git, or from the bottom of the Code editor file tree.

A push to the repository does not update the live site. Publish from Lovable when the change is ready for users.

If a push to the synced branch replaces commits that Lovable made, Lovable saves a backup of its copy first and shows a notice: A repository push replaced your Lovable work. The project owner can click Review restore and choose Restore Lovable work or Keep repository version. If you keep the repository version, that restore is not offered again. The notice stays for 24 hours; after that, open Project settings, then Git, and click Check for saved Lovable work.

Back up the database and the files

On the built-in backend, go to More, then Database, then Manage, then Backups. Each row is a daily backup, shown in UTC. Lovable takes one backup per day and keeps up to roughly 14 days of them. You can restore to one of those days, not to a moment between them.

Restoring cannot be undone. Data created or changed after that backup is lost, and the schema goes back too, so the code may no longer match. Export the current database first. The database is unavailable for a few minutes during the restore. Then ask Lovable in the project chat to test the app and fix any mismatch.

Anyone with edit access can restore a backup.

To keep a copy yourself:

  1. More, then Database, then Manage, then Settings
  2. In Export project data, click Export data
  3. In the Database card, click Export, then Start export
  4. Lovable emails you when it is ready and also saves the file to the project's storage. Download it from More, then Storage and keep it somewhere else. Removing the database deletes that export with the rest of storage.

The export is a compressed PostgreSQL archive for pg_restore. It includes structure, data, user accounts and password hashes. It does not include storage files, edge function code, secrets, sign-in provider settings or API keys. Lovable exports databases up to 15 GB (the file can be at most 5 GB), once every 24 hours. The database has to be running; resume it first if it is paused.

Download storage files from More, then Storage whenever you need a complete copy.

A Lovable app maintenance loop you can keep

Once the copies exist, a short loop covers the rest:

The usual security fixes for an app you keep are in the Lovable security guide.

Rescue a broken Lovable app

Rescue a broken Lovable appIf the data is the problem, not the code, skip a History revert. If a daily backup from the last 14 days is enough, export the current state, then restore that backup. If you need an older database copy, use an export you already downloaded. For storage files, use a download from More, then Storage.STARTThe app is brokenYESASKIs the data the problem, not the code?REVERTRevert in History (code only)NOYESASKIs a daily backup from the last 14days enough?EXPORTUse a copy you already exportedNOYESRESTOREExport first, then restore that backupSTARTThe app is brokenYESASKIs the data the problem, not the code?NOREVERTRevert in History (code only)YESASKIs a daily backup from the last 14 daysenough?NOEXPORTUse a copy you already exportedYESRESTOREExport first, then restore that backup
A History revert does not roll back the database. A database restore does not change the code.

Start with what broke.

If a recent change wrecked the preview or the live site, open History in the top bar (or Project, then History). The version users currently see has a Published badge. Revert restores the project's code and redeploys edge functions to match. It does not roll back database data. Very old versions can still be previewed but can no longer be restored. Reverting does not refund credits.

If data was deleted or a schema change broke the app, use a daily database backup, after you export the current state. Restoring does not put deleted storage files back.

If a series of fixes has tangled the code, reverting is often faster than stacking more patches. Lovable's debugging docs suggest Try to fix once or twice (your account includes 10 free fixes, each available again 24 hours after you use it), then describe the bug clearly, then switch to Plan mode.

Lovable app not deploying: read the Publish dialog

Publishing deploys a copy of the project. The live URL keeps that version until you publish again.

When publishing fails, the dialog shows a Publishing failed message.

The dialog can also block publishing before you start: Fix build errors replaces the publish button with Try to fix; publishing needs editor access or above; an Enterprise workspace may show Approval needed or Publishing blocked; and Block publishing with critical issues means you must fix those findings in the Security view first.

If the dialog said the site is live but the URL looks wrong, check that you are opening the exact published address. The lovable.app subdomain can differ from the project's display name, and a custom domain can take time for DNS to update; until it is ready, Lovable publishes to the lovable.app address.

Publishing from the Publish dialog does not cost credits and works at a zero balance. Asking Lovable to publish in the project chat is treated as standard build usage and does consume credits.

Make your first Lovable app backup, step by step

Go in this order the first time. Later, repeat the export and the storage download on a schedule.

  1. Bookmark today's version

    Open History and bookmark the current version, especially if it already has a Published badge.

  2. Copy the code

    Connect Git sync in Project settings, then Git, or download the codebase on a paid plan. Check the sync status card before you walk away.

  3. Export the database

    More, then Database, then Manage, then Settings, then Export project data. Wait for the email, download the file from Storage, and copy it off the project.

  4. Download storage files

    From More, then Storage, download the files you care about, including the export file itself.

  5. Write down the restore path

    For code, use History or the repository. For data, use a daily backup (about 14 days), or load the export into another database with pg_restore. For files, use the download you just made.

Backup check you can paste

Paste this into the project's Lovable chat. It only asks for a report, so nothing changes until you approve.

BACKUP CHECK
Do not change any code, data or settings. Only report.
1. Is Git sync connected? Which provider, which branch, and what does the sync status card say?
2. When was the last database backup listed under More, then Database, then Manage, then Backups?
3. Has the database been exported, and is that export downloaded somewhere other than this project's storage?
4. List what is in Storage and whether those files have been downloaded off the project.
5. Which version in History has a Published badge, and is it bookmarked?
6. List secrets and API keys the app uses, and whether any secret key appears in frontend code.
Give a short backup and maintenance plan, without applying it.

If the app is not deploying, paste the Publishing failed message into the chat as well, or click Try to fix / Try again as the dialog suggests before asking for more changes.

What Leakcade checks

Leakcade's paid scan reads a public GitHub repo, so it fits a Lovable project you synced if that repo is public. It looks for keys in the files and in the last 50 commits, tables created without RLS in the SQL migrations, and policies that only check login. Each finding comes with a fix prompt.

It does not back up your database, download storage files, or connect to Lovable. The backup and publish steps above still have to be done in the project. If the synced repo is private, the scan cannot see it.

Further reading

  1. Lovable docs: Back up, restore and export your database
  2. Lovable docs: Git sync with GitHub, GitLab or Bitbucket
  3. Lovable docs: Version history
  4. Lovable docs: Publish and troubleshooting
  5. Lovable docs: Debug and improve your app
  6. Supabase docs: Backups

FAQ

How do I back up a Lovable app?

Treat it as three copies. For the code, connect Git sync or, on a paid plan, download the codebase. For the database, use Lovable's daily backups and an export you store somewhere else. For files, download them from More, then Storage. The export does not include storage files, secrets or API keys.

Does Lovable back up my database automatically?

Yes, on the built-in backend. Lovable takes one backup per day and keeps up to roughly 14 days of them. You can restore to one of those days, not to a moment between them. The restore cannot be undone, so export first. Lovable's daily backups do not cover a Supabase project you connected yourself.

How do I rescue a broken Lovable app?

If a recent change broke the code, revert to a version that worked in History. If data was deleted, restore a daily database backup after exporting the current state. If a Lovable app is not deploying, start with the message in the Publish dialog: Try again, Try to fix, or fix an external connection, then try again.

Why is my Lovable app not deploying?

The Publish dialog explains the failure. Temporary issues need Try again. Build or configuration errors need Try to fix. Fix the external connection or secret, then click Try again. A database change that conflicts with live data needs Ask Lovable, which confirms before it changes real data. Also check that you are opening the exact published URL.

Does Git sync also back up my database?

No. The repository holds your project's code, including migration files that describe its structure, but never the data inside the database. Lovable also does not run migration files that you add through Git. To copy the data, export the database.

Is Lovable safe?

Lovable hosts the app and gives you scans and access rules, but the data policies and secrets in your project are still yours to get right. See the Lovable security guide for what to check before launch.

Want a second pair of eyes?

We review your whole repo and write a fix prompt for every finding. $19, report within an hour.

Check my repo

Leakcade is an automated check. It can miss vulnerabilities and is not a substitute for a professional security audit or pentest. Provided as is. You stay responsible for your code. Where the law allows, our liability is limited to what you paid ($19). Terms

Patch Notes by Leakcade

A short weekly email: what changed in AI coding tools, one real security mistake, one prompt you can reuse.