Organizations
Last updated
Was this helpful?
Last updated
Was this helpful?
Before we go into how Novel handles multi-tenancy, We'd love for you to check out this wonderful article by Andrew Culver, creator of Bullettrain, a rails starter kit
Novel comes with multi-tenancy enabled by default. This allows your SaaS customers to scope their actions based on an organization they belong with.
What this means is that any feature related to your SaaS should be developed with multi-tenancy in mind.
There are 3 data models relevant to multi-tenancy
Novel implements a similar data model to the article written by Andrew Culver. A big difference is that subscriptions are by default, tied to an organization instead of the membership.
Novel will create an organization and an acount during sign up. This will also create a stripe customer and create a subscription for it against the organization created.
When the user logs in the next time, the organization will be attached to the session.
Sessions in Novel include both the currently logged in user and the organization it is currently using. They are accessible using the request.org
and request.account
property of the current request.
When the user is created, an organization is created and a stripe customer is created along with it.
This is important so that there is representation of the organization in stripe.
Any changes to the subscription is attached to the organization only. This can only be done by users with the correct permission.
It is important to always check the association of the current user against its membership of the target organization it is trying to perform an action on.
This is available with the Organizations Model.
An organization may have activities recorded against actions made to it.
This is stored in the organization_events
model. It is also available under the novel/activity
module.
This will get the organization ID through the request context.
Single tenancy is not fully supported as of release 2025.1.0.
It is possible to do this however by removing the organization related endpoints from the /app/api/v1
directory.
This will force the user to sign up and interact with only organization.
2024-12-20 - Initial Documentation
- This is the organization that can have multiple users.
- A user account
- The membership detail of an account to an organization.
Reference:
You are able to switch organizations in the same session by using the endpoint in the API reference below.
An example of this can be found here:
If you feel that this is a feature that you would like to see, send us an email at .