Skip to main content

Guide

Auth.js v5 vs Lucia v3 vs Better Auth 2026

Auth.js v5, Lucia v3, and Better Auth compared for SaaS starters in 2026, with Drizzle/PostgreSQL adapter notes and a clear pick.

StarterPick Team
Hero image for Auth.js v5 vs Lucia v3 vs Better Auth 2026

Verdict: Better Auth is the default new-SaaS pick; Lucia is now a pattern, not a package

If you are choosing between Lucia auth vs Better Auth for a new 2026 SaaS starter, pick Better Auth unless you specifically want to implement sessions yourself. Lucia v3 is still useful as a learning resource and session architecture reference, but the lucia npm package and its Drizzle adapter are deprecated. Better Auth gives a new SaaS starter a maintained package, generated schema, Drizzle/PostgreSQL support, organizations, 2FA, passkeys, rate limits, and email/password or social login without rebuilding the auth layer from scratch.

Choose Auth.js v5 when you want the most familiar Next.js/NextAuth-style OAuth flow and your starter kit already uses it. The caveat is that the v5 package is still distributed as next-auth@beta as of this May 15, 2026 source check, while next-auth latest remains v4. That is workable for experienced teams, but it is not the quietest choice for a template you want buyers to clone and ship.

Key Takeaways

  • New B2B SaaS starter: Better Auth.
  • Existing NextAuth/Auth.js boilerplate: stay on Auth.js unless organizations, 2FA, or passkeys are forcing a rebuild.
  • Learning or highly custom auth: use the Lucia documentation patterns, not the deprecated Lucia package.
  • Drizzle/PostgreSQL query: Auth.js and Better Auth both have active adapter paths; Lucia's Drizzle adapter is deprecated, so a Lucia-style build means owning the schema and session code yourself.

At a glance

Decision factorAuth.js v5Lucia v3 / Lucia patternBetter Auth
Best 2026 SaaS-starter roleFamiliar OAuth/session layer for existing NextAuth teamsEducational/manual-session referenceDefault self-hosted auth foundation for new B2B SaaS
Package status checked May 15, 2026next-auth@beta exposes v5; next-auth latest is still v4lucia and @lucia-auth/adapter-drizzle are deprecated on npmbetter-auth latest is active and non-deprecated
Next.js fitStrong, especially when a starter already has the v5 auth.ts patternManual integration; you choose route handlers, cookies, and schemaStrong with better-auth/next-js handler helper
Drizzle/PostgreSQL fitUse the official Auth.js Drizzle adapter and database sessions when you need revocationBuild session/user tables directly from the Lucia docs; deprecated adapter should not be the starting pointUse the Better Auth Drizzle adapter and generated schema/migrations
B2B organizationsApp code you build around Auth.jsManualBuilt-in plugin
2FA / passkeysApp code or additional packagesManualBuilt-in plugins/features
Operational riskv5 beta distribution and edge/database split config need careYou own every security decisionNewer ecosystem, but deeper built-in feature set
StarterPick recommendationUse if the boilerplate already chose it and the team knows itUse as a reference, not as a production dependencyPick first for a new self-hosted SaaS starter

Why this route is the canonical auth-library comparison

StarterPick has broader guides for authentication setup in Next.js boilerplates, best SaaS boilerplates, and Better Auth boilerplates. This guide is narrower: it answers the Auth.js v5 vs Lucia v3 vs Better Auth decision for SaaS starter authors and buyers.

Use the broader setup guide when you need route protection, signup UX, and billing handoff checklists. Stay here when the question is whether your starter kit should ship Auth.js, Better Auth, or Lucia-style manual sessions.

Choose Better Auth for a new SaaS starter in 2026

Better Auth has become the cleanest default for a new self-hosted SaaS starter because it starts where most B2B products end up: database-backed sessions, email/password, social providers, organization membership, invitations, roles, 2FA, passkeys, and a plugin model.

The practical advantage is not just feature count. A starter-kit buyer expects auth to already include the SaaS pieces that are expensive to retrofit:

  • an organization model for teams and workspaces;
  • member roles and invitations;
  • session and account tables that are generated instead of hand-written in every template;
  • server and client helpers that work with Next.js route handlers and React components;
  • a Drizzle or Prisma path that matches common starter-kit stacks;
  • a security story that does not require the buyer to design token hashing and session renewal rules on day one.

That is why Better Auth wins the greenfield decision. It is newer than Auth.js and has less decade-long community history, so treat the docs and migration generator as part of your evaluation. But for a starter sold as "production-ready SaaS," the organization and 2FA plugins remove more template work than they add.

Choose Auth.js v5 when OAuth familiarity matters more than B2B depth

Auth.js remains the safest recognizable choice for many Next.js teams. The project has official documentation for the v5 migration, server-side auth() usage, session strategies, edge-compatibility trade-offs, and maintained adapters including Drizzle and Prisma packages.

A typical v5 setup still feels familiar to NextAuth users:

// auth.ts
import NextAuth from "next-auth";
import GitHub from "next-auth/providers/github";
import { DrizzleAdapter } from "@auth/drizzle-adapter";
import { db } from "@/db";

export const { handlers, auth, signIn, signOut } = NextAuth({
  adapter: DrizzleAdapter(db),
  providers: [GitHub],
  session: { strategy: "database" },
});

// app/api/auth/[...nextauth]/route.ts
export const { GET, POST } = handlers;

The catch for a StarterPick-style template is scope. Auth.js handles authentication, providers, callbacks, cookies, and sessions. It does not give you a full B2B SaaS layer. If your boilerplate promises teams, invitations, tenant roles, admin screens, and 2FA, you either build those modules around Auth.js or combine it with another identity/organization product.

The second catch is version posture. The v5 docs are real and the package exists, but npm still exposes v5 through the beta dist-tag while the latest next-auth tag remains v4. For a team already committed to Auth.js, that is manageable. For a commercial starter kit whose buyers expect boring dependencies, it is a reason to document your version choice clearly.

Treat Lucia v3 as a session blueprint, not a dependency choice

Lucia is the most misunderstood option in this comparison. The current Lucia site positions itself as an open-source resource on implementing authentication with JavaScript, and the lucia package is marked deprecated on npm. The same is true for the Lucia Drizzle adapter.

That does not make Lucia irrelevant. It means the right lesson changed. Lucia's session pattern is still excellent if you want to understand or implement auth yourself:

import { sha256 } from "@oslojs/crypto/sha2";
import { encodeBase32LowerCaseNoPadding, encodeHexLowerCase } from "@oslojs/encoding";

export function generateSessionToken() {
  const bytes = new Uint8Array(20);
  crypto.getRandomValues(bytes);
  return encodeBase32LowerCaseNoPadding(bytes);
}

export async function hashSessionToken(token: string) {
  return encodeHexLowerCase(sha256(new TextEncoder().encode(token)));
}

For a small internal tool or a team with deep security experience, Lucia-style manual sessions can be the most transparent approach. For a SaaS starter that other founders will clone, it is usually a poor default because every important behavior becomes product code: token entropy, cookie flags, session renewal, account linking, password reset, OAuth state checks, CSRF protection, and user/session cleanup.

The clearest recommendation: do not start a new 2026 boilerplate by adding lucia or @lucia-auth/adapter-drizzle. Use Lucia's docs to understand sessions, then choose Better Auth or Auth.js unless you intentionally want to own the whole auth implementation.

Framework and runtime matrix: Drizzle and PostgreSQL implications

The GSC query cluster for this guide includes Lucia, Better Auth, and a Lucia Drizzle/PostgreSQL adapter example query. The adapter decision is where the comparison becomes concrete.

Stack needAuth.js v5Lucia patternBetter Auth
Drizzle adapterOfficial @auth/drizzle-adapter packageDeprecated Lucia adapter; build tables manuallyOfficial Better Auth Drizzle adapter docs
PostgreSQL sessionsSupported through database sessions and adapter tablesYou design the tables, indexes, expiry cleanup, and token hashingGenerated schema/migration path with core user, session, account, and verification tables
Edge middlewareEdge reads often push you toward JWT/split-config patterns because database adapters may not be edge-compatibleYou decide whether edge reads use signed state, database calls, or route-level checksUsually keep auth checks in route/server contexts unless your adapter/runtime choice is edge-safe
Migration burdenModerate if already on NextAuth/Auth.jsHigh because your app owns every auth table and behaviorLowest for greenfield; moderate if migrating from Auth.js

For StarterPick readers building on Neon/Postgres and Drizzle, Better Auth is the smoother default in 2026 because it treats database schema as part of the auth product. Auth.js is also viable if OAuth and familiarity matter more than built-in organizations. Lucia-style Drizzle/PostgreSQL is now a custom-auth project, not an adapter shortcut.

Session security: where teams underestimate the work

Session security is the hidden cost of the Lucia path and the main reason Better Auth or Auth.js is safer for most starter kits.

Auth.js gives you a documented session-strategy choice: JWT sessions or database sessions. JWT sessions can be fast and edge-friendly but are harder to revoke instantly. Database sessions give you server-side revocation and better auditability at the cost of database round trips and adapter/runtime constraints. The Auth.js edge-compatibility guide is worth reading before promising middleware-level database-session checks in a template.

Better Auth centers the schema and session model in the framework. Its database docs cover core schema, adapters, migrations, hooks, and plugin schemas. Its plugin system can extend auth behavior without forcing every starter author to invent an internal auth framework.

Lucia-style sessions are safe only if your implementation is safe. You must hash tokens before storing them, set secure cookies, enforce expiry, rotate or renew sessions intentionally, validate request origins where appropriate, and build cleanup jobs. That is a reasonable engineering decision for a team that wants full control. It is a risky default for a starter kit whose buyers may never audit the auth code.

Migration cost by starting point

Auth.js to Better Auth

Plan for a real migration, not a package swap. You will add Better Auth's route handler and client, create its core tables, migrate accounts/sessions/users where practical, update middleware and server components, and retest every protected route. If your product has teams, you will also map existing organization tables into Better Auth's organization plugin or keep your current organization model.

Lucia package to Better Auth

Do not migrate by preserving the deprecated Lucia package. Extract the durable concepts: user IDs, account records, session expiry policy, and cookie names. Then move to Better Auth's generated schema or to your own audited manual-session module. Expect session invalidation unless you deliberately preserve token hashing and table semantics.

Better Auth to managed auth

Better Auth keeps user/session data in your database, which is good for ownership. A move to Clerk, WorkOS AuthKit, or another managed service still means user-ID mapping, webhook replacement, session-check rewrites, and account-import testing. Choose managed auth up front if you know you want to offload maintenance rather than self-host.

Starter typeRecommended auth defaultWhy
Solo founder SaaS with teams laterBetter AuthStarts with the organization/2FA/session pieces you will need before selling to teams.
OAuth-first consumer appAuth.js v5 or Better AuthAuth.js is familiar; Better Auth is deeper if you also want email/password and passkeys.
Enterprise B2B starterBetter Auth plus a later WorkOS/SSO layer if neededBetter Auth covers app auth; enterprise SSO/provisioning can be added when deals require it.
Educational/auth-from-scratch templateLucia patternUseful if the value proposition is learning auth internals, not shipping quickest.
Existing mature NextAuth appStay on Auth.js until a specific missing feature justifies migrationMigration risk usually beats theoretical library preference.

Source-backed caveats

  • Version and download signals were checked on May 15, 2026. They are useful maintenance signals, not quality rankings. next-auth had a much larger total weekly download footprint, but its v5 line is still on the beta tag. better-auth had an active latest release and a large weekly download footprint. lucia still had downloads, but the package is deprecated.
  • Documentation can move faster than starter kits. Before buying a boilerplate, inspect the actual repository for its auth package version, migration files, route protection, session strategy, and invite/organization implementation.
  • Auth libraries do not automatically solve authorization. You still need product-level checks for tenant membership, billing state, admin roles, and API access.
  • Prices and plan names change. This guide focuses on self-hosted library fit rather than managed-auth pricing, so verify any Clerk, WorkOS, or hosted-provider pricing on the vendor site before committing.

Source notes

Sources checked May 15, 2026: Auth.js v5 migration, session strategy, and edge compatibility docs; npm registry pages for next-auth, @auth/drizzle-adapter, and @auth/prisma-adapter; Lucia docs and npm deprecation notices for lucia and @lucia-auth/adapter-drizzle; Better Auth installation, database, organization, and 2FA docs; npm registry page for better-auth.

Methodology

This refresh prioritizes the query cluster around lucia auth vs better auth, lucia vs better auth, better auth vs lucia 2026, and Drizzle/PostgreSQL adapter searches. The scoring lens is practical SaaS starter fit: maintenance status, Next.js integration, database adapter path, B2B feature depth, session-security defaults, migration cost, and whether the choice helps or hurts a boilerplate buyer trying to ship a production app.

The SaaS Boilerplate Matrix (Free PDF)

20+ SaaS starters compared: pricing, tech stack, auth, payments, and what you actually ship with. Updated monthly. Used by 150+ founders.

Join 150+ SaaS founders. Unsubscribe in one click.