Migrate from Clerk
Move Clerk users, password digests, TOTP secrets, social identities and organizations with their roles into Pontive with pontive migrate, then replace Clerk's components and auth() helper with pontkit's.
The steps below use the pontive migrate CLI. Read Migrate to Pontive first
for how runs, dry runs and matching work.
1. What moves and what does not
| Moves | Does not move |
|---|---|
Users from the Backend API: primary email and whether it is verified, primary phone, username, first and last name, an uploaded image, created_at; banned users as deactivated | unsafe_metadata: users could write it, so it is not carried over |
public_metadata as metadata, private_metadata as private_metadata | Password digests and TOTP secrets without the dashboard's CSV export: the Backend API never returns them |
Password digests from the CSV export, for the hashers bcrypt, argon2i, argon2id, bcrypt_sha256_django, pbkdf2_sha256_django, scrypt_werkzeug, phpass and ldap_ssha | Digests from any other Clerk hasher: those users use Forgot password at their first sign-in |
| TOTP secrets from the CSV export | Backup codes, which the CSV does not hold; passkeys |
Google, GitHub and Apple identities, and custom OIDC providers (custom_…) as oidc | Microsoft identities and providers Pontive has no portable type for: those users link by verified email |
Organizations (name, slug, public_metadata) and memberships with their role | Organization invitations and domains; users without an email |
The Clerk user id (user_…) as legacy subject, and as external_id unless the user already has one |
The CSV export. Export your users as CSV from the Clerk Dashboard. The exporter reads its id,
password_digest, password_hasher and totp_secret columns and merges them into the Backend
API's users. Clerk does not document those column names; check that your file has them.
2. Create the migration source
export PONTIVE_SECRET_KEY=pontive_sk_test_us_... # an admin key of your development instance
export CLERK_SECRET_KEY=sk_live_... # the Clerk instance you are leaving
npx pontive@latest migrate source create --name "Clerk" --type clerk # prints msrc_...3. Export, then dry run
npx pontive@latest migrate export clerk --csv clerk-users.csv # writes pontive-users.ndjson
npx pontive@latest migrate import pontive-users.ndjson --source msrc_...--skip-organizations leaves organizations out; --external-id none leaves external_id unset
for users who have no Clerk external_id of their own. The export retries Clerk's rate limits on
its own.
4. Map roles and connections
Clerk's organization roles are org:admin, org:member and your custom org:… keys. Map each to an
org role in Pontive. Every new organization needs an owner, and Clerk has no owner role, so map
its admins to owner:
npx pontive@latest migrate import pontive-users.ndjson --source msrc_... \
--role-map org:admin=owner,org:member=member \
--identity-connection google=app_...:google \
--identity-connection github=app_...:github \
--totp-app app_...- Create
memberand any custom role on theorgtype first; see Import options. A member holding an unmapped role is left out and reported asrole_not_mapped. --totp-appnames each Pontive app whose sign-in should ask for the imported TOTP code. The app must have TOTP on. Without it, TOTP secrets are left out and those users enroll again.
5. Apply
npx pontive@latest migrate import pontive-users.ndjson --source msrc_... \
--role-map org:admin=owner,org:member=member \
--identity-connection google=app_...:google \
--identity-connection github=app_...:github \
--totp-app app_... \
--apply --delete-afterFailed rows: npx pontive@latest migrate records uimp_... --outcome failed. Delete the CSV export
too: it holds the same digests and secrets.
6. Swap the SDK
pontkit's components map almost one to one onto Clerk's. Follow the
Next.js quickstart for the provider, the auth proxy and lib/pontive.ts,
then replace Clerk's pieces:
npm uninstall @clerk/nextjs
npm install @pontive/pontkit-nextjs| Clerk | pontkit (@pontive/pontkit-nextjs) |
|---|---|
<ClerkProvider> | <Provider domain appId signinUrl signupUrl>, in a client component |
clerkMiddleware() | pontive().middleware(req) in proxy.ts |
<SignIn />, <SignUp /> | <Signin />, <Signup /> |
<UserButton /> | <AccountMenu /> |
<UserProfile /> | <AccountSettings /> |
<OrganizationSwitcher /> | <OrganizationSwitcher /> |
<OrganizationProfile /> members tab | <MemberManagement /> |
<SignedIn>, <SignedOut> | <SignedIn>, <SignedOut> |
const { userId, orgId, orgRole } = await auth() | const session = await pontive().auth(): session.user.id, session.organization?.id, session.organization?.roles |
has({ permission: "org:invoice:read" }) | session.organization?.permissions.includes("invoice:read") |
useAuth().getToken() | Auth.getCurrentSession()?.access_token, Auth from @pontive/oidc-client |
import { pontive } from "@/lib/pontive";
export default async function Dashboard() {
// Was: const { userId, orgId } = await auth();
const session = await pontive().auth();
if (!session) return <p>Not signed in.</p>;
return <p>{session.user.email} in {session.organization?.id ?? "no organization"}</p>;
}Clerk's org: prefix on permissions does not carry over: Pontive permissions are plain keys such as
invoice:read. Values your app read from publicMetadata are on the user's metadata, and the
claims template reads them as {{ user.metadata.<key> }}.
7. Cut over
Follow the cutover checklist. For Clerk in particular:
- Export again, CSV included, just before switching, and import into the same run with
--run uimp_.... - If your database keys users by
user_…, set the app's claims template to{ "legacy_user_id": "{{ user.external_id }}" }. - Turn off Clerk's emails and sign-ups once the app is on Pontive. Users sign in once more.
8. Revert
npx pontive@latest migrate revert uimp_... # dry run
npx pontive@latest migrate revert uimp_... --applyUsers who have signed in to Pontive since, and organizations with other members, are kept and listed. See Revert.
Migrate from Auth0
Move Auth0 users, bcrypt password hashes, social identities and Organizations with their members and roles into Pontive with pontive migrate, then replace the Auth0 SDK with pontkit.
Migrate from Firebase Authentication
Move Firebase Authentication users and their scrypt password hashes into Pontive with pontive migrate, check the project's hash parameters before importing, then replace firebase/auth with pontkit.