Orgs
Orgs are entities that have their own data and settings associated with it and allows different users to access and modify that data based on their users roles.
This is the classic Saas application setup with multi tenancy and Role Based Access Control (RBAC).
Org based subscription
To maintain multi tenancy, the subscription is attached to an organization rather than individual users.
This allows for multi tenancy where each organization can be treated as an entity and users can own or be part of multiple orgs.
Creating an Org
An org can be created by a user in the user dashboard. This will create an org and automatically set the user as the owner.
Getting the Org
Org ids
are setup as a route path, to maintain consistency and global state.
The org id
can be easily accessed as a param
in server pages
or with usePathname
hook in client components
This id can then be used to make API request to associate the org with certain data.