Introduction
This guide moves a Lovable app, including its Lovable Cloud backend, to Shard Cloud. When you finish, every piece has a new home: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 samesupabase-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.
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_restorefor 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.
supabase/migrations/ in older projects, drizzle/migrations/ in newer ones) and your edge functions (supabase/functions/), but no data and no files.
Step 2: Export Your Database and Files
Database
Start the export
Wait for the email
Download it
.zip, extract it. Rename the .backup file inside to lovable.backup..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: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 (like0 * * * *) and the edge function or API route each one calls. They don’t come with the export.
Step 3: Create Your Supabase Database
Create the database
Wait for it to start
Copy the connection details
- 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
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:- The
authschema, data only: your users and their password hashes. Our Supabase already created theauthtables, so only the rows are copied. - The
publicschema, in full: your tables, data, functions, RLS policies, grants and Realtime settings.
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:
auth tables that have data, except schema_migrations (our Supabase manages that one):
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.Make a folder for the app
lovable.backup, the restore.sh script below, and this .shardcloud:Upload it
Set the PGHOST environment variable first: that is expected.Give it the connection
PGHOST: the database hostPGUSER: the database userPGPASSWORD: the database passwordPGDATABASE:postgresPGSSLMODE:require
Read the result
auth.users. The script runs once: it leaves a restore.done file, so a restart doesn’t import the data a second time.Delete the app
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:
CREATE TRIGGER statements in your code:
psql, or the database visualizer in the dashboard) and run each CREATE TRIGGER ... ON auth.users ... statement you found. For example:
public.handle_new_user) was already imported with the public schema (pass 2).
Check the import
Run these queries on the database: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.Create the project
Environment variables
Create a.env file. Put the secrets you copied from Lovable here too:
The server
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
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 writescdn-map.json, which maps each old path to its new CDN URL. Run it on your computer:
Update the links in your database
If your tables store Lovable storage URLs (likehttps://<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:
update statements from cdn-map.json with a small script.
Change the upload code
Replace eachsupabase.storage upload in your frontend with a call to your API, and save the returned URL instead of a storage path:
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.Create a mailbox
contact@yourdomain.com.Add the DNS records
Copy the SMTP details
465, TLS), username and password into the API’s .env (step 5).Send from your API
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.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:
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.
src/integrations/supabase/client.ts instead. Replace them there:supabase.from(...), supabase.auth and supabase.channel(...) code.
Step 9: Deploy Your Frontend
Lovable apps come in two kinds. Checkpackage.json:
- Vite + React (most apps)
- TanStack Start
dist/. Create a .shardcloud file:node_modules/ and dist/, and upload it in the Dashboard. To use your own domain, see Custom Domain.
Step 10: Test Everything
Log in as an existing user
Sign up a new user
public.profiles.Upload a file
Send an email
Open the app in two browsers
Step 11: Switch Over
Do a test run of steps 2 to 10 first, and time the export and import. Then move for real:Stop writes on Lovable
Take the final export
Import into a new database
Point your domain to Shard Cloud
Retire Lovable
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
The app shows CORS or network errors
The app shows CORS or network errors
- Check that
VITE_SUPABASE_URLis the API URL from the database page, with no/rest/v1at the end. - Rebuild the frontend after changing
.env: Vite writes the values into the build. - For the Node.js API, check that
FRONTEND_URLis exactly your app’s address.
Could not find the table in the schema cache
Could not find the table in the schema cache
notify pgrst, 'reload schema'; on the database.Old users get invalid credentials
Old users get invalid credentials
select count(*) from auth.users;Users are logged out after the move
Users are logged out after the move
New users have no profile
New users have no profile
auth.users is missing. Re-create it as shown in step 4.Password reset emails never arrive
Password reset emails never arrive
pg_restore errors on the import
pg_restore errors on the import
- Import into a new, empty database: the import never drops anything first.
- Use the
postgres:18image, as in the commands above: Lovable’s export is compressed in a way olderpg_restoreversions can’t read.
CDN upload fails
CDN upload fails
- 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.