Security
1,217 installs
organization-best-practices
by better-auth/skills
Configure multi-tenant organizations, manage members and invitations, define custom roles and permissions, set up teams, and implement RBAC using Better Auth's…
Skill content
Multi-tenant organization setup with member management, role-based access control, and team support via Better Auth.
- Configure organizations with customizable creation rules, membership limits, and ownership constraints; creators automatically receive the owner role
- Manage members and invitations with email delivery, expiration windows, and shareable invitation URLs; support multiple roles per member
- Define custom roles and permissions with dynamic access control; check permissions server-side via hasPermission endpoint or client-side via checkRolePermission
- Create and manage teams within organizations with configurable member and team limits; set active teams to scope API calls
- Use lifecycle hooks (beforeCreate, afterCreate, beforeDelete) and schema customization to extend default behavior and integrate with external systems
Setup
- Add organization() plugin to server config
- Add organizationClient() plugin to client config
- Run npx @better-auth/cli migrate
- Verify: check that organization, member, invitation tables exist in your database
import { betterAuth } from "better-auth";
import { organization } from "better-auth/plugins";