How to Connect Supabase to Lovable: Integration Guide
Last updated: By The Migrator Team
Many builders ask how to connect Supabase to Lovable, and the answer depends on which starting point you have: a new app that should use your own Supabase from day one, or an existing app on Lovable Cloud that you want to move. The two paths end in the same place: an app talking to a Supabase project that you own.
This guide explains how the connection works, which values matter, and how to set up authentication and edge functions correctly. Lovable's interface changes over time, so use the official Lovable documentation for the exact buttons, and this guide for what the values mean and how to verify them.
How the Lovable and Supabase connection works
A Lovable app talks to Supabase through the Supabase client library. The client needs only two things: the project URL and a publishable (anon) key. Those are normally supplied through environment variables, VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY, plus a project id used by tooling.
Everything else, your tables, auth settings, storage buckets and functions, lives inside the Supabase project. So connecting your own project means making sure that project contains what the app expects.
Connect Supabase to Lovable: start a new app on your own project
1Create the Supabase project
Sign up at supabase.com and create a project, then note its URL and publishable key from Project Settings → API.

Supabase project settings showing the URL and keys needed to connect Supabase to Lovable 2Connect it in Lovable
Follow the Supabase integration steps in the Lovable documentation to link your project. Lovable can then generate tables, policies and functions against it.
3Review what was created
Open the Supabase dashboard and check the tables and Row Level Security policies that were generated, before real users arrive.
Option B: Move an existing Lovable Cloud app to your Supabase
If your app already runs on Lovable Cloud, you copy its backend into your own project and then switch the connection values. The free migration tool automates the copy, and the complete guide explains each step. Then follow how to update your .env after migrating.
Set up authentication correctly
The Supabase Auth docs cover each provider.
- Set the Site URL and redirect URLs under Authentication → URL Configuration to your real domain, or sign-in links will return to the wrong place.
- Enable each login method you use (email, Google and others) under Authentication → Sign In / Providers. Social providers need your own OAuth credentials.
- Decide whether email confirmation is required and check your email templates.
- If you moved users from Lovable Cloud, follow the auth users guide so passwords keep working.
Edge functions and secrets in the connected project
Edge functions run inside your Supabase project and read secrets from it. Set secrets with supabase secrets set or in the dashboard under Edge Functions, and read them in code with Deno.env.get. Never put secret keys in front-end environment variables, because those are visible to every visitor. The steps are in how to deploy Lovable edge functions, and the official reference is the Supabase Edge Functions docs.
Test the connection
- Sign up or sign in and confirm a row appears in the auth.users table.
- Create, read, edit and delete a record as a normal user, to prove RLS policies allow it.
- Upload a file and open it.
- Call an edge function and read its logs.
- Check the Supabase logs for permission errors.
Frequently asked questions
How do I connect Supabase to Lovable?
Use your Supabase project's URL and publishable key as the app's environment variables, and make sure its tables, auth settings and policies exist. The Lovable documentation describes its Supabase integration step by step.
Is Lovable Cloud the same as a Supabase project?
Lovable Cloud is a managed backend built on the same technology. A Supabase project you create yourself is one you own and manage directly.
Which Supabase key goes in the front end?
Only the publishable (anon) key. Keep the service role key out of front-end code and use it only in server-side code and edge function secrets.
Why does sign-in redirect to the wrong URL?
The Site URL and redirect URLs in Supabase Auth settings must match your real domain.
Can I switch an existing Lovable app to my own Supabase?
Yes. Migrate the schema, data, users and files, then update the environment variables. Our free migration tool automates the migration.
Related guides
How to Connect Your Lovable App to Your New Supabase Project
Update .env and config.toml, redeploy and test the switch safely.
How to Migrate from Lovable Cloud to Supabase
The complete pillar guide: schema, data, users, files and functions, end to end.
Lovable Edge Functions: How to Deploy Them on Your Own Supabase Project
CLI commands to deploy your functions and re-add every secret.