mcpField
B
better-auth-plugins

better-auth-plugins

github.com/bobmatnycSecurity78356 installsUpdated 15w ago
Repository

About better-auth-plugins

better-auth-plugins is a skill for extending Better Auth authentication, aimed at developers configuring server and client plugins. It covers pairing plugins, required database migrations, and configuration considerations.

Key features

  1. 01Configure server plugins
  2. 02Add matching client plugins
  3. 03Generate or run migrations
  4. 04Plugin configuration guidance

Use cases

  1. 01Adding two-factor authentication
  2. 02Keeping server and client auth APIs aligned
  3. 03Migrating tables added by plugins

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill better-auth-plugins

After installing, type/better-auth-pluginsin Claude Code to confirm it loaded.

Bundled filesmetadata.jsonreferences/plugins-index.md

Details

From the project README

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

Comments

Markdown supported