# Export Your Lovable Cloud Data (Using Claude Code)

> Get your data out using the REST API.

Published: 2026-01-18
Author: Carol Monroe
Canonical: https://carolmonroe.com/blog/export-lovable-cloud-claude-code

> 📌 **Update (July 2026):** Lovable Cloud now has an official exit! Export project data, Pause Cloud, and Remove Lovable Cloud all live under Cloud > Overview > Advanced settings. The guide below still works and remains useful for deep details, but there is a much easier official path now: [Leaving Lovable Cloud Is Finally Official (And It Might Make You Stay)](/blog/export-remove-lovable-cloud).

> 📌 **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](/blog/lovable-cloud-mcp-migration) 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](/blog/lovable-cloud-migration). 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](/blog/lovable-cloud-migration) 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 address
- `VITE_SUPABASE_PUBLISHABLE_KEY` (or `ANON_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:

```bash
git clone https://github.com/your-username/your-project.git
cd your-project
```

---

## Step 3: Install Claude Code

If you don't have Claude Code yet:

**Mac/Linux:**
```bash
curl -fsSL https://claude.ai/install.sh | bash
```

**Windows (PowerShell):**
```powershell
irm https://claude.ai/install.ps1 | iex
```

No prerequisites needed. One command and you're ready.

**Resources:**
- [Official setup guide](https://code.claude.com/docs/en/setup)
- [Installation guide](https://www.eesel.ai/blog/npm-install-claude-code)

---

## Step 4: Export Your Data

Open Claude Code in your project folder:

```bash
cd your-project
claude
```

Then 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 downloaded
```

Your export folder will look like:

```
./export/
├── tables/
│   ├── users.json
│   ├── posts.json
│   └── settings.json
└── storage/
    └── my-bucket/
        ├── image1.png
        └── image2.png
```

---

## What 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 |

> ⚠️ **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](/blog/lovable-cloud-migration) covers this in more detail.

---

## What's Next?

After exporting, you'll want to:

1. Create a new Supabase project
2. Run your migrations (they're in `supabase/migrations/`)
3. Import the JSON data
4. Update your app's credentials

> ✅ For the full process, see: [Migrating from Lovable Cloud to Your Own Supabase](/blog/lovable-cloud-migration)

---

## 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](/blog/lovable-cloud-migration) — visual, step-by-step
- [When to Use Lovable Cloud vs Your Own Supabase](/blog/lovable-cloud-vs-supabase)
- [How to Disconnect from Lovable Cloud](/blog/disconnect-lovable-cloud)

---

**Related skill:** [Lovable Cloud Migration](https://ajvkznmwjdeariuzlwoa.supabase.co/storage/v1/object/public/skills/lovable-cloud-migration.skill) — full migration guide including export methods and troubleshooting.
