Clerk → Better Auth
mediumBetter Auth is free and self-hosted. No MAU limits, no vendor lock-in. Best for teams who want full control and hit Clerk's pricing ceiling.
npm install better-auth && npm uninstall @clerk/nextjs
Create auth.ts. Configure database (Drizzle/Prisma), email/password, and OAuth providers.
import { betterAuth } from 'better-auth'
export const auth = betterAuth({ database: drizzleAdapter(db, { provider: 'pg' }) })npx better-auth migrate
Remove Clerk's clerkMiddleware(). Add Better Auth session checking in your middleware.
import { auth } from '@/auth'
const session = await auth.api.getSession({ headers: request.headers })Export from Clerk using the Clerk SDK backend. Import to your database with password hashes when available.
Replace Clerk's <SignIn>, <UserButton> with your own or Better Auth's client helpers.
What this migration involves
Moving from Clerk to Better Auth is rated medium and takes about 4-8h on a typical project. The guide breaks it into 6 steps, 4 of which ship with runnable commands and 1 with a verification check. On pricing, Clerk is freemium and Better Auth is open-source with a free plan to test the move.
Related migrations
FAQ
How long does migrating from Clerk to Better Auth take?
Around 4-8h for a typical project — 6 steps, difficulty rated medium, 4 of them with copy-paste commands.
Is moving from Clerk to Better Auth reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your Clerk data before you start.
What does Better Auth cost compared to Clerk?
Clerk: freemium from $25/mo, free plan available. Better Auth: open-source from $0/mo, free plan available.