talira

Better Auth

The most comprehensive authentication framework for TypeScript

open coreMITself-hostablefree

Better Auth is an MIT-licensed, framework-agnostic authentication and authorization framework for TypeScript. You install it in your own app (Next.js, Nuxt, SvelteKit, Hono, Express, Fastify, NestJS, Expo and more), it stores users, sessions and accounts in your own database through adapters for Postgres, MySQL, SQLite, MS SQL, MongoDB, Prisma and Drizzle, and a CLI generates and migrates the schema. Email and password and dozens of social providers are built in, and plugins add 2FA, passkeys, magic links, organizations, API keys, enterprise SSO (OIDC and SAML) with SCIM, and an OAuth 2.1 and OpenID Connect provider, including one for MCP clients. Better Auth Inc. sells Better Auth Infrastructure, a paid hosted dashboard with audit logs, abuse protection and email and SMS, for self-hosted Better Auth.

Problems it solves

  • I'm tired of writing the same login, sign-up and password reset code for every new TypeScript app
  • keep our users and sessions in our own Postgres database instead of paying an auth vendor per monthly user
  • add two-factor authentication and passkeys to our Next.js app without a hosted identity service
  • let each B2B customer sign in through their own Okta or Entra ID over SAML or OIDC
  • provision users and groups from a customer's directory with SCIM
  • multi-tenant teams with organizations, members, invitations and roles in our SaaS
  • make our app an OAuth and OpenID Connect provider so other apps can sign in with it
  • protect our MCP server with OAuth so Claude and other MCP clients can connect
  • issue and verify API keys for our customers' scripts
  • migrate our users off Clerk, Auth0, Supabase Auth or WorkOS into our own database
  • sign in with Google, GitHub, Apple, Discord and other social accounts without wiring each OAuth flow by hand
  • magic link and email one-time code sign-in for a SvelteKit or Nuxt app
  • rate limit login attempts and check passwords against Have I Been Pwned
  • connect Stripe subscriptions to the signed-in user and their organization
  • an auth library that works the same in Hono, Express, Fastify and NestJS

View all 16 problems

Features

  • email and password, email verification and password reset
  • dozens of built-in social sign-in providers plus generic OAuth
  • plugins: two-factor, passkeys, magic links, email OTP, phone number, username, anonymous sign-in, Sign In With Ethereum
  • organization plugin with members, teams and invitations; admin plugin
  • API key plugin
  • enterprise SSO per organization over OIDC or SAML 2.0, with domain verification
  • SCIM provisioning of users and groups
  • OAuth 2.1 and OpenID Connect provider, device authorization grant, client ID metadata documents
  • MCP plugin: OAuth authorization server for MCP clients
  • Agent Auth plugin for agent registration and capability-based authorization (not yet stable)
View 8 more
  • database adapters for PostgreSQL, MySQL, SQLite, MS SQL, MongoDB, Prisma and Drizzle; Redis secondary storage
  • CLI that generates and migrates the schema and creates the first admin
  • integrations for Next.js, Nuxt, SvelteKit, Astro, React Router, TanStack Start, Hono, Express, Fastify, NestJS, Elysia, Convex, Expo and Electron
  • rate limiting, captcha and Have I Been Pwned checks
  • Stripe, Polar, Chargebee and other billing plugins
  • migration guides from Auth.js, Auth0, Clerk, Supabase Auth and WorkOS
  • documentation MCP server, llms.txt and agent skills
  • Better Auth Infrastructure (paid): dashboard, audit logs, security detection, transactional email and SMS

Limitations

  • Doesn't run inside Python, Go, Ruby or other non-TypeScript backends: it's a TypeScript framework, though it can also run as a standalone auth server12

Capabilities

Has a command line toolplan not known
Takes pluginsplan not known

Alternatives

The same job

These do what Better Auth does.

  1. SuperTokens Open source alternative to Auth0, Firebase Auth and AWS Cognito
  2. Auth.js Authentication for the Web, formerly NextAuth.js
  3. Clerk Drop-in authentication and user management with prebuilt UI components
  4. Supabase The Postgres development platform
  5. Logto The modern, open-source auth infrastructure for SaaS and AI apps
  6. Auth0 Hosted authentication and authorization for apps (an Okta product)

Compare Better Auth with the top 3