explaingit

better-auth/better-auth

📈 Trending28,345TypeScriptAudience · developerComplexity · 3/5ActiveLicenseSetup · easy

TLDR

TypeScript authentication framework that handles user login, permissions, and advanced features like two-factor auth and OAuth without requiring custom code.

Mindmap

mindmap
  root((Better Auth))
    What it does
      User login
      Permission checks
      Session management
    Features
      Two-factor auth
      OAuth providers
      Single sign-on
      Multi-tenant support
    Tech stack
      TypeScript
      Framework agnostic
      Plugin system
    Use cases
      Web app auth
      Self-hosted option
      Custom integrations
    Audience
      Full-stack devs
      Startups
      Open-source teams

Things people build with this

USE CASE 1

Add user login and signup to a TypeScript web app without building auth from scratch.

USE CASE 2

Enable 'Log in with Google' or GitHub using built-in OAuth plugins.

USE CASE 3

Set up two-factor authentication to require a second confirmation step when users log in.

USE CASE 4

Support multiple organizations in one app with multi-tenant features.

Tech stack

TypeScriptNode.jsnpm

Getting it running

Difficulty · easy Time to first run · 5min
MIT license, use freely for any purpose, including commercial, as long as you keep the copyright notice.

In plain English

Better Auth is a TypeScript authentication framework, meaning it handles the "who are you, and are you allowed to do this?" parts of a web application. Authentication (verifying who a user is) and authorization (deciding what they can do) are notoriously complex to build correctly, and Better Auth aims to provide a thorough, ready-to-use solution so developers don't have to piece things together from scratch. It works with any TypeScript framework (not tied to one specific platform) and comes with a plugin system that makes it easy to add advanced features like two-factor authentication (requiring a second confirmation step to log in), multi-tenant support (separate accounts for different organizations in one app), OAuth (the "Log in with Google/GitHub" flow), and single sign-on (SSO, one login to access multiple services). The project's motivation is straightforward: existing open-source authentication libraries for TypeScript tend to only cover basic login and require a lot of extra custom code for anything more complex. Better Auth bundles more of those features out of the box. You would use Better Auth when building a TypeScript web app that needs user accounts, and you want a self-hosted, open-source option rather than paying for a third-party service. It is MIT-licensed (free to use and modify) and available as an npm package.

Copy-paste prompts

Prompt 1
Show me how to set up Better Auth in a Next.js app and add Google OAuth login.
Prompt 2
How do I enable two-factor authentication in Better Auth for my users?
Prompt 3
I need to add role-based permissions to my app, how does Better Auth handle authorization?
Prompt 4
Can I use Better Auth with my existing TypeScript framework, and how do I install it?
Prompt 5
What plugins does Better Auth offer, and how do I add multi-tenant support to my app?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.