Skip to main content

Introduction

This guide moves a Lovable app, including its Lovable Cloud backend, to Shard Cloud. When you finish, every piece has a new home: Your users keep their accounts: they log in with the same email and password they used before.
Migrating from Lovable requires at least the Core plan. A Supabase database needs at least 2048 MB of RAM, plus the RAM of the apps you deploy next to it.

Before You Start

Where each feature runs

Everything your app uses on Lovable has a place on Shard Cloud. Auth, database and Realtime keep the same supabase-js code; storage and email use Shard Cloud’s own APIs:

Not supported yet

These Lovable features have no replacement yet:
  • Emails sent by auth itself: our Supabase auth doesn’t send email. New sign-ups are confirmed automatically, and these flows don’t work: password reset (resetPasswordForEmail), confirm email, magic links and email codes (signInWithOtp), invites (inviteUserByEmail), email change and reauthentication. This is only about auth’s own emails: every email your app sends (welcome messages, notifications, receipts) works through Shard Cloud email (step 7).
  • Lovable AI and app connectors: they run through Lovable (LOVABLE_API_KEY). Call the provider directly from your API with your own key instead.
If your app depends on password reset or magic links, plan a replacement first, or wait until we support it.

Check your code

Download your code (step 1), then search it for the features above:

What you need

  • A Shard Cloud account on the Core plan or higher
  • Docker installed on your computer (it runs pg_restore for the database import), or, for an export up to 100 MB, a temporary Shard Cloud app instead (step 4)
  • Node.js 18 or newer
  • A Lovable paid plan, to download the code as a zip (or GitHub sync, which works on every plan)

Step 1: Export Your Code

Pick one:
  • GitHub: in Lovable, connect the project to GitHub. Lovable creates a repository with your code; clone it.
  • Zip: in the code editor, or in Project settings → Git, click Download codebase.
The code includes your database migrations (supabase/migrations/ in older projects, drizzle/migrations/ in newer ones) and your edge functions (supabase/functions/), but no data and no files.
After you move, keep editing the app in your own editor (or Claude Code, Cursor, etc.). A Lovable Cloud project can’t be switched to an outside backend, so the Lovable editor stays on the old one.

Step 2: Export Your Database and Files

Database

1

Start the export

In Lovable, open More → Database → Manage → Settings. Under Export project data, click Export data, then Export, then Start export.
2

Wait for the email

Lovable emails you when the export is ready and saves it to your project’s storage.
3

Download it

Download the file from More → Storage and keep it on your computer. If it comes as a .zip, extract it. Rename the .backup file inside to lovable.backup.
The export holds your tables, your RLS policies, and your users’ accounts with their password hashes. It doesn’t hold storage files, edge function code, secrets, sign-in provider settings or scheduled jobs. Lovable allows one export every 24 hours, only while the database is running: resume a paused project first. Exports work for databases up to 15 GB.
The import below needs Lovable’s .backup file (a compressed PostgreSQL custom-format archive). If you got a plain .sql file instead, contact us on Discord before you continue.

Storage files

The database export does not include files in storage. In Lovable, open More → Storage, open each bucket, select its files and download them (several files download as one zip). Put them in a folder on your computer, with one subfolder per bucket:
Download the database export and your files before you remove Lovable Cloud from the project. Files saved in Lovable’s storage are gone after that.

Secrets

Secrets (API keys you added in Lovable, such as Stripe keys) are not exported either, and Lovable never shows a secret’s value again after you save it. Note the names in More → Settings → Secrets, then get each value again from the service that issued it (Stripe’s dashboard, for example): you will put them in the Node.js API app.

Scheduled jobs

Note the jobs listed in More → Database → Manage → Jobs: their schedule (like 0 * * * *) and the edge function or API route each one calls. They don’t come with the export.

Step 3: Create Your Supabase Database

1

Create the database

In the Shard Cloud Dashboard, create a new database and choose Supabase as the type, with at least 2048 MB of RAM.
2

Wait for it to start

The first start takes about a minute. Until it’s ready, the API URL answers with an error page.
3

Copy the connection details

On the database page, copy:
  • The API URL, like https://apiview-postgres-<id>.shardweb.app
  • The anon key (public: it goes into your frontend)
  • The database host, like postgres-<id>.shardatabases.app, the user and the password
The page also shows a service_role key. It bypasses row level security: never put it in your frontend.

Step 4: Import Your Database

Import into the new, empty database you just created: the import doesn’t delete anything first. The import runs in two passes, in this order:
  1. The auth schema, data only: your users and their password hashes. Our Supabase already created the auth tables, so only the rows are copied.
  2. The public schema, in full: your tables, data, functions, RLS policies, grants and Realtime settings.
Users go first because your tables’ foreign keys to auth.users (a profiles table, for example) can only be created once the users exist. In the other order, pg_restore copies the rows but skips those foreign keys, with only an error in its output to show it. Run these commands from the folder that holds lovable.backup (on Windows, use Git Bash or WSL). Replace the values with the ones from step 3:
Pass 1: your users List the auth tables that have data, except schema_migrations (our Supabase manages that one):
Then copy their rows:
Pass 2: the public schema

No Docker? Restore from a Shard Cloud app

You can run the same import on Shard Cloud instead, in a small temporary app. It needs no Docker on your computer, and it connects with your database’s own user and password. It works for an export up to 100 MB (the app upload limit); for a bigger one, use Docker as above.
1

Make a folder for the app

Put three files in an empty folder: your lovable.backup, the restore.sh script below, and this .shardcloud:
.shardcloud
2

Upload it

Zip the folder and upload it in the Dashboard. Its first start logs Set the PGHOST environment variable first: that is expected.
3

Give it the connection

In the app’s environment variables in the dashboard, add the values from step 3, then restart the app:
  • PGHOST: the database host
  • PGUSER: the database user
  • PGPASSWORD: the database password
  • PGDATABASE: postgres
  • PGSSLMODE: require
4

Read the result

The app’s logs show both passes and a check at the end: the number of users, your tables and their foreign keys to auth.users. The script runs once: it leaves a restore.done file, so a restart doesn’t import the data a second time.
5

Delete the app

Once the import is checked, delete the app: it holds your export, with your users’ password hashes.
restore.sh
An exit code of 1 means pg_restore skipped something and printed why just above it. Read those errors before you go on: a message about a role that doesn’t exist is usually harmless, a failed foreign key or table is not.

Re-create your triggers on auth.users

Many Lovable apps create a row in public.profiles whenever someone signs up, through a trigger on auth.users (often named on_auth_user_created). That trigger lives in the auth schema, so the data-only pass above does not bring it. List the triggers in your export:
Then find their CREATE TRIGGER statements in your code:
Connect to the database (with psql, or the database visualizer in the dashboard) and run each CREATE TRIGGER ... ON auth.users ... statement you found. For example:
The function itself (public.handle_new_user) was already imported with the public schema (pass 2).

Check the import

Run these queries on the database:
Users keep their accounts and passwords, but not their sessions: everyone logs in once more after the move.
If some users never confirmed their email on Lovable, they may not be able to log in. Since our Supabase doesn’t send confirmation emails, you can mark them as confirmed: update auth.users set email_confirmed_at = now() where email_confirmed_at is null; Only do this if you trust those addresses.

Step 5: Create the Node.js API

Edge functions don’t run on our Supabase, and the CDN token and the SMTP password must never reach the browser. So the code that used to run in edge functions moves to a small Node.js API app. It checks the user’s Supabase session, then does the work on their behalf.
Newer Lovable apps (TanStack Start) already have their own server, with server functions and API routes instead of edge functions. You can put the code below in those API routes and skip the separate API app.

Create the project

Environment variables

Create a .env file. Put the secrets you copied from Lovable here too:
.env

The server

server.js
Port each edge function from supabase/functions/ to a route like the ones above. Edge functions are written for Deno, so change Deno.env.get('X') to process.env.X and serve(async (req) => ...) to an Express route. Port each scheduled job to a cron.schedule(...) with the same schedule, calling the code its edge function or API route ran. Lovable’s LOVABLE_CRON_SECRET check isn’t needed: the job now runs inside your API. Keep the API at a single instance, or each job runs once per instance.

Deploy it

.shardcloud
Zip the project without node_modules/ and upload it in the Dashboard. The API is then at https://myappapi.shardweb.app.

Step 6: Move Storage to the CDN

Upload your existing files

This script uploads every file from the folder you downloaded in step 2 and writes cdn-map.json, which maps each old path to its new CDN URL. Run it on your computer:
migrate-files.js
The CDN accepts files from 2 KB to 100 MB in a single request (bigger files: see large file uploads), of the supported file types. The script prints every file it skipped or that failed, so you can handle those by hand.
If your tables store Lovable storage URLs (like https://<project>.supabase.co/storage/v1/object/public/avatars/abc.png) or paths (like avatars/abc.png), replace them with the URLs in cdn-map.json. For example, for an avatar_url column:
For many files, generate these update statements from cdn-map.json with a small script.

Change the upload code

Replace each supabase.storage upload in your frontend with a call to your API, and save the returned URL instead of a storage path:
Before
After
Lovable buckets are private by default: their files are protected by row level security and shared through signed links (createSignedUrl) that expire after an hour. Every CDN file is reachable by anyone who has its URL. The random names above make URLs impossible to guess, but anyone a URL is shared with can open it. For truly private files (contracts, IDs, invoices), keep them behind your API instead of putting them on the CDN, or use the CDN’s expire_at for files that only need to live for a while.

Step 7: Send Emails Through Shard Cloud Email

Your app’s emails go through Shard Cloud email: your code connects to your mailbox’s SMTP server and sends the mail.
1

Create a mailbox

In the Dashboard, buy a mailbox, verify your domain and set up an address, such as contact@yourdomain.com.
2

Add the DNS records

Add the MX, SPF, DKIM and DMARC records the dashboard shows (one click if your domain uses Shard Cloud DNS), so your mail doesn’t land in spam.
3

Copy the SMTP details

On the mailbox page, copy the SMTP host, port (465, TLS), username and password into the API’s .env (step 5).
4

Send from your API

Use mailer.sendMail(...) as in the /send-welcome route. Move every email your app sent (through Lovable’s built-in app emails, or a provider such as Resend) there.
Each mailbox has an hourly sending limit that depends on its plan (75, 150 or 250 emails per hour). It’s made for your app’s transactional emails, not for newsletters or bulk mail.
Then call the route from your frontend instead of supabase.functions.invoke(...):

Step 8: Point Your Frontend to Shard Cloud

Open the .env file at the root of your Lovable code and set your new Supabase database:
.env
Leave VITE_SUPABASE_PROJECT_ID and SUPABASE_PROJECT_ID as they are, unless the check in “Before You Start” found code that builds a supabase.co address from them.
Older Lovable projects write the URL and key directly in src/integrations/supabase/client.ts instead. Replace them there:
src/integrations/supabase/client.ts
Nothing else changes in your supabase.from(...), supabase.auth and supabase.channel(...) code.

Step 9: Deploy Your Frontend

Lovable apps come in two kinds. Check package.json:
The app builds to static files in dist/. Create a .shardcloud file:
.shardcloud
See the Vite tutorial for more options.
Zip the project without node_modules/ and dist/, and upload it in the Dashboard. To use your own domain, see Custom Domain.

Step 10: Test Everything

1

Log in as an existing user

Use an account from Lovable with its old password, and check that it sees its own data (your RLS policies).
2

Sign up a new user

Check that the profile row your trigger creates appears in public.profiles.
3

Upload a file

Check that it gets a CDN URL and shows in the app.
4

Send an email

Check that it arrives, and not in spam.
5

Open the app in two browsers

If your app uses Realtime, check that a change made in one shows up in the other.

Step 11: Switch Over

Do a test run of steps 2 to 10 first, and time the export and import. Then move for real:
1

Stop writes on Lovable

Pause sign-ups and changes in the Lovable app (or tell your users), so no data is written after the final export.
2

Take the final export

Export the database again (step 2) and download any files added since your test run. Remember: one export every 24 hours.
3

Import into a new database

Create a fresh Supabase database and repeat steps 4 and 6, then update the API URL and anon key in your apps.
4

Point your domain to Shard Cloud

5

Retire Lovable

Turn off the scheduled jobs on Lovable, so they don’t run twice. Unpublish the app, so the lovable.app address stops serving the old version. Only remove the Lovable Cloud backend once you’ve checked your downloads: that deletes its exports and files too.

Troubleshooting

  • Check that VITE_SUPABASE_URL is the API URL from the database page, with no /rest/v1 at the end.
  • Rebuild the frontend after changing .env: Vite writes the values into the build.
  • For the Node.js API, check that FRONTEND_URL is exactly your app’s address.
The API hasn’t seen a new table yet. Run notify pgrst, 'reload schema'; on the database.
Check that pass 1 of the import (your users) ran: select count(*) from auth.users;
This is expected: sessions don’t carry over. Users log in again with their old password.
The trigger on auth.users is missing. Re-create it as shown in step 4.
Supabase auth’s own emails aren’t supported yet, so password reset, magic links and email confirmation don’t work. The request answers as if it worked, but no email is sent. Emails your code sends through Shard Cloud email (step 7) are not affected.
  • Import into a new, empty database: the import never drops anything first.
  • Use the postgres:18 image, as in the commands above: Lovable’s export is compressed in a way older pg_restore versions can’t read.
  • Files must be between 2 KB and 100 MB and of a supported type.
  • Names may only use letters, numbers, _ and -, up to 64 characters, with no extension.

Additional Resources