The multi-tenant mode (NEXT_PUBLIC_ORGANIZATION_MODE=multi) enables users to create and join multiple organizations, similar to how Slack, Notion, or Linear work.
-
Ensure environment is set to multi mode:
NEXT_PUBLIC_ORGANIZATION_MODE=multi
✅ Already set in your
.env.local -
Database is already configured:
- The same database schema supports all modes
- No additional SQL needed!
- Start the app:
npm run dev - Navigate to
http://localhost:3010/auth/sign-up - Create a new account
- In multi mode: You'll be prompted to create your first organization
- Enter organization name
- The system will create a unique slug
- You'll be the owner of this organization
- After signing in, check the header for the Organization Switcher
- Click on it to see:
- Current organization
- List of all your organizations
- "Create New Organization" option
- Click "Create New Organization" in the switcher
- Fill in:
- Organization name
- Optional: description, website
- You can now switch between multiple organizations
- Go to
/settings/organization/members - Click "Invite Members"
- Enter email addresses and assign roles:
- Admin: Can manage organization settings and members
- Member: Regular access to organization resources
- Send invitations
To test the invitation flow:
-
Option A - Same Browser (Quick Test):
- Sign out
- Check the invitation email or use the invitation link
- Sign up/sign in with the invited email
- Accept the invitation
-
Option B - Different Browser/Incognito:
- Open invitation link in incognito/different browser
- Sign up with invited email
- You'll automatically join the organization
As a user with multiple organizations:
-
Context Switching:
- Use the Organization Switcher to change context
- All data is scoped to the selected organization
-
Different Roles:
- You might be an owner in one org, member in another
- UI adapts based on your role
-
Organization Settings:
- Each org has independent settings
- Billing is per-organization
- Custom domains (if enabled)
- Organization creation
- Multiple organizations per user
- Organization invitations
- Role-based access (Owner, Admin, Member)
- Organization-level billing
- Member management
- Organization events tracking
- Row Level Security ensures data isolation
- Users only see organizations they belong to
- Invitation tokens are secure and expire
- Organization switching updates user context
- Create first organization during signup
- Create additional organizations
- Switch between organizations
- Invite users with different roles
- Accept invitation as new user
- Accept invitation as existing user
- Remove members (as admin/owner)
- Update organization settings
- Check data isolation between orgs
// Get current organization
const { organization } = useOrganization();
// List user's organizations
const { organizations } = useOrganizations();
// Switch organization
await switchOrganization(orgId);
// Invite members
await inviteMembers({
emails: ['user@example.com'],
role: 'member',
message: 'Welcome to our team!'
});- Companies sign up and invite their team
- Each company is an organization
- Billing per organization
- Role-based permissions
- Freelancers join multiple client organizations
- Switch context based on current client
- Separate data per client
- Students join multiple course organizations
- Teachers manage their class organizations
- Content scoped per organization
- Check if user is authenticated
- Verify database permissions
- Ensure you're a member of those organizations
- Check Organization Switcher component
- Check if invitation hasn't expired (7 days)
- Verify email is correct
- Check spam folder
- Customize organization features in
/settings/organization - Add organization-specific branding
- Implement custom roles beyond admin/member
- Add organization-level feature flags