mrkeyoor.comAsk

better-auth/better-authtested 25 Oct 2026commit d575966

better-auth review

Use Better Auth if your TypeScript team wants authentication in application code and can own routes, cookies and database integration.

  • Deploy 29 s
  • Recipe failed
18/18passed, run exited non-zero
  • 2521 MiB idle
  • Install 45 s
Webevaluationupdated 28 Nov 2026
+63stars / 7d

Better Auth is a TypeScript authentication and authorization framework with a plugin ecosystem. Applications configure its authentication methods, connect storage where needed and mount its server handler.

Verdict

Use Better Auth if your TypeScript team wants authentication in application code and can own routes, cookies and database integration. Choose managed authentication such as Clerk if prebuilt sign-in UI and delegated operations are the priority. Our October source build passed in 140 seconds, but tests exited 1 after 185 seconds; November's deployment completed before its authentication task stopped because the harness lacked an adapter.

better-auth infographic: authentication in your TypeScript application, plus our test result and who it suits
Tested 28 November 2026: the deployment was running after 29 s. Before that: 25 Oct: source install 45 s, build 140 s.

We ran it

Lab card: what happened when we ran better-auth
Lab card from our sandbox run
Screenshot of better-auth (better-auth.com)
better-auth.com
Install✓ · 45s2814 packages · 2721 MB
Build✓ · 140s
Tests✗ · 185s18 passed · 0 failed of 18 (vitest)
Repo2377 files~498,483 lines of source · 46.3 MB · 20 CI workflows · tests dir

Answers from our run

Does better-auth build from source?

Dependencies installed in 45 seconds (2814 packages), and the build succeeded in 140 seconds. We cloned commit d575966 into a clean Debian container with 3 CPUs and no project-specific setup.

Do better-auth's tests pass?

No. The project's own test command finished in 185 seconds and reported 18 passed, 0 failed (vitest).

Who should not use better-auth?

Teams prioritizing prebuilt sign-in UI and managed authentication operations: the ts-saas comparison presents Clerk as that alternative.

What are the alternatives to better-auth?

Clerk, Auth.js / NextAuth, Keycloak. Use Better Auth if your TypeScript team wants authentication in application code and can own routes, cookies and database integration.

Setup4/5In our 2026-11-28 run it deployed in 29 s and started healthy; the README gave no task we could run as written.Editor’s note: Source installation and build succeeded, but tests failed and the November harness stopped before completing an authentication flow.
Docs2/5The 1,261-character README has no install instructions or usage instructions or examples.Editor’s note: The guides explain migration and cookie boundaries, but the runs do not assess execution of the documented application paths.
Community5/5Last push on 2026-11-28, 30,915 stars and maintainers answered or closed 9 of the 10 most-discussed issues we sampled.Editor’s note: Named tutorials and issue discussions document integrations, without measuring support quality or adoption across applications.
Maturity3/5Latest release v1.7.29 on 2026-11-28, repository created 2024-05-19 and its test command exited with an error in our sandbox even though all 18 tests it reported passed.Editor’s note: The recorded source test command failed; release activity and historical issue reports do not measure production reliability.

How we score

Discussed on

  1. hnFrom Supabase to Clerk to Better Auth304 points
  2. hnAuth.js is now part of Better Auth179 points
  3. hnBetter Auth is joining Vercel128 points
  4. hnBetter Auth – Authentication library for TypeScript73 points
  5. hnShow HN: Comprehensive authentication library for TypeScript72 points

Who it’s for

TypeScript teams that want authentication configured in application code and user data alongside billing and organization records.
Developers prepared to maintain framework routes, browser cookies and adapter-specific migrations.
Teams adding TypeScript authentication beside an existing backend, as demonstrated in Dreams of Code's Go integration.

Who it’s NOT for

Teams prioritizing prebuilt sign-in UI and managed authentication operations: the ts-saas comparison presents Clerk as that alternative.
Developers expecting a custom NestJS auth.api controller to deliver browser cookies and inherit HTTP rate limiting automatically: issue #7034 reports those integration problems.
Teams treating database-free sessions as a complete answer to external Keycloak token storage and refresh requirements.

Setup reality

Our October 25 source run at d575966 installed successfully in 45 seconds, recorded 2,814 dependencies and 2,721 MB on disk, and built successfully in 140 seconds. Tests exited 1 after 185 seconds. The parser listed 18 passes and zero failures, while the main-package tail reported two failed tests and the OAuth-provider tail reported a failed test file.

The November 28 deployment at commit 1e479e3ef669 completed in 29 seconds. Its health step took 0.2 seconds, then the authentication task stopped with "no runnable adapter yet for recipe generic." The harness completed teardown.

Application setup includes an auth instance and mounted handler, with storage and migration work determined by the chosen adapter and plugins. Better Auth's database documentation distinguishes built-in Kysely migrations from schema generation followed by ORM migrations. The October sandbox configuration recorded 3 CPUs, 8 GB RAM and image label lab-node:22.

Short answer: use it when you want to own the sign-in flow

Use Better Auth if your TypeScript team wants authentication in application code; choose managed authentication if prebuilt sign-in UI and delegated operations matter more. The ts-saas comparison with Clerk explains the preference through its own stack: user records join billing and organization data, and the sign-in flow is owned code. Our October 25 source build passed in 140 seconds, while the test command exited 1 after 185 seconds.

Better Auth's introduction describes a TypeScript authentication and authorization framework with plugins for features including two-factor authentication, passkeys and enterprise sign-on. That makes it a candidate for teams building authentication into an application they already operate. The decision is whether those teams want to maintain the routes, storage and browser behavior that connect the library to their product.

What people use better-auth for

Written tutorials describe Better Auth in a Next.js application, a Hono SaaS backend and a TypeScript authentication service connected to Go. These examples answer different integration questions: adding basic email authentication, keeping identity tables beside business data, and retaining a backend written in another language. Their authors report particular outcomes rather than a common benchmark or an adoption survey.

Who used it What they built What they reported
Zul Ikram Musaddik Rayat Next.js ride-sharing app with Drizzle and PostgreSQL User creation succeeded, and login redirected to the homepage with HTTP 200. The tutorial covers basic authentication.
The ts-saas maintainers Hono API, Drizzle, Neon PostgreSQL and Cloudflare Workers Their user table joins billing and organization data in one query, and their sign-in flow is owned code.
Dreams of Code Next.js and Drizzle authentication beside a Go API The sample uses Better Auth's JWT plugin for Go API authentication.
rafalzawadzki, following Stadly Multiple domains on Vercel Reported that Stadly's approach worked after other dynamic-baseURL attempts failed.

Dreams of Code's example is useful for a team that already has a Go backend. The article introduces JSON Web Tokens, or JWTs, as signed tokens used to authenticate requests to the Go API. Its two-application arrangement gives readers an integration pattern without requiring a backend rewrite. The ts-saas example answers a different question: why a team already running an API and database might prefer authentication tables and routes within that stack.

What happened when we ran it

Our November 28 deployment completed in 29 seconds, and the authentication task then stopped with "no runnable adapter yet for recipe generic." The run used commit 1e479e3ef669 and the repository's Docker Compose configuration, with every port bound to 127.0.0.1. This records a deployment outcome followed by a harness recipe failure, rather than a completed authentication transaction.

November deployment observation Recorded result
Deploy 29 seconds, successful
Health step 0.2 seconds, successful
Authentication task Failed: no runnable adapter yet for recipe generic
Container memory at idle 2,521 MiB across the database and Redis containers
Later memory sample 2,367 MiB, labelled "after the questions" by the harness
Teardown Successful

The idle sample recorded postgres-prisma, postgres-kysely, postgres-kysely2 and postgres at 32 MiB each; Redis at 10 MiB; MongoDB at 225 MiB; mysql-kysely at 442 MiB; mysql at 431 MiB; mysql-prisma at 435 MiB; and MSSQL at 850 MiB. The later sample recorded those containers at 33, 33, 32, 32, 6, 72, 439, 431, 435 and 854 MiB respectively. These are measurements of the multi-database lab stack.

Two additional harness steps appear in the record. The Ollama connection succeeded, and the model-pull log showed a 4.7 GB layer at 100%, a displayed transfer rate of 119 MB/s, 0s remaining and SHA-256 digest verification. They belong to the harness sequence; the Better Auth setup described here concerns authentication routes, storage and clients.

Our October 25 source run used commit d575966 with a recorded sandbox configuration of 3 CPUs, 8 GB RAM and image label lab-node:22. We measured a 45-second installation and a 140-second successful build. The checkout contained 2,377 files, approximately 498,483 source lines and 46.3 MB. The scan recorded 20 CI workflow files, workspaces, a tests directory and a Compose file, with no Dockerfile.

October source step Result
Install Successful in 45 seconds; 2,814 dependencies recorded; 2,721 MB on disk
Build Successful in 140 seconds
Tests Failed, exit 1, after 185 seconds
Parser summary Vitest: 18 passed, zero failed, out of 18
Main-package log tail, file results Failed: 2; passed: 102; skipped: 1; total: 105
Main-package log tail, individual test results Passed: 2,923; failed: 2; skipped: 15; todo: 1; total: 2,941
OAuth-provider log tail, file results Failed: 1; passed: 44; total: 45
OAuth-provider log tail, individual test results Passed: 1,056; total: 1,056

The test command failed after 185 seconds, despite the parser's zero-failure summary. The tail names src/db/db.test.ts with one failure among six tests and a displayed duration of 189 ms. It also names src/db/get-migration-unsafe-change.test.ts with two skipped tests. Both the main package and OAuth-provider package end with lifecycle failure messages. The parser and package summaries describe different reporting scopes and stay separate in this review.

Where people get stuck: cookies, session state and browser imports

Historical session reports distinguish a successful HTTP request from a client state update or server-helper result. In issue #2055, ian described a manual /auth/get-session request working while auth.api.getSession failed. The same discussion describes a response with HTTP 200 and no body. Those distinctions give developers more useful symptoms than a single label such as "login broken."

Report What the person saw Response or outcome
#1006 Historical React and Expo session-state update problems arthureberledev showed direct session fetching with React Query; another participant reported forcing a rerender.
#2055 Null server-helper session results, including a report on 1.2.5 ian reported a working manual endpoint call; BjoernRave described a problem inside next-intl's getRequestConfig.
#5539 Browser/runtime error involving node:async_hooks, including payment-client combinations qweered said dependency updates removed the error; other participants reported it on later versions, including 1.4.0 and 1.4.1. A Polar-specific workaround was also reported to work.
#1974 Expo plugin rejected by BetterAuthPlugin type checking A maintainer suggested disabling verbatimModuleSyntax; mezotv reported that the proposed preview package still failed.
#2243 Google One Tap FedCM, CORS and token-retrieval errors locally A participant reported success after adding allowed JavaScript origins and a development-only Referrer-Policy adjustment.

The practical distinction is between the browser's request, the endpoint's response, the server helper and the displayed session state. The #2055 reports describe different behavior along those paths. For browser import errors, #5539 points to the client plugin combination and package versions. For One Tap, #2243 names provider origins and a development header adjustment. Each thread concerns a specific integration rather than one interchangeable workaround.

Better-auth NestJS integrations need response headers and route limits

Issue #7034 reports cookies arriving through the registered HTTP route but missing from a custom programmatic flow on Better Auth 1.4.9. The reporter called auth.api.signUpEmail(...) with returnHeaders: true and asResponse: true, yet described no cookies in the outgoing response. The basic-usage documentation separately says integrations must manually parse and set cookies when the server cannot return the response object.

The same NestJS discussion also reports rate limiting applying to registered HTTP routes but absent from the custom API wrapper. Dosu recommended route or controller limits. A later Google callback produced state_mismatch; the bot proposed forwarding the OAuth state cookie and using Better Auth's callback handler. Those recommendations define useful acceptance criteria for the custom route.

Custom-route acceptance check What you need to observe
Email sign-in Browser receives all session cookies, then sends them on a protected request
OAuth start and callback State cookie reaches the browser and returns on the correct callback route
Repeated sign-in attempts Your NestJS route applies its intended limit
Router coexistence Custom paths and the mounted authentication handler do not shadow each other

Historical issue #171 describes a separate NestJS module-loading problem involving ESM and CommonJS. Innei reported compiling dependencies to CommonJS in a separate subpackage. Loading a package and delivering its response headers are different integration tasks: the module workaround addresses the former, while #7034 concerns what the browser receives from a running custom controller.

Prisma and Drizzle schema generation is only part of migration

Better Auth's direct migration command supports the built-in Kysely adapter. Its database documentation directs other adapters to generate schema and apply migrations through their ORM. An ORM maps application objects to database tables; choosing Prisma or Drizzle therefore changes which tool applies schema changes. The documentation also separates the Kysely programmatic migration path from those ORM workflows.

For Prisma and Drizzle, schema validation checks definitions rather than proving that migrations reached the database. The database guide states that distinction explicitly. A release process needs an applied migration result alongside schema generation: those are separate events. Otherwise, a definition check can answer whether the code describes the expected tables while leaving the actual database deployment unanswered.

The Convex integration guide identifies @convex-dev/better-auth as maintained by Convex. It also places the auth instance's environment variables in the Convex deployment, configured through its CLI or dashboard. For that integration, the process running authentication needs the secret and provider credentials; a frontend environment file serves a different process.

Security fixes depend on the enabled storage and hooks

Better Auth v1.7.29 includes verification-flow fixes and changes to error reporting around sensitive storage arguments. The release notes say secondary-storage failures are logged and rethrown without the session tokens and cached sessions passed to them. They also describe stopping links, codes or tokens from being handed out when a verification-creation hook blocked storage.

The release calls for code using updateVerificationByIdentifier or createVerificationValue results to handle null. That is a concrete upgrade concern for plugins using those results. Password reset, email codes, passkey challenges and other flows appear individually in the notes because they exercise different paths. A useful upgrade review maps the features an application enables to their storage settings and hooks, alongside the package versions it deploys.

Better-auth vs Clerk, NextAuth and Keycloak

Auth.js is now part of Better Auth, and its README recommends Better Auth for new projects except specific feature gaps. The Auth.js README specifically names stateless session management without a database as an exception. Better Auth's database documentation separately says it works without a database. These are source-specific statements; the actual session and provider requirements determine the comparison.

Choice Reason to choose it Decision boundary
Better Auth Application-owned authentication and TypeScript plugins The ts-saas maintainers chose shared identity and business data plus an owned sign-in flow.
Clerk Prebuilt sign-in UI and a hosted dashboard The ts-saas comparison presents speed to launch and managed tooling as reasons to choose the hosted approach.
Auth.js / NextAuth An existing integration or a specific feature requirement Its README says it is part of Better Auth, recommends Better Auth for new projects and names database-free stateless sessions as a feature-gap exception.
Keycloak A shared identity provider across applications The Keycloak README documents federation and user management; #2202 describes retaining it across Node and non-Node applications.

The author of #2202 wanted a Next.js client and proxy that would retain Keycloak-issued tokens and pass them to downstream APIs. That request combines identity-provider choice, token storage and application session behavior. Replacing a client library therefore differs from replacing Keycloak itself. The current Auth.js recommendation belongs in that decision, alongside the particular workflow the existing application already needs.

What the other reviews get wrong

MakerStack's claim that Better Auth has no hosted service conflicts with the official site's description of Better Auth Infrastructure. MakerStack presents an entirely free offering, while the official homepage advertises Infrastructure with a dashboard, audit logs and security detection. The MIT library and optional commercial services belong in separate parts of an adoption budget.

Start with Identity describes Infrastructure pricing as unpublished. Seamless Auth's competitor-authored comparison instead records public Starter, Pro and Enterprise tiers in an October 2026 pricing account. Start with Identity's reference to 1.7.5 as current stable is also dated against the November 28 v1.7.29 release. Those corrections concern named review claims rather than a general ranking of the sites.

Project discussions contain claims requiring correction too. The historical database requirement in #2202 predates documentation supporting database-free operation. The basic-usage promise of immediate UI session updates needs the context of #1006's historical reports. In #4151, humans disputed the bot's dynamic-baseURL release assertion and described first-origin caching. In #7034, the bot initially recommended Next.js cookies to a NestJS user; the official manual-cookie guidance fits the reported framework boundary.

FAQ

Better Auth's database documentation says it works without a database, answering the storage question raised in issue #2202. That answer concerns database-free operation; the issue also asks about using Keycloak tokens across applications. The following questions separate installation, library choice and the session symptoms described by users, so a general feature statement does not substitute for a specific integration requirement.

Can Better Auth work with Keycloak as an external identity provider without its own database?

Better Auth documents database-free operation in its database guide. The author of #2202 wanted Keycloak to remain the identity provider while Next.js stored and passed its tokens to other APIs. Database-free sessions answer the storage-mode question; the requested Keycloak client architecture also involves provider tokens, refresh behavior and downstream requests. Those requirements should be written separately when comparing libraries.

Should I use Better Auth instead of NextAuth or Auth.js?

The Auth.js README recommends Better Auth for new projects except specific feature gaps and says Auth.js is now part of Better Auth. It names database-free stateless session management as an exception, while Better Auth's database guide also documents database-free operation. For an existing application, compare the particular session and external-provider behavior it requires, including the token-handling request described in #2202.

Should I choose Better Auth or Clerk for my SaaS?

The ts-saas maintainers chose Better Auth for an owned sign-in flow and user records that join billing and organization data. Their comparison presents a hosted dashboard and speed to launch as reasons another team might choose Clerk. That is a useful division of responsibility: decide whether identity tables and authentication integration belong within the application's existing operations or in a managed product.

How do I install Better Auth from npm and find its GitHub repository?

The v1.6 installation guide shows npm install better-auth, and the repository is better-auth/better-auth. The guide explicitly identifies itself as documentation for v1.6 and says APIs may differ from the latest stable release. Its installation command is a package-install example, separate from our October pnpm monorepo installation with 2,814 dependencies and a 2,721 MB disk footprint.

Why does useSession sometimes fail to update after signing in?

Historical issue #1006 reports successful session requests without the expected client state update. arthureberledev showed a React Query approach that calls authClient.getSession(), and another participant reported forcing a rerender. That thread concerns client state behavior. The separate server-helper reports in #2055 concern session retrieval, so the first debugging distinction is which of those paths produced the symptom.

Why does auth.api.getSession return null in a server component when the session cookie is present?

In issue #2055, ian reported that a manual /auth/get-session call worked while the helper failed. Other exchanges concern next-intl's getRequestConfig and an HTTP 200 response with an empty body. Compare the helper's headers and result with the endpoint response under the same request conditions. A status code, response body and rendered client state are separate observations.

What we have not tested yet

November's recipe stopped before a completed authentication task, and October's source test command failed. Neither run measures production authentication reliability, and the multi-database memory totals are not an application memory requirement. The October image label does not establish actual Node or operating-system versions. The log tail also lacks the assertions needed to explain the failures or reconcile the parser with every workspace result.

Password reset delivery, account recovery, concurrent sessions, revocation, organization authorization and external-Keycloak token storage and refresh rotation remain outside our completed measurements. The NestJS acceptance table is proposed coverage, including cookie forwarding, route limits and a successful OAuth callback. Sequential requests from different origins against one instance, cookie domains and first-origin caching also need a dedicated run. The historical issue reports do not establish current compatibility for payment clients, Expo packages or session hooks.

Database migration application, Convex deployment configuration and optional Infrastructure services were not exercised. The pricing correction uses a dated competitor account rather than a current vendor purchase quote. No security audit, load test or controlled cost comparison is part of our result. The video records lack readable transcripts, and a Bilibili listing alone cannot substantiate a creator's outcome. The next useful measurement is a complete browser flow on a pinned stack, including cookies, a protected request and logout.

Alternatives

ProjectWhat it isPick it when
ClerkA managed authentication alternative that the ts-saas comparison contrasts with Better Auth's application-owned schema and sign-in flow.Choose it when prebuilt sign-in components and a hosted dashboard matter more than owning the identity schema and integration.
Auth.js / NextAuthAuth.js is now part of Better Auth; its README recommends Better Auth for new projects except specific feature gaps, especially database-free stateless session management.Retain or evaluate Auth.js when an existing integration or a specific documented feature gap justifies it. Read its database-free exception alongside Better Auth's own database-free documentation, then assess the actual provider-token workflow.
Keycloak gh↗An identity and access-management project documenting user federation, authentication, user management and authorization.Choose it when identity belongs in a shared provider across applications, including backends written in different languages, as described by the author of issue #2202.

Sources

  1. Better Auth introduction
  2. Database and migration documentation
  3. Better Auth basic usage
  4. NestJS cookie and rate-limit discussion
  5. External Keycloak client requirements
  6. ts-saas integration and Clerk comparison
  7. Auth.js README and Better Auth recommendation
  8. Better Auth v1.7.29 release notes

More web reviews