31. Migrating from Supabase, step by step

Move a Supabase project — schema, users, data, files, edge functions, scheduled jobs and the app's code — with the CLI, or let Claude do it with the migration skill.

This chapter walks through a whole migration: schema, users and data, files, edge functions, scheduled jobs, the app's code, and the switch-over. Each step reads your Supabase project and writes only to the Eurobase project that is active in the CLI; Supabase keeps running until you switch. Do it into a test project first. The answers to common questions are in Migrating from Supabase.

Prefer to have an agent do it? The Claude skill in the next section drives these same steps, stops for every decision that is yours, and changes your app's code at the end.

Use Claude Code

Install the skill in your app's repository, then ask Claude to migrate the project. It runs the CLI, reports what each step found, waits for your decisions, and checks the results.

mkdir -p .claude/skills/eurobase-supabase-migration
curl -fsSL https://raw.githubusercontent.com/STGime/euroback/main/integrations/supabase-migration/SKILL.md \
-o .claude/skills/eurobase-supabase-migration/SKILL.md

Keep secrets out of the chat: set the Supabase variables below in your own terminal; the agent refers to them by name.

0. Prepare

  • The Eurobase CLI 0.6.9 or later (see CLI), signed in: eurobase login.
  • pg_dump with the same major version as your Supabase database or newer (brew install libpq on macOS).
  • In your terminal: SUPABASE_DB_URL from Supabase → Connect → Session pooler (the direct db.<ref>.supabase.co host is IPv6-only). For files also SUPABASE_URL (https://<ref>.supabase.co) and SUPABASE_SERVICE_ROLE_KEY.
  • Your Supabase project folder, with supabase/functions/ and supabase/config.toml if you use edge functions (supabase functions download <name> fetches one that isn't in git).
  • A fresh target project. Every command acts on the active project, marked * in the list.
  • A folder of its own for the migration (mkdir migration && cd migration): eurobase migrations up applies ./migrations of the current folder, and your app may have a migrations/ folder already. The commands below run from there and reach your Supabase folder with ../. Keep it out of git — from step 3 on it holds user data.
export SUPABASE_DB_URL='postgresql://postgres.<ref>:…@aws-0-<region>.pooler.supabase.com:5432/postgres'
eurobase projects create my-app-test
eurobase switch my-app-test
eurobase projects list # * marks the active project

1. Assess

eurobase import supabase assess --functions-dir ../supabase/functions

Writes a report of everything the migration will meet, graded ✅ / ⚠️ / ❌: tables, policies, database functions and triggers, extensions, users, buckets and edge functions. Read the ⚠️ and ❌ items first. The common ones:

  • SECURITY DEFINER functions become normal functions that run with the caller's rights. Whatever relied on the owner's rights moves to server code: an edge function with ctx.db.asService(), or your backend with the secret key.
  • A trigger on auth.users (creating a profile at sign-up) has no equivalent; that work moves into the sign-up code or an edge function.
  • GRANT / REVOKE restrictions (a column hidden from anon) are not carried over, and a view doesn't hide columns. Restricted columns move to their own table with stricter policies, or behind an edge function.

2. Schema

eurobase import supabase schema --migrations-dir ./migrations
eurobase migrations up

Translates your tables, policies, functions, triggers and views, and writes one migration. If access rules can't be carried over as they are, it lists them and writes nothing until you accept them with --accept-access-changes; the accepted list stays at the top of the file. Every table with RLS also gets a eurobase_service_role policy, so your secret key reads and writes it as Supabase's service role did; app users keep what their policies give them.

New projects start with a sample todos table. If your Supabase project has its own todos, drop the sample table before migrations up.

3. Users and data

eurobase import supabase data --migrations-dir ./migrations
eurobase migrations up

Copies the users (ids, emails, password hashes, OAuth links), then every table's rows, parents before children. The files hold real users' data — apply them only into a project you mean to keep it in. Sessions are not copied: each user signs in once on Eurobase. The list under "Read before applying" says what was changed or left out. For a first test, leave large tables out with --exclude-table logs,events.

Check: compare select count(*) per table on both sides. Apply into a project that has no data yet; running it twice writes the rows twice.

4. Files

eurobase import supabase storage # report: buckets, files, sizes
export SUPABASE_URL=https://<ref>.supabase.co
export SUPABASE_SERVICE_ROLE_KEY=…
eurobase import supabase storage --apply # copy

Each file is streamed from Supabase straight to your project, a few at a time, so gigabytes are fine. A bucket becomes a folder, a file keeps its owner, and a public bucket becomes a folder shared with everyone. Stop it whenever you like; running it again copies only what is missing and never replaces a file your project already has.

Check: a second --apply reports every file as already there.

5. Edge functions

eurobase import supabase functions --input ../supabase/functions
eurobase vault set STRIPE_SECRET_KEY '…' # each secret the report lists; or console → Vault
eurobase import supabase functions --input ../supabase/functions --deploy

Your functions run as written: Deno.serve, Deno.env.get (function settings, then the Vault), the Authorization header and createClient() queries are supplied by a compatibility layer, and imports are bundled in. The first command builds every function and changes nothing; it lists, by file and line, the few calls that need a change. --deploy deploys the ready ones, with the service-role setting where the code uses the service role key.

“Ready” means it builds. Check that the tables each function uses exist and that something still calls it — deploy only what your app uses. Free projects allow 50 functions, Pro 500.

Check: call a function signed in and once without; eurobase edge-functions logs <name> shows its log, including console.log lines.

6. Scheduled jobs

eurobase import supabase cron # plan
eurobase import supabase cron --apply # create, switched off

Your pg_cron jobs become cron jobs at the same times: a SQL command stays a SQL job, a call to one of your functions becomes a job that runs it. They are created switched off, because the same jobs still run on Supabase.

7. Your app's code

Replace @supabase/supabase-js with @eurobase/sdk. The calls are close; the ones that differ most are below, and the full list is in the SDK reference.

  • createClient({ url, apiKey: publicKey, projectId }) instead of createClient(url, anonKey).
  • eb.auth.signIn({ email, password }) instead of signInWithPassword; OAuth is eb.auth.signInWithOAuth('google', { redirectTo }) with eb.auth.handleOAuthCallback() on the callback page.
  • eb.db.from('t').update(id, values) and .delete(id) take the row's id; insert takes one row.
  • select('id', 'name') takes the columns as separate arguments; a row this row points to can be embedded one level deep, named by its table (no aliases): select('*', 'profiles(*)').
  • No upsert, or(), not(), is() or maybeSingle(): put such queries into a database function and call it with eb.db.rpc(fn, args); return a list as one jsonb value (rpc gives only the first row of a set).
  • eb.auth.getSession() is synchronous, getUser() returns the user as data, and onAuthStateChange returns the function that unsubscribes.
  • Storage has no buckets: eb.storage.upload('avatars/' + path, file) — the old bucket is the first folder.
  • Errors are strings: show error, not error.message (except functions.invoke).
  • Realtime doesn't apply custom RLS policies: signed-in users get only their own rows on tables with an owner column (user_id, owner_id, created_by, uploaded_by). Check what the app subscribes to.

The Claude skill (section above) carries the full table of supabase-js calls and their Eurobase equivalents.

A backend that uses supabase-js on the server (service role client, a client with a user's token, auth.getUser(jwt), auth.admin) has its own counterparts: see Using the SDK on a server and User admin API (server-side). A direct database connection (pg-boss, Prisma, pg) needs a Team project, whose dedicated database comes with an owner URL; on Free and Pro, data goes through the SDK and REST.

Set each OAuth provider up in Auth with the same OAuth app (client ID) as on Supabase, so imported users are recognised, and add your app's domains to the allowed CORS origins and redirect URLs. Only the public key goes into the app.

8. Switch over

The production project is a new, empty project; keep the test project for tests. Prepare it while Supabase keeps running:

  • Create the production project and switch to it. In a new folder, put the schema migration you tested into migrations/ (not the test's data files) and run eurobase migrations up. The data import writes new files next to old ones, and applying old and new data together writes the rows twice.
  • Copy the files, set the secrets, deploy the functions, import the cron jobs, and set up auth providers, CORS origins and redirect URLs — steps 4 to 7 against the production project.

Then switch:

  • Stop writes on Supabase (a maintenance window).
  • In the new folder, run data and migrations up, and compare row counts with Supabase.
  • Run storage --apply once more; it copies only new files.
  • Switch the cron jobs on (console → Cron) and off on Supabase.
  • Deploy the app with the Eurobase keys. Keep the Supabase project as it is for a while, as the way back.

When you're done with a test project that holds real users, delete it: eurobase projects delete <id> --confirm.