Welcome Guest, Not a member yet? Register   Sign In
Multi tenant SaaS application - user management
#1

Hi all,
Using extra time during this difficult (COVID) times I got with WFH I created an interesting business application that I want to start commercializing, but I created it single tenant. Now, that I definitely want to make it multi tenant, I decided to start from the begging (of course, I will be reusing a lot of code). I decided generally on multi-database approach but still have some doubts which I would like to discuss here, so any comment is welcomed!
1. In order to enable metrics, reporting, etc. I will be having one central database that will consist of following data: tenant data, tenant subscription (modules that can be accessed), tenant level and duration (trial, basic, pro, etc. whatever you want to call different subscription models), but also each tenant activity per user (analytics, GDPR compliance when accessing private data, resource planing, subscription monitoring). In this database there will be also a table linking each tenant with their own database.
2. Each tenant will be accessing same URL, but with their identification number in first segment (e.g. app.somedomain.com/somerandomdata) where "some random data" will be one way hash of id number for each tenant used in the app. This is for the purpose of enabling same usernames for different tenants (in central database, both id and hash of the id will be stored). Once login process is completed (tenant identified using URI's first segment, using appropriate database for login), $_SESSION will hold data on tenant id (including tenant db id which will probably be same hash used for login), user id, user access rights. Now, URI will be same for each tenant, but the application will be using two databases, one central for storing activity data and another tenant specific identified by tenant db id hold in the session for all other db transactions.
Ok. Would not go further, because I believe that after this, everything is clear. Any thoughts?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB