Multi-tenancy
Unanswered
NicolasQuintero posted this in #help-forum
Hello!
Does anyone have any idea how to set up a multi-tenancy architecture with Supabase?
I've seen that with RLS, you can create a
I also found this: https://usebasejump.com
Does anyone have any idea how to set up a multi-tenancy architecture with Supabase?
I've seen that with RLS, you can create a
companies table, and for the tables you create, add a company column and set up policies so that each user only has access to their own information.I also found this: https://usebasejump.com
7 Replies
@NicolasQuintero Hello!
Does anyone have any idea how to set up a multi-tenancy architecture with Supabase?
I've seen that with RLS, you can create a `companies` table, and for the tables you create, add a `company` column and set up policies so that each user only has access to their own information.
I also found this: https://usebasejump.com
when using supabase, you can create RLS as you said. Like that you have one single data structure and multiple tenants can create their own data sets inside this data structure. Though RLS the policies are created so that you can always be secure to share only the details that is the company allowed to see
Pygmy Nuthatch
@NicolasQuintero You can also make a roles table and a finction that will use auth.uid() and a table join to get the users role or company, to do this make a trigger on auth.users and copy info of ur choosing and the default company (or null) to public.users (dm me if nescessary) https://supabase.com/docs/guides/auth/managing-user-data
@Pygmy Nuthatch <@1032052217659789312> You can also make a roles table and a finction that will use auth.uid() and a table join to get the users role or company, to do this make a trigger on auth.users and copy info of ur choosing and the default company (or null) to public.users (dm me if nescessary) https://supabase.com/docs/guides/auth/managing-user-data
(dm me if nescessary)keep in mind, that other people may also would like to know the solutions. So please stay in this channel
Pygmy Nuthatch
Chilax
@B33fb0n3 > (dm me if nescessary)
keep in mind, that other people may also would like to know the solutions. So please stay in this channel
Pygmy Nuthatch
I fell like the solution in code could be very lengthty
@Pygmy Nuthatch I fell like the solution in code could be very lengthty
very lengthly threads are allowed. Also for that we have a specific thread for this stopic
@NicolasQuintero solved?