Lovable app maintenance: back it up before it breaks
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.
- The code lives in the Lovable project. Version history records every change Lovable makes. Git sync (or Download codebase on a paid plan) puts a copy in a place you control.
- The database has a daily backup that Lovable keeps for about 14 days. An export is a full copy of the database you can store yourself. Neither includes storage files.
- Files in storage have to be downloaded from More, then Storage.
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.
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:
- More, then Database, then Manage, then Settings
- In Export project data, click Export data
- In the Database card, click Export, then Start export
- 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:
- Before a big change, bookmark a known-good version in History.
- After you accept work you want live, click Publish, then Publish changes. A dot on the Publish button means there are unpublished changes. Accepting a draft is not publishing.
- The Quick scan runs when you open the Publish dialog. From time to time, run the Deep scan from the Security view.
- Check the Git sync status card so the repository is not quietly behind.
- Export the database on a schedule shorter than 14 days if you need a copy older than Lovable's own window, and download new storage files with it.
- If the app still has users but you have stopped opening it, it can stay published and keep serving data. See abandoned Lovable apps.
The usual security fixes for an app you keep are in the Lovable security guide.
Rescue a broken Lovable app
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.
- Temporary issue, such as a timeout or a rate limit: click Try again.
- An error in your app, such as a build error or an edge function that could not be deployed: click Try to fix, or describe the issue in the project chat.
- A configuration issue, for example a file that is too large: click Try to fix.
- An external connection or secret Lovable cannot change for you, such as an expired Supabase connection or a service at its plan limit: fix that setting, then click Try again.
- A database change that conflicts with data already in the live app: click Ask Lovable. It confirms with you before changing real data.
- An internal error on Lovable's side: wait a few minutes and try again. If it keeps failing, contact support and include the project link.
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.
Bookmark today's version
Open History and bookmark the current version, especially if it already has a Published badge.
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.
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.
Download storage files
From More, then Storage, download the files you care about, including the export file itself.
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.
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
- Lovable docs: Back up, restore and export your database
- Lovable docs: Git sync with GitHub, GitLab or Bitbucket
- Lovable docs: Version history
- Lovable docs: Publish and troubleshooting
- Lovable docs: Debug and improve your app
- 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 repoLeakcade 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