How to Migrate Off Lovable (Step-by-Step)
A practical guide to migrate off Lovable. Sync your code to GitHub, export Lovable Cloud, move storage, secrets and AI calls, and deploy on infrastructure you own.
Lovable is one of the fastest ways to go from idea to a working app, and it gives you your code from day one. The part that takes planning is Lovable Cloud, the managed backend your app runs on.
Short version: GitHub sync already has your code. A complete Lovable migration moves the Cloud database and users, storage files, edge functions, secrets, AI calls and hosting to a stack you own.
Step 1: Sync the code to GitHub
Lovable’s GitHub integration works on every plan, and it’s two-way: changes in Lovable push to GitHub, and changes pushed to the active branch sync back. Connect it, clone the repo and run:
npm install
npm run build
The repo usually contains the React frontend, supabase/migrations, supabase/functions for edge functions, and a client in src/integrations/supabase/.
Step 2: Inventory Lovable Cloud
Open the Cloud tab and write everything down:
| Item | Where to find it | Moved by |
|---|---|---|
| Tables & RLS policies | Cloud → Database | Official export |
| Auth users & providers | Cloud → Users / Auth | Official export (users); you (OAuth apps) |
| Storage buckets | Cloud → Storage | You |
| Edge functions | Repo supabase/functions |
You (redeploy) |
| Secrets | Cloud → Secrets | You (re-enter) |
| Scheduled jobs | Cloud → Database | You (recreate) |
| Lovable AI calls | Edge function code | You (your own provider) |
While you’re here, review every RLS policy. CVE-2025-48757 showed how often generated apps ship with tables that anyone can read or write.
Step 3: Choose your destination
- Path A: your own Supabase project. Lovable Cloud is built on Supabase’s open-source foundation, so this is the most direct route. The code barely changes.
- Path B: fully self-hosted. PostgreSQL, auth, storage and an API on AWS, a VPS or on-prem. More work, most control.
Step 4: Export and restore the database
In Cloud → Overview → Advanced settings, choose Export project data. The backup contains your schema, data, security policies and auth users, including password hashes. Limits:
- Up to 5 GB per export
- One export every 24 hours
- Larger databases: contact Lovable support
Restore the backup into your target and check every table’s row count. See the Lovable Cloud export guide for the details and the traps.
Step 5: Move storage files and edge functions
The export doesn’t include storage files. Download every object from each bucket, upload it to your storage, and rewrite file URLs in your tables. Then deploy edge functions from the repo to your Supabase project, or port them to your own API.
Step 6: Re-enter secrets and replace Lovable AI
Secret values don’t come with the export. Re-issue each one from its provider and store it on the target. For AI features, replace calls to Lovable’s AI gateway with your own OpenAI, Anthropic or Gemini keys, and set usage limits while you’re there.
Step 7: Deploy and test
Point VITE_SUPABASE_URL and the publishable key (or your own API URL) at the new backend, deploy the frontend to your host, and test on a staging domain: email sign-in, every OAuth provider, password reset, uploads, payments and AI features.
Step 8: Cut over
- Freeze writes in the Lovable app.
- Run a final export and restore, and reconcile row counts.
- Switch your custom domain to the new deployment.
- Keep Lovable Cloud paused, not removed, until you’re confident. Removing it permanently deletes the Cloud instance.
Want it done for you?
X & Company runs this process on every Lovable migration, including the RLS security review, for a fixed-scope quote.