GuidesIntegration Playbooks
B2B Org/Workspace Lifecycle
End-to-end sequence for onboarding organizations, provisioning workspaces, and enforcing scope boundaries.
Use this guide when your app needs organization and workspace scope throughout auth, API access, and admin operations.
Tenant lifecycle diagram
Authenticate user
|
v
Resolve membership set
|
+-- none ------------------> onboarding flow
|
+-- has organizations -----> choose/create org
|
v
choose/create workspace
|
v
backend scope enforcement
|
v
org/workspace-scoped operationsLifecycle sequence
- User authenticates and lands in your app.
- User selects or creates an organization.
- User selects or creates a workspace in that organization.
- Backend APIs enforce org/workspace scope for all protected operations.
Frontend implementation
Use SDK tenancy surfaces to manage active organization/workspace and account controls:
- React Router Organizations/Workspaces hooks
- TanStack Router Organizations/Workspaces hooks
- Next.js Organizations/Workspaces hooks
Backend implementation
Use backend SDK methods and scope-aware checks:
Scope enforcement rules
- Treat org/workspace IDs as authoritative backend inputs, not frontend hints.
- Validate current membership/permissions for each protected request.
- Prefer explicit workspace-scoped resources where available.
Failure modes to handle
- User has no org membership yet.
- User has org membership but no workspace membership.
- Selected workspace is no longer accessible.
- Role/permission changed after token/session issuance.