Better Auth

The most comprehensive, framework-agnostic authentication and authorization framework for TypeScript.

Framework
npm
v1.7.12
30,445 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 100
Maintenance 100
Community 68
Maturity 48
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
84 /100 Excellent
Architecture 90
Code Quality 88
Innovation 88
Learning Curve 70

Better Auth is a framework-agnostic authentication and authorization framework for TypeScript that ships a complete feature set out of the box instead of leaving you to assemble one from scratch. It handles email/password, social and OAuth2 sign-in, sessions, and account management with type-safe server and client APIs.

A first-class plugin ecosystem extends the core with advanced capabilities such as two-factor authentication, passkeys, organizations and multi-tenancy, magic links, SSO, an OIDC provider, and more, so you can add sophisticated auth flows with minimal code while keeping full control over your database and application stack.

What You Get

  • A type-safe betterAuth() server instance with email/password, session, and OAuth2 social sign-in built in
  • A matching type-safe client (createAuthClient) with framework bindings for React, Vue, Svelte, Solid, and vanilla JS
  • A rich plugin system covering 2FA, passkeys, organizations, magic links, SSO, OIDC provider, admin, and more
  • Database adapters for Drizzle, Prisma, Kysely, MongoDB, and in-memory storage, plus a schema/migration generator
  • Framework integrations for Next.js, SvelteKit, SolidStart, TanStack Start, Node, and Expo

Common Use Cases

  • Adding email/password and social login to a Next.js, SvelteKit, or Solid application
  • Standing up multi-tenant SaaS auth with organizations, roles, and invitations
  • Enforcing strong security with two-factor authentication, passkeys, and rate limiting
  • Running your own OIDC/OAuth provider or SSO for internal services

Under The Hood

Architecture - The published better-auth package is the aggregation layer of a pnpm/turbo monorepo: packages/better-auth/src/index.ts re-exports a @better-auth/core runtime and pulls in workspace adapters (Drizzle, Prisma, Kysely, Mongo, memory) and telemetry. The betterAuth() factory in src/auth/full.ts builds a context (src/context/init.ts) that wires the configured database adapter, session and cookie handling (src/cookies, src/db), the OAuth2 flow engine (src/oauth2), and an endpoint dispatcher (src/api) that converts plugin-declared routes into a single mountable request handler. Roughly thirty first-party plugins under src/plugins (2FA, passkey, organization, magic-link, OIDC provider, admin, SSO) hook into that context, and matching client plugins under src/client produce a type-inferred createAuthClient with bindings for React, Vue, Svelte, Solid, and vanilla JS.

Tech Stack - Written almost entirely in TypeScript (~99.98%) and built with tsdown/turbo. Core runtime dependencies are deliberately lean: zod v4 for schema validation, jose for JWT/JWKS, @noble/hashes and @noble/ciphers for cryptography, better-call for typed endpoints, @better-fetch/fetch for the client transport, nanostores for client session state, and kysely/defu utilities. Database drivers and host frameworks (Next.js, SvelteKit, Solid, TanStack Start, Prisma, Drizzle, pg, mysql2, mongodb, react, vue, svelte) are all peer dependencies, keeping the core framework-agnostic and unopinionated about the surrounding stack.

Code Quality - The codebase is thoroughly tested, with roughly 97 *.test.ts files colocated alongside source in the main package (plus dedicated test/ and e2e/ suites at the repo root running under Vitest). Code is organized by concern into small, single-responsibility modules, formatted and linted with Biome, spell-checked with cspell, dependency-pruned with knip, and gated by lefthook git hooks. Changesets drives versioning and the project ships an AGENTS.md contributor guide, indicating a mature, disciplined engineering process.

API Design - The developer experience is a core selling point: a single betterAuth({...}) call configures the server and the client type is inferred from it, so enabling a plugin or extra field automatically surfaces on the typed client with no manual duplication. Plugins are added declaratively to an array, framework integration is a one-line handler mount, and a schema/migration generator scaffolds the required tables. The main tradeoff is breadth over minimalism — the large surface of plugins, adapters, and configuration options means a moderate learning curve to discover the right pieces, but everyday flows require little boilerplate.

Used by 76 apps in this directory

TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

29,041

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
90
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
88%
MIT

Mistle

AI Agents · Developer Tools

95

Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.

View details
50
Repo Health
76
Technical
70
Dependency
Built with
TypeScript 88%
Rust 11%
Updated 3 weeks ago
TypeScript
84%
Apache 2.0

nao

AI Development · Analytics

1,949

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
85
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 84%
Python 15%
Updated 5 days ago
TypeScript
84%
Apache 2.0

nao

AI Development · Analytics

1,949

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
85
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 84%
Python 15%
Updated 5 days ago
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
99%
MIT

open-agents

AI Agents · Developer Tools

5,861

Open-source reference app for building and running background AI coding agents on Vercel — from chat prompt to committed code changes without keeping your laptop involved.

View details
41
Repo Health
78
Technical
73
Dependency
Built with
TypeScript 99%
Updated 2 months ago
TypeScript
94%
MIT

open-seo

Developer Tools · Marketing

24,707

Pay-as-you-go open source SEO platform with MCP integration — keyword research, rank tracking, backlinks, site audits, and AI brand visibility in one self-hosted tool.

View details
83
Repo Health
79
Technical
74
Dependency
Built with
TypeScript 94%
Updated 6 days ago
TypeScript
93%
Apache 2.0

Openship

Devops · Hosting Control Panel

14,912

Openship is an open-source, self-hostable deployment platform that points at a repo and builds, ships, routes, and TLS-terminates the app — driven from a desktop app, web dashboard, or CLI.

View details
84
Repo Health
85
Technical
65
Dependency
Built with
TypeScript 93%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers