better-auth-plugins

better-auth-plugins

Better Auth plugin system for TypeScript. Use when adding advanced auth features (2FA, magic link, passkey, username, JWT, organizations) via server and client plugins.

9stars
2forks
Updated 1/29/2026
SKILL.md
readonlyread-only
name
better-auth-plugins
description

Better Auth plugin system for TypeScript. Use when adding advanced auth features (2FA, magic link, passkey, username, JWT, organizations) via server and client plugins.

Better Auth Plugins

Goals

  • Add server plugins to extend auth features.
  • Add client plugins for matching client methods.
  • Apply schema changes when plugins add tables.

Quick start

  1. Import the plugin from better-auth/plugins and add it to plugins.
  2. Run migrations (generate or migrate) when required.
  3. Add the client plugin from better-auth/client/plugins.

Example: Two-factor authentication

import { betterAuth } from "better-auth";
import { twoFactor } from "better-auth/plugins";

export const auth = betterAuth({
  plugins: [twoFactor()],
});
import { createAuthClient } from "better-auth/client";
import { twoFactorClient } from "better-auth/client/plugins";

export const authClient = createAuthClient({
  plugins: [twoFactorClient({ twoFactorPage: "/two-factor" })],
});

Migration reminder

Run the CLI when a plugin adds tables:

npx @better-auth/cli generate
npx @better-auth/cli migrate

Guardrails

  • Add server and client plugins together to keep APIs aligned.
  • Keep nextCookies (if used) last in the server plugin list.
  • Review plugin docs for required schema and env variables.

References

  • toolchains/platforms/auth/better-auth/better-auth-plugins/references/plugins-index.md

You Might Also Like

Related Skills

verify

verify

243K

Use when you want to validate changes before committing, or when you need to check all React contribution requirements.

facebook avatarfacebook
Get
test

test

243K

Use when you need to run tests for React core. Supports source, www, stable, and experimental channels.

facebook avatarfacebook
Get

Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.

facebook avatarfacebook
Get

Use when adding new error messages to React, or seeing "unknown error code" warnings.

facebook avatarfacebook
Get
flow

flow

243K

Use when you need to run Flow type checking, or when seeing Flow type errors in React code.

facebook avatarfacebook
Get
flags

flags

243K

Use when you need to check feature flag states, compare channels, or debug why a feature behaves differently across release channels.

facebook avatarfacebook
Get