NextAuth.js / Auth.js → Better Auth
mediumBetter Auth is framework-agnostic, plugin-based, and offers full type safety end-to-end. NextAuth's complexity around adapters and callbacks goes away.
npm uninstall next-auth @auth/* && npm install better-auth
Replace [...nextauth]/route.ts with a single auth.ts.
import { betterAuth } from 'better-auth'
import { drizzleAdapter } from 'better-auth/adapters/drizzle'
export const auth = betterAuth({ database: drizzleAdapter(db), emailAndPassword: { enabled: true } })Create app/api/auth/[...all]/route.ts with auth.handler.
import { auth } from '@/auth'
export const { GET, POST } = auth.handleruseSession() / getServerSession() → auth.api.getSession({ headers }) on server, authClient.useSession() on client.
socialProviders: { github: { clientId, clientSecret } } — config moves into the betterAuth() call.
What this migration involves
Moving from NextAuth.js / Auth.js to Better Auth is rated medium and takes about 3-6h on a typical project. The guide breaks it into 5 steps, 3 of which ship with runnable commands and 1 with a verification check.
Related migrations
FAQ
How long does migrating from NextAuth.js / Auth.js to Better Auth take?
Around 3-6h for a typical project — 5 steps, difficulty rated medium, 3 of them with copy-paste commands.
Is moving from NextAuth.js / Auth.js 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 NextAuth.js / Auth.js data before you start.
What does Better Auth cost compared to NextAuth.js / Auth.js?
Better Auth: open-source from $0/mo, free plan available.