Skip to main content

Powerful invitation system for Better Auth

Add a complete invitation system to your Better Auth application. Create, send, and manage invites for user sign-ups and role upgrades with built-in security and flexibility.

Quick start

Get the invite plugin up and running in your Better Auth project in minutes.

1

Install the plugin

Add the Better Auth Invite Plugin to your project:
npm install better-auth-invite-plugin
Requires Better Auth v1.4.13 or newer.
2

Configure the server plugin

Import and add the invite plugin to your Better Auth configuration:
import { betterAuth } from "better-auth";
import { invite } from "better-auth-invite-plugin";

export const auth = betterAuth({
  plugins: [
    invite({
      async sendUserInvitation({ email, role, url }) {
        // Send invitation email
        await sendInvitationEmail(email, url);
      }
    })
  ]
});
3

Add the client plugin

Configure the client-side plugin to access invite methods:
import { createClient } from "better-auth/client";
import { inviteClient } from "better-auth-invite-plugin";

const client = createClient({
  plugins: [inviteClient()]
});
4

Create your first invite

Use the client to create and send invitations:
const { data, error } = await client.invite.create({
  email: "[email protected]",
  role: "admin"
});
The invitee will receive an email with a link to activate their invitation.

Key features

Everything you need to build a complete invitation system.

Email invitations

Send invitation emails with customizable handlers and templates.

Role-based access

Automatically assign or upgrade user roles when invites are accepted.

Public & private invites

Create targeted invites for specific users or shareable codes for anyone.

Usage tracking

Track invitation usage and enforce maximum uses per invite.

Multiple token types

Support default tokens, short codes, or custom token generators.

Hooks & callbacks

Customize behavior at every step with comprehensive lifecycle hooks.

Explore the documentation

Learn how to integrate and customize the invite plugin for your use case.

Core concepts

Understand how the invitation system works under the hood.

Setup guides

Step-by-step guides for server and client configuration.

API reference

Complete API documentation for all plugin options and methods.

Examples

Real-world examples for common invitation workflows.

Ready to get started?

Follow our quickstart guide to add the invitation system to your Better Auth project in minutes.

Get Started

Build docs developers (and LLMs) love