better-auth-organization-best-practices

Configure multi-tenant organizations, roles, teams, and invitations with the Better Auth organization plugin.

601|87|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/pedronauck/skills --skill better-auth-organization-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth-organization-best-practices
Source: https://github.com/pedronauck/skills/tree/main/skills/community/better-auth-organization-best-practices
Command: npx skills add https://github.com/pedronauck/skills --skill better-auth-organization-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires better-auth, @better-auth/cli.

What problem does it solve?

Building multi-tenant features like organizations, member management, invitations, and role-based access control from scratch is error-prone and time-consuming. This Skill provides ready-to-apply patterns for implementing all of these with Better Auth's organization plugin.

Core Features & Use Cases

  • Organization & Member Management: Create organizations, set active organizations, add or remove members, and assign single or multiple roles with enforced limits.
  • Invitations & Teams: Send invitation emails, generate shareable invitation URLs, and organize members into teams with configurable limits.
  • RBAC & Dynamic Access Control: Check permissions, create custom roles, and enforce access control using the dynamic access control addon.
  • Use Case: You are building a B2B SaaS app where each customer company needs its own workspace with admins, members, and invite links. Use this Skill to wire up the organization plugin, invitation emails, and custom roles in minutes.

Quick Start

Set up the Better Auth organization plugin with teams, invitation emails, and custom roles for my TypeScript app.

Frequently Asked Questions about better-auth-organization-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up organizations with Better Auth?

Add the organization() plugin to your Better Auth server config and organizationClient() to your client config, then run npx @better-auth/cli migrate to create the organization, member, and invitation tables. You can then create organizations via authClient.organization.create.

How do I send organization invitation emails in Better Auth?

Pass a sendInvitationEmail callback to the organization plugin options, which receives the email, organization, inviter, and invitation data. Inside it, call your own email service with a link containing the invitation ID for the recipient to accept.

Does Better Auth support custom roles and permissions?

Yes, enable dynamicAccessControl in the organization plugin to create custom roles with granular permissions via createRole. Default roles owner, admin, and member cannot be deleted, and roles assigned to members must be reassigned before deletion.

Why can't I remove a member from a Better Auth organization?

The last owner of an organization cannot be removed, leave, or have the owner role revoked. Transfer ownership first by updating another member's role to owner, then demote or remove the previous owner.

Can I limit the number of organizations or members per user?

Yes, use organizationLimit and membershipLimit options, which accept static numbers or async functions receiving the user or organization. This lets you grant higher limits based on attributes like a premium plan.