Skip to content

Guide · Open source

How to use better-auth: install and set up authentication

Updated · written with AI from the project's own documentation and checked against our catalogue data

Better Auth is an open-source TypeScript framework for handling user authentication and authorization inside your own application. It is not tied to one web framework, and it covers common features out of the box with a plugin system for more advanced ones. This guide shows you how to install it, what it is built to do, and whether it fits your project.

Better Authbetter-auth/better-auth · ★ 30.6k · MIT

Quick start

  1. 1Check Node.js. Confirm Node.js is installed on your machine. The README does not state a required version.
  2. 2Open your project. Go to the root folder of the TypeScript or JavaScript app where you want authentication.
  3. 3Install the package. Run npm install better-auth to add the framework to your project.
  4. 4Read the docs for setup. The README is brief, so visit better-auth.com for configuration details.
  5. 5Add plugins as needed. If you need 2FA or multi-tenant support later, look for these in the plugin system.

What Better Auth is and who it is for

Better Auth is a framework-agnostic authentication and authorization framework for TypeScript. It provides a set of features out of the box and a plugin ecosystem for adding more advanced functions with minimal code.

It is a code library, not a ready-made login page. You write the code that runs inside your app, so it suits TypeScript developers who want auth built into their own codebase rather than handed to a third-party service.

  • Good fit: TypeScript developers who need login and access control in their own app
  • Good fit: teams that want auth in their code instead of a third-party service
  • Good fit: projects that may later need 2FA or multi-tenant support via plugins
  • Not a fit: non-developers wanting a login page with no coding
  • Not a fit: projects not using TypeScript or JavaScript
  • Not a fit: teams wanting a fully managed hosted auth service with no code to maintain

What you need before you install

Better Auth is installed as a package, and the README lists Node.js as the prerequisite. The README does not specify which Node.js version is required, so check the project's documentation before you start.

  • Node.js (version not specified in the README)
  • A TypeScript or JavaScript project
  • A package manager such as npm

Install Better Auth with npm

Install the npm package from your project folder with the command below.

npm install better-auth

Use the plugins for extra features

Better Auth ships with common features and lets you add advanced ones through plugins. The README names two-factor authentication and multi-tenant support as examples. The README is brief, so consult the project website at better-auth.com for how to configure each plugin.

  • Two-factor authentication (2FA)
  • Multi-tenant support
  • Other advanced functions added through the plugin system

Understand the license and contributing

Better Auth is free and open source under the MIT License. The project accepts contributions to its source code, and feature requests and bug reports go through the GitHub issues page.

Security vulnerabilities should be reported through GitHub Security Advisories rather than public issues, according to the README.

  • License: MIT
  • Source contributions: see CONTRIBUTING.md in the repository
  • Security reports: GitHub Security Advisories

What people use it for

  • Adding login and access control to a TypeScript web app
  • Building auth into your own codebase instead of using a hosted service
  • Adding two-factor authentication to an existing project through a plugin
  • Setting up multi-tenant support for an app serving several organisations

Frequently asked questions

Is Better Auth free?

Yes. Better Auth is free and open source under the MIT License, which the README says lets you do whatever you want with it.

How do I install Better Auth?

Run npm install better-auth in your project. You need Node.js, though the README does not specify a version.

Does Better Auth work with any web framework?

Yes. The README describes it as framework-agnostic, so it is not tied to a single web framework.

Is Better Auth a ready-made login page?

No. It is a code library for TypeScript developers. You write the code that handles login inside your app.

Can Better Auth do two-factor authentication?

The README says it supports 2FA through its plugin ecosystem. Check better-auth.com for setup details.

What are the alternatives to Better Auth?

This directory lists no comparable projects for Better Auth, and the README does not compare it with other tools. Consider your need for code control versus a managed service when choosing.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Better Auth suits TypeScript developers who want login and access control built into their own app, with plugins for extras like 2FA or multi-tenant support. If you want a no-code login page or a fully managed hosted auth service, pick a different tool.

Install options & downloads