If your customers are companies or teams rather than individuals, use organizations. A person can belong to several, with a different role in each. Your access rules can then say “members of this organization can edit this project”.
Organizations page

Users & auth → Organizations: New organization.

In Studio

Users & auth → People → Organizations. New organization: Open an organization to manage:
  • Members: add by Email to add with a Role, change a role, remove.
  • Teams: smaller groups inside the organization.
  • Delete organization: permanent.
To bring in people who don’t have accounts yet, use Invitations.

Roles inside an organization

These are separate from global roles. Use them in rules with $auth.org_role (recipes).

In your app

People can manage their own organizations through the client.

Members

Teams

Work inside an organization

A session can be scoped to one organization. Rules can then match on it, and the token carries org and org_role.
Build an organization switcher from orgs.list() and call switchOrg when the person picks one. After switching, the session’s org and org_role update and TOKEN_REFRESHED fires.

Keep data per organization

  1. Add an org column to your tables.
  2. Set it from the active session on create: org: session.org.
  3. Write a rule that compares it: record.orgequalsrecord.org equals auth.org.
See Access rules recipes and the Database.

Events

organization.created, organization.deleted and invitation.accepted are available to webhooks.

Invitations

Bring people in.

Token profiles

Organization-aware tokens for other services.