Update (May 2026): You no longer need edge function workarounds to export your data. The Lovable MCP query_database gives you full SQL access to your Cloud database directly from Claude Code - including auth.users with password hashes. See the 2026 Migration Guide for the updated export and migration process.
This is one of several ways to migrate from Lovable Cloud. If you prefer a visual, step-by-step approach with GitHub Desktop, check out the complete migration guide. This method uses Claude Code and the Supabase REST API — great if you want to learn how things work under the hood, or if you just like working in the terminal.
What This Guide Covers
What you'll learn:
- How to export your data using Claude Code
- How the Supabase REST API works
- How to export Storage files
What this guide doesn't cover:
- Full migration (use the complete guide for that)
- User/auth migration (passwords can't be transferred)
- Importing data to a new Supabase (coming soon)
The Approach
Your Lovable project already has the credentials to talk to your database. They're in your code:
VITE_SUPABASE_URL— your database addressVITE_SUPABASE_PUBLISHABLE_KEY(orANON_KEY) — your API key
We'll use Claude Code to find these credentials, discover your tables, and export everything to JSON files.
Lovable Cloud
↓
Push to GitHub
↓
Clone locally
↓
Claude Code finds credentials + exports data
↓
JSON files with your data ✨Step 1: Connect GitHub in Lovable
First, push your code to GitHub so you can clone it locally.
In Lovable, click the GitHub button in the top toolbar, then follow the prompts to connect your project to a repository.
Step 2: Clone the Repository
Open your terminal and clone:
git clone https://github.com/your-username/your-project.git
cd your-projectStep 3: Install Claude Code
If you don't have Claude Code yet:
Mac/Linux:
curl -fsSL https://claude.ai/install.sh | bashWindows (PowerShell):
irm https://claude.ai/install.ps1 | iexNo prerequisites needed. One command and you're ready.
Resources:
Step 4: Export Your Data
Open Claude Code in your project folder:
cd your-project
claudeThen paste this prompt:
I need to export all my data from a Lovable Cloud project.
Please:
1. Find the Supabase credentials in this project
- Look in .env, .env.local, or src/integrations/supabase/client.ts
- I need VITE_SUPABASE_URL and the key (might be called VITE_SUPABASE_ANON_KEY or VITE_SUPABASE_PUBLISHABLE_KEY)
2. Check what tables exist
- Read src/integrations/supabase/types.ts
- List all table names you find
3. Export each table using curl
- Endpoint: GET {SUPABASE_URL}/rest/v1/{table}?select=*
- Headers: apikey and Authorization with the key
- Save each result to ./export/tables/{table_name}.json
4. Tell me which tables worked and which returned empty
Create the folders if they don't exist.Claude Code will:
- Find your credentials automatically
- Discover your tables from types.ts
- Export each table to a JSON file
- Tell you what worked and what didn't
Bonus: Export Storage Files
If your project uses Supabase Storage, you can export those too.
First, find your bucket name: Search your code for storage or bucket, or ask Lovable AI: *"What storage buckets does my project use?"*
Then add this prompt:
I also need to export storage files.
My bucket is called: {bucket_name}
Please:
1. List all files in the bucket:
POST {SUPABASE_URL}/storage/v1/object/list/{bucket_name}
Body: {"prefix":"","limit":1000}
2. Download each file:
GET {SUPABASE_URL}/storage/v1/object/public/{bucket_name}/{filename}
Save to ./export/storage/{bucket_name}/{filename}
3. Tell me what was downloadedYour export folder will look like:
./export/
├── tables/
│ ├── users.json
│ ├── posts.json
│ └── settings.json
└── storage/
└── my-bucket/
├── image1.png
└── image2.pngWhat You Can Export
| Works well | Might be empty | Can't export |
|---|---|---|
| Public tables | Tables with strict RLS | Auth users (passwords hashed) |
| Public storage | Private storage | Database functions/triggers |
| Data your app can read | User-specific data | RLS policies |
Public tables
Tables with strict RLS
Auth users (passwords hashed)
Public storage
Private storage
Database functions/triggers
Data your app can read
User-specific data
RLS policies
Empty results aren't errors — it's RLS doing its job. The anon key respects your security rules.
The User ID Problem
One thing to know: if your tables have user_id columns that reference auth.users, those IDs won't match when users register in a new Supabase project.
Options:
- Fresh start — users re-register, old data stays orphaned
- Match by email — write logic to reconnect users to their data
- Preserve UUIDs — use admin API to create users with same IDs (advanced)
The complete migration guide covers this in more detail.
What's Next?
After exporting, you'll want to:
- Create a new Supabase project
- Run your migrations (they're in
supabase/migrations/) - Import the JSON data
- Update your app's credentials
For the full process, see: Migrating from Lovable Cloud to Your Own Supabase
Why Learn This Method?
You might be wondering why bother with the terminal when there's a visual guide.
Here's the thing: migrating is a chance to level up.
By using Claude Code and REST APIs, you'll understand:
- How Supabase actually works under the hood
- How to talk to any API
- How to automate repetitive tasks
These skills transfer to everything you build next.
Let Me Know How It Goes
I'd love to hear if this worked for you. This method is still being tested and refined.
- Did it work for your project?
- Did you hit any edge cases?
- What would make it better?
Every data point helps improve this guide.
*This is one of several migration methods. Pick what matches your comfort level — or challenge yourself to learn something new.*
Related guides:
- Complete Migration Guide — visual, step-by-step
- When to Use Lovable Cloud vs Your Own Supabase
- How to Disconnect from Lovable Cloud
Related skill: Lovable Cloud Migration — full migration guide including export methods and troubleshooting.