Skip to main content
The Organization plugin provides everything you need to support multi-tenant applications: organizations, team management, member invitations, role-based permissions, and fine-grained access control.

Installation

1

Add the plugin to your auth config

auth.ts
2

Migrate the database

Run the migration or generate the schema to add the necessary tables.
3

Add the client plugin

auth-client.ts

Organizations

Create an organization

By default, any authenticated user can create an organization. To restrict creation, configure allowUserToCreateOrganization:
auth.ts

List organizations

Active organization

The active organization is the workspace the user is currently working in. Set it with:
Retrieve it reactively:

Get full organization details

Update an organization

Delete an organization

To disable deletion entirely:
auth.ts

Invitations

Set up invitation emails

Provide a sendInvitationEmail callback so Better Auth can send invitation emails:
auth.ts

Invite a member

Accept an invitation

On the page that handles the invitation link:
The user must be signed in before accepting an invitation. If requireEmailVerificationOnInvitation is enabled, their email must also be verified.

Other invitation actions

Members

List members

Update a member’s role

Remove a member

Add a member directly (server-only)

Leave an organization

Roles and permissions

Default roles

The organization plugin ships with three built-in roles:
A user can have multiple roles. Multiple roles are stored as comma-separated strings in the database.

Default permissions

Custom permissions

1

Create an access controller

permissions.ts
Import from better-auth/plugins/access (not better-auth/plugins) to keep bundle sizes small.
2

Define roles

permissions.ts
3

Pass roles to the plugin

auth.ts
auth-client.ts

Check permissions

From the client (async, server-verified):
From the server:
Client-side role check (synchronous, no network call):
checkRolePermission runs synchronously on the client and does not include dynamic roles. Use hasPermission for authoritative checks.

Lifecycle hooks

You can run custom logic before and after organization operations using organizationHooks.

Organization hooks

auth.ts

Member hooks

auth.ts

Invitation hooks

auth.ts

Hook error handling

Throwing an error in a before hook aborts the operation:

Dynamic access control

Dynamic access control lets you create and manage roles at runtime, stored in the database rather than defined in code.
auth.ts
auth-client.ts

Create a dynamic role

Manage dynamic roles