Staticbot logoStaticbot.dev
    Lovable logo
    Supabase logo

    Migrate from Lovable to Supabase manually

    This is the manual, do-it-yourself path. The automated Staticbot migration is free and takes ~15 minutes.

    The 8 CLI steps below give you full control at the cost of a few hours of developer time. If you'd rather not run commands by hand, Staticbot automates the whole migration for free — schema, data, auth users with password hashes, OAuth identities, edge functions, storage, secrets, and cron jobs — and stands up a working preview before anything goes live.

    Automated guide

    Manual migration

    How to migrate from Lovable to Supabase manually (8 steps)

    ~2–3 hours

    Prerequisites

    • New Supabase project created
    • Supabase CLI installed and authenticated
    • Git repository set up

    1Update Local Configuration

    Update your local environment to point to your new Supabase project.

    Update .env

    Replace your existing credentials with the new ones:

    • VITE_SUPABASE_PROJECT_ID
    • VITE_SUPABASE_PUBLISHABLE_KEY
    • VITE_SUPABASE_URL

    Update supabase/config.toml

    Update the project_id field with your new project's ID.

    Link Supabase CLI

    supabase link --project-ref <project-id>

    2Deploy Database Schema

    Push your existing database migrations to the new instance.

    supabase db push

    Verify that all migrations have been applied successfully.

    3Deploy Edge Functions

    Deploy all your server-side logic.

    supabase functions deploy

    If needed, remove any functions from config.toml that are no longer required, and verify that all deployed functions are active in your dashboard.

    4Configure Supabase Secrets

    Set up encryption and API keys via the Supabase dashboard or CLI.

    Critical: ENCRYPTION_SECRET

    Must be a 64-character hex string (not base64). Use this command to generate the correct format:

    openssl rand -hex 32

    5Migrate Data (with passwords intact)

    Don't use CSV exports for this

    Exporting tables as CSV from Lovable Supabase → Table Editor strips bcrypt password hashes from auth.users.encrypted_password, which forces every one of your users to reset their password. Use pg_dump instead — it preserves the hashes verbatim and gets foreign-key ordering right.

    Dump source data with pg_dump

    In Lovable, open Supabase → Project Settings → Database and copy the connection string. Then:

    pg_dump --data-only --no-owner --no-privileges \
      --schema=auth --schema=public --schema=storage \
      "$SOURCE_DATABASE_URL" > data.sql

    This dumps auth.users (including encrypted_password), auth.identities (OAuth links), all your public-schema rows, and storage metadata — in the right dependency order. For the broader question of which auth tables to migrate and which to deliberately skip (auth.schema_migrations, auth.flow_state, etc.), see our Supabase auth migration scope guide.

    Restore to your new Supabase

    Grab the target's connection string from Supabase → Project Settings → Database and apply the dump:

    psql "$TARGET_DATABASE_URL" -v ON_ERROR_STOP=1 -f data.sql

    Storage object files (the actual bytes in buckets) aren't in the database dump — copy them separately with the Supabase CLI or rclone against the S3-compatible storage endpoint. Existing users sign in with their existing passwords.

    6Reconfigure OAuth Providers

    Google/GitHub/Apple OAuth client IDs and secrets live in Supabase's auth control plane, not in the database — pg_dump doesn't carry them. In your new project's dashboard go to Authentication → Providers and re-enter each provider's client ID, secret, and redirect URL. The matching auth.identities rows are already restored from Step 5, so once providers are configured, OAuth users continue signing in without re-authorising. (More on why this gap exists and how to test for it before cutover in our auth migration scope guide.)

    7Remove Lovable AI Dependencies

    If applicable, update your code to remove references to the Lovable AI Gateway. Replace any Lovable AI calls with direct provider APIs and redeploy any affected edge functions.

    8Finalize & Deploy

    Clear Cache

    rm -rf node_modules/.vite
    npm run dev

    Hard refresh your browser and verify network requests are hitting the new Supabase instance.

    Commit & Push

    git add .env supabase/config.toml
    git commit -m "feat: Migrate to Supabase"
    git push origin main

    Lovable will automatically sync environment variables from GitHub. Verify the production environment update.

    Post-Manual Migration Checklist

    All edge functions deployed
    Encryption working (test API key)
    Database schema migrated
    Local dev connected
    Critical data imported
    Lovable production connected
    User accounts migrated
    All critical features tested

    Rather not run commands?

    Staticbot does all 8 steps for you — free

    Connect your Lovable GitHub repo and a target Supabase project, confirm each phase in a dashboard, and you're done — schema, data, auth users with password hashes, OAuth identities, edge functions, storage, secrets, and cron jobs, all migrated automatically in about 15 minutes. Migrations are free.