Multi-Tenancy Overview
SaasKitFy uses organization-based multi-tenancy. Every organization has its own members, roles, billing plan, and resources — fully isolated from other tenants.
Two Tenant Modes
- Organization mode (B2B): Users create and join multiple organizations. An org switcher lets them move between workspaces.
- Personal mode (B2C): Each user gets a single auto-created workspace. The org layer is invisible to the end user.
The mode is set in config/saas.php via the tenant_mode key and can be changed at runtime through the admin panel.
Data Isolation
The SetActiveOrganization middleware resolves the current tenant from the X-Organization-Id header (or session). Once set, all org-scoped queries automatically filter by organization_id.
# Every API request includes the active org
X-Organization-Id: org_abc123
Key Models
- Organization — the tenant itself (name, slug, billing, settings)
- OrganizationUser — pivot table linking users to orgs, with a
rolecolumn - OrgRoleTemplate — customizable role definitions with JSON permissions
Organization Relationships
Each Organization model has the following relationships:
members— users belonging to the orgowner— the user who owns the orginvitations— pending invites sent to email addressesapiKeys— programmatic API keys scoped to the orgsamlConfiguration— SSO/SAML settings for enterprise customersdomains— verified domains associated with the orgsubscriptions— Stripe subscriptions via Laravel Cashier