Migrate users to Clerk with the CLI
- Category
- Product
- Published
Move users from Auth0, Auth.js, Better Auth, Firebase, Supabase, WorkOS, or any other platform into Clerk with clerk migrate and the new clerk-migrate skill.
The Clerk CLI can now migrate users from other platforms into Clerk. clerk migrate export pulls users out of your current platform, and clerk migrate import checks each one against your instance before it creates anything. The new clerk-migrate skill gives your agent the same commands, so it can run the migration for you or write a source for a platform the CLI doesn't support yet.
Get the latest CLI and skills
clerk migrate ships in Clerk CLI 4.2.0 and later. Update the CLI, or install it if you haven't yet:
# Update an existing install
clerk update
# Or install it globally
npm install -g clerkInstall Clerk's skills to get clerk-migrate:
npx skills add clerk/skillsIf you already have Clerk's skills, add the new one with npx skills add clerk/skills --skill clerk-migrate.
Migrate with your agent
Ask your agent to migrate your users to Clerk. The skill exports your users, runs a dry run against your instance, and shows you what the checks found. It imports only after you approve.
Try prompts like:
- "Migrate my users from Supabase to Clerk"
- "Write a migration source for this user export"
Migrate from a supported platform
The CLI exports from Auth0, Auth.js, Better Auth, Firebase, Supabase, WorkOS, and other Clerk instances. To run a migration yourself, sign in with clerk auth login and clerk link, or set CLERK_SECRET_KEY to the Secret Key of the instance you're importing into. Then run:
clerk migrate export supabase # prints a run ID
clerk migrate import <export_run_id> --dry-run # checks, writes nothing
clerk migrate import <export_run_id> --yes # importsA development instance holds 100 users by default, and the dry run checks the import against it. Production has no limit: add --instance prod to both import commands, or use your production instance's Secret Key.
Supabase, Firebase, and Better Auth exports carry password hashes, so those users keep their passwords. Each platform's migration guide lists the exceptions. clerk migrate sources shows what each source carries, including passwords and MFA.
The import records every user's outcome, and running the same command again continues a run that stopped partway. clerk migrate runs shows what each run did, and clerk migrate undo <import_run_id> deletes the users an import created.
Migrate from any other platform
For a platform without a built-in source, give your agent the export file and ask it to write a Clerk migration source. The skill asks how your platform records email verification and hashes passwords, writes the source, and checks it with clerk migrate sources.
To write the source yourself, create a .ts or .js file in your project that maps your export's fields onto Clerk's user schema, then pass its path:
clerk migrate sources ./my-platform.ts
clerk migrate import users.json --source ./my-platform.ts --dry-runSee Write a custom source for the source format.
Get started
See the migration guides for each platform's export steps.