Skip to main content

Multi tenancy for one type of user

Rails • Asked by John Vehr

Chris

Would you ever see a scenerio where you would use a multi tenancy approach for one type of user? For example lets say you have an etsy like example, the vendor would have their own section vendorname.app.com sign in they can have their employees log in though that etc they can upload and manage their own inventory and make just their inventory public to normal users, also allowing for transactions etc
thanks so much


Honestly, the thing that scales best and is easiest to do for just about all "multitenancy" is to just build it at an application level. Use pundit to verify that someone trying to access the vendor section has permissions.

Multitenency is really more for when you absolutely can't have two customer's data in the same database. Think situations like you are dealing HIPAA or something like that where you are collecting very private data.

In most cases, you just want to scope queries and add permissions to separate out parts of your app to specific users. For example, the vendor section you're talking about. If a user is marked as a vendor, then when they visit the vendor area, they only see their products. And if you want to scope it by domain, lookup the domain and verify if the user has permission, if not redirect them to theirs.


Thanks Chris makes sense!


There is a gem for multitenency Apartment Gem


I have just launched my multitenancy app using Milia Gem which is fantastic and uses primary keys rather than subdomains


Very Interesting.. I might look into this gem for my future SaaS Platform. Thank you very much for suggesting this gem.


No worries at all, let me know if you have any questions with it :)



Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.