BoilerplateHub

Better Auth vs Lucia for Next.js

Better Auth and Lucia both answer the same question in a Next.js project: how do users sign in? Open source TypeScript auth library that keeps sessions and users in your own database, extended through plugins. No longer a library but a reference that teaches you to implement sessions yourself, with code you copy and own. The real split is ownership: Better Auth runs inside your project and leaves the operational work with you, while Lucia runs the hard parts as a service and takes a dependency in exchange.

Verdict

The real split is ownership: Better Auth runs inside your project and leaves the operational work with you, while Lucia runs the hard parts as a service and takes a dependency in exchange. For Next.js specifically, both are supported, so let the tradeoff above decide rather than the framework.

Pick Better Auth if

  • User and session tables sit in your database, so joins are ordinary SQL.
  • Plugin system covers passkeys, two factor and organizations without vendor lock-in.
  • Fully typed API surface, so misuse usually shows up at compile time.

Pick Lucia if

  • You end up understanding exactly how your session cookies and tokens work.
  • Zero dependency to break, deprecate or change licence underneath you.
  • Session schema is yours, so it fits whatever data model you already have.
Comparison Better Auth Lucia
Pricing shape Free and open source. You pay only for the database and server it runs on. Free. It is documentation, so there is nothing to buy or subscribe to.
Frameworks Next.js, SvelteKit, Nuxt, Expo Next.js, SvelteKit
In one line Open source TypeScript auth library that keeps sessions and users in your own database, extended through plugins. No longer a library but a reference that teaches you to implement sessions yourself, with code you copy and own.

Pricing described qualitatively because published plans change often. Checked 2026-08-23. Confirm current terms on Better Auth and Lucia.

Better Auth

Strengths

  • User and session tables sit in your database, so joins are ordinary SQL.
  • Plugin system covers passkeys, two factor and organizations without vendor lock-in.
  • Fully typed API surface, so misuse usually shows up at compile time.
  • No per-user cost, which makes free tiers and large user bases cheap.

Tradeoffs

  • You run and patch the auth code yourself, including security updates.
  • Login screens are your responsibility, since the library ships logic not UI.
  • Younger project, so APIs still move and older guides go stale quickly.
  • Compliance evidence like SOC 2 covers your infrastructure, not a vendor's.

Lucia

Strengths

  • You end up understanding exactly how your session cookies and tokens work.
  • Zero dependency to break, deprecate or change licence underneath you.
  • Session schema is yours, so it fits whatever data model you already have.
  • Excellent teaching material even if you eventually pick a different tool.

Tradeoffs

  • Copied code means you carry the maintenance and security review forever.
  • No package upgrades, so fixes only land if you go looking for them.
  • Every provider, reset flow and rate limit is hand-rolled work.
  • Hard to justify on a team where nobody wants to own auth internals.

Same pair, different context

Frequently asked questions

Is Better Auth or Lucia better in a Next.js project?

Neither is better in the abstract. The real split is ownership: Better Auth runs inside your project and leaves the operational work with you, while Lucia runs the hard parts as a service and takes a dependency in exchange. Pick the one whose downside you can absorb, because both upsides are real.

What is the main drawback of Better Auth?

You run and patch the auth code yourself, including security updates. Login screens are your responsibility, since the library ships logic not UI.

What is the main drawback of Lucia?

Copied code means you carry the maintenance and security review forever. No package upgrades, so fixes only land if you go looking for them.

Do Better Auth and Lucia both support Next.js?

Yes, both list support for Next.js, which is why this comparison exists as a Next.js page. Next.js has two routing systems that look similar in code but behave completely differently, and most model training data blends them.

Related comparisons