BetterAuth
FreemiumThe most comprehensive authentication framework for TypeScript.
Published 29 May 2026 · Last updated 27 September 2026
Scores
Popularity3/5
Grew from launch to 13K+ GitHub stars within roughly a year, backed by Y Combinator (W25), and gained major momentum when the Auth.js / NextAuth team merged into the project in September 2025. Weekly npm downloads in the hundreds of thousands. Still younger and less established than Auth0 or Clerk in market share.
Learning Curve3/5
BetterAuth is deliberately designed to be simpler than NextAuth and well-documented, but setting up database adapters, configuring plugins, and understanding session management still requires meaningful onboarding. Developers comfortable with Node.js and TypeScript get productive quickly; those new to auth concepts will need more time.
Flexibility5/5
Plugin-based architecture lets you compose exactly the features you need. Database adapters support PostgreSQL, MySQL, SQLite, and MongoDB. Framework adapters cover Next.js, Nuxt, SvelteKit, Astro, Hono, Express, Fastify, and more. The plugin API allows custom extensions. Essentially unlimited customisation within the Node.js/TypeScript runtime.
Performance4/5
Runs inside your application process with no external network call for session checks — auth validation is a database query to your own instance. Performance is constrained by your database choice and query patterns rather than third-party API latency. Stateless session mode (v1.4+) eliminates even the database lookup for JWT-based flows.
Portability5/5
MIT-licensed and fully self-hosted — deploy on any VPS, PaaS, or cloud provider that runs Node.js. No vendor lock-in: your user data lives in your own database, sessions are managed by your own instance, and migrating away requires only swapping the auth library rather than migrating a third-party service's data.
About BetterAuth
Better Auth is an open-source authentication and authorisation framework for TypeScript. Instead of sending users to a third-party auth service, it runs inside your own application and database, so you own the sessions, the user data, and the logic, and session checks need no external network call.
The library covers the full authentication surface: email and password with verification and account recovery, social OAuth (Google, GitHub, Apple, Discord, and many more), passkeys, magic links, email OTP, phone numbers, two-factor authentication, and API keys. An organisation plugin adds multi-tenancy with teams, roles, invitations, and access control, and an SSO plugin adds SAML 2.0 and OpenID Connect with a separate identity provider per tenant.
Everything is built on a plugin system, so you add features as you need them without rewriting the auth layer. Database adapters cover PostgreSQL, MySQL, SQLite, and MongoDB (directly or through Prisma and Drizzle), and framework integrations include Next.js, Nuxt, SvelteKit, Astro, Hono, Express, and Fastify. The Auth.js (NextAuth) team joined the project, making it the recommended path forward for Auth.js users.
The library is free under the MIT licence. Vercel acquired the company behind it in 2026, and the project keeps its name, licence, and framework-agnostic scope. The company also sells Better Auth Infrastructure, an optional hosted layer with a user-management dashboard, audit logs, bot and abuse detection, and self-service SSO and directory sync, with a free Starter plan and paid Pro and Enterprise plans. Better Auth works only in JavaScript and TypeScript backends, and it ships no pre-built login UI.
Key Features
- Email and password auth with verification and password reset
- Social OAuth with Google, GitHub, Apple, Discord, and 20+ providers
- Passkeys, magic links, email OTP, and phone number sign-in
- Two-factor authentication (TOTP)
- Organisation plugin: teams, roles, invitations, and access control
- SSO plugin: SAML 2.0 and OIDC per tenant
- Database adapters for PostgreSQL, MySQL, SQLite, and MongoDB
- Optional Infrastructure dashboard, audit logs, and abuse detection
Pros
- No per-user pricing for the library: it runs on your own infrastructure
- TypeScript-first, with type inference across the whole auth API
- Plugin architecture: add features without rewriting
- Works across Next.js, Nuxt, SvelteKit, Express, and more
- Recommended successor to Auth.js, with very active development
Cons
- JavaScript and TypeScript only; no Python, Go, Java, or PHP backends
- You run and manage the database it stores users in
- No pre-built UI components for login and sign-up flows
- Enterprise SSO needs the separate plugin and extra configuration
- Younger than Auth0 or Clerk, with less proof at very large scale
BetterAuth Pricing
Freemium- · Full Better Auth library under the MIT licence
- · Self-hosted in your own app and database
- · All plugins, including organisations and SSO
- · Hosted dashboard with 1 seat
- · 10,000 audit log events per month (1-day retention)
- · 1,000 security detections per month
- · Community support
- · Unlimited dashboard seats
- · 20,000 audit log events (7-day retention), then usage-based
- · 10,000 security detections, then usage-based
- · Self-service SSO and directory sync (1 connection included)
- · Custom audit log, detection, and retention limits
- · Custom domain and log drain included
- · Slack support and implementation help
- · Contact sales
Tech Stacks with BetterAuth
MERN Stack
ProjectMongoDB, Express, React, Node.js: the classic JavaScript full-stack. A well-trodden path with massive community support and job-market demand.
Frontend
Programming
Databases
Hosting
Authentication
Supabase + Next.js
ProjectThe fastest way to launch a modern web app. Next.js handles the frontend and API routes; Supabase provides Postgres, auth, realtime, and storage out of the box.
Next.js + PostgreSQL
ProjectFull-stack Next.js app on PostgreSQL (self-managed or a serverless host like Neon), with Clerk, Auth0, or BetterAuth for auth, deployed to Vercel or a container host like Railway.
Programming
Databases
Hosting
Authentication
Tools Related to BetterAuth
Integrates with BetterAuth(9)
BetterAuth ships an official Next.js adapter with App Router support, server actions, middleware session handling, and typed client hooks — it is one of the two primary auth libraries recommended for Next.js projects (alongside Clerk).
BetterAuth provides an official SvelteKit adapter with server hooks integration and typed client helpers — a first-class self-hosted auth option for SvelteKit apps.
BetterAuth has an official Astro adapter with SSR session handling and API route integration — the recommended self-hosted auth solution for Astro applications.
BetterAuth has an official Nuxt adapter with server-side session handling via Nitro — the recommended self-hosted auth approach for Nuxt projects.
BetterAuth provides an Express adapter for protecting REST APIs — session middleware and JWT verification integrate cleanly with Express route handlers.
BetterAuth integrates with NestJS via a dedicated adapter — compatible with NestJS guards and module system for protecting routes and injecting the current user.
Alternatives to BetterAuth(4)
Both handle the full auth lifecycle; Auth0 is a managed enterprise SaaS while BetterAuth is a self-hosted TypeScript library — BetterAuth trades Auth0's managed reliability for full data ownership and no usage-based pricing.
Both solve authentication for web apps; Clerk is a hosted SaaS with pre-built UI components, while BetterAuth is a self-hosted open-source library — the primary trade-off is control and cost (no per-MAU pricing) vs zero-ops setup.
Both are self-hostable auth solutions; Supabase Auth is tightly coupled to the Supabase platform while BetterAuth is a standalone library that works with any database and framework.
Keycloak is an enterprise-scale alternative to BetterAuth — a full IAM server with SSO, LDAP federation, and multi-application support, versus BetterAuth's embedded per-app model.