Move Your Lovable Backend & Data to Supabase

Move your Lovable Cloud backend and data to your own Supabase project while keeping your website or web app connected and working.

Roadmap & Resources

Check Your Current Lovable Backend

Confirm the Project Uses Lovable Cloud

First, confirm that the project actually uses Lovable Cloud rather than a Supabase project you already own.

In Lovable, open the Cloud section and check the backend connected to the project.

Review What Needs to Move

Then use Lovable to review what needs to move.

Backend Migration Review

Lists the database tables and relationships, Row Level Security policies, functions and triggers, authentication methods and OAuth providers, storage buckets, Edge Functions, realtime features, secret names, external services and existing migration files — then returns a migration checklist grouped into six areas, without changing anything.

Review this project specifically for migrating its backend from Lovable Cloud to a Supabase project that I own. Identify: - all database tables and relationships - Row Level Security policies - database functions and triggers - authentication methods and OAuth providers - storage buckets - Edge Functions - realtime features - environment variables and secrets — names only - external services such as Stripe, email, AI APIs, or webhooks - all existing files in `supabase/migrations` Do not change or migrate anything yet. Give me a short migration checklist grouped into: 1. Database structure 2. Data 3. Authentication 4. Storage 5. Functions and secrets 6. App configuration

Open Lovable

NOTE

If the project is already connected to a Supabase project in your own Supabase account, you do not need this migration.

Create Your Own Supabase Project

Create a Supabase Project

Create a new project in Supabase.

Create a Supabase Project

Move your database, authentication, storage, and backend services to a Supabase project you control.

BACKEND USED IN THIS TUTORIAL

https://supabase.com/dashboard

Keep the new project's:

Project ID

Project URL

Publishable or anon key

Point the Project at the New Supabase Project

Then update the Lovable project's Supabase configuration to point to the new project.

Typical frontend variables include:

VITE_SUPABASE_PROJECT_ID VITE_SUPABASE_PUBLISHABLE_KEY VITE_SUPABASE_URL

VITE_SUPABASE_PROJECT_ID

Project ID

VITE_SUPABASE_PUBLISHABLE_KEY

Publishable or anon key

VITE_SUPABASE_URL

Project URL

Also update the project reference in:

supabase config.toml

IMPORTANT

Do not expose Supabase secret/server keys in frontend code.

Move the Database Structure

Find and Apply the Migration Files

Lovable projects using Lovable Cloud include SQL migration files in:

supabase migrations

Apply these migrations to your new Supabase project in chronological order.

They can recreate backend structure such as:

- Tables and columns

- Relationships and indexes

- RLS policies

- Database functions

- Triggers

- Storage bucket configuration

Review the Migrations Before You Apply Them

Before applying them, you can ask your AI coding assistant to review the migration files.

Migration File Review

Checks migration order, dependencies between migrations, tables and relationships, functions and triggers, Row Level Security policies and storage configuration, then returns the safest order to apply them plus any manual actions required.

Review all SQL migration files in `supabase/migrations` before I apply them to a new Supabase project. Check: - the correct migration order - dependencies between migrations - tables and relationships - functions and triggers - Row Level Security policies - storage configuration Identify anything that may fail or require manual setup. Do not rewrite migrations unnecessarily. Give me the safest order to apply them and any manual actions I need to complete.

Apply each migration and confirm it succeeds before continuing.

NOTE

Lovable officially documents these migration files as the method for recreating the schema on a managed Supabase project.

Move Your Data, Users, and Files

Move Database Data

In Lovable:

Cloud Database Table Export CSV

Export the tables containing data.

Then open the matching tables in Supabase and import the CSV files.

Important records, relationships, and IDs are preserved correctly

Reconfigure Authentication

In Supabase, enable the authentication methods your project uses.

Reconfigure any OAuth providers such as Google or GitHub and update their callback URLs for the new Supabase project.

IMPORTANT

Existing Lovable Cloud user data can be migrated only partially: Lovable states that user passwords cannot be exported, so existing users may need a password-reset flow after migration.

Move Storage Files

Download the files used by the project from:

Lovable Cloud Storage

Then upload them to the corresponding buckets in your Supabase project.

The expected storage policies still apply

Restore Functions, Secrets, and App Connections

Recreate Your Production Secrets

Recreate any production secrets required by your backend in Supabase.

For example:

- Stripe keys

- Email provider credentials

- AI API keys

- Webhook secrets

- Other server-side credentials

Store server-side secrets securely in the appropriate Supabase backend configuration.

IMPORTANT

Never commit private secrets to GitHub or expose them through frontend environment variables.

Redeploy Edge Functions and Repoint the App

If the project uses Edge Functions, make sure they are deployed to the new Supabase project and have access to the required secrets.

Then check that the website or web app now points to the new Supabase backend, not the old Lovable Cloud project.

Test the New Backend and Complete the Move

Test the Project Against the New Backend

Test the project thoroughly against the new Supabase backend.

Sign up and login

Password reset

Database reads and writes

User-specific access

RLS policies

Storage uploads and downloads

Realtime features if used

Edge Functions

Forms

Payments

Emails

External APIs and webhooks

Set the Production URLs in Supabase

If the website or web app uses a production domain, configure the correct Site URL and authentication redirect URLs in Supabase.

Complete the Move

IMPORTANT

Do not remove or abandon the old Lovable Cloud backend until the new Supabase setup is fully verified and you have any backups you still need.

Your backend architecture is now:

Lovable Website / Web App → Your Supabase Project

You can continue using Lovable to build the project while managing the backend directly through your own Supabase account.