I need some help. I plan develop an Saas project and serve it to 500-1000 customers. Each Customer would be have about 1000 members and each member can use an mobile app to track fitness information.
So my question! What is the best way to deploy and deliver or realize the project.
A) Each customer has an parse server installation and on login the user have to enter customerId, email and password. The customerId map to an subdomain and the subdomain map an parse server. Here an example customerId 100123 map to 100123.example.com
B) Work with roles and set roles on each object to customerId
What is the best way to solve the problem. In solution A) the is an overhead with administration, configuration and setup. But on other side each customer has own database. In solution B) there is it easy to scale, the parse server could be hosted on heroku and with some clicks I can scale an deliver new customers automatically.
Is there some experiences? Is it possible that 500K or 1M users can use one parse server.
We have a single Parse Server installation (option B) with over 1500 'Customers/Companies' and use multiple roles to manage the ACL of each row. This works perfectly and can scale easily (we use both Sashido and back4App with their auto-scaling).
The way we do it (using your terminology) is to have a Customer
class, which holds the master record of that customer. We then create multiple roles using the Customer.id as prefix for the role name, e.g. for Customer wDEuKFGTBo
, we create roles : wDEuKFGTBo_admin
, wDEuKFGTBo_user
, etc. Each User
gets allocated/added to their appropriate role(s).
We then make sure that every other class has a Customer
column that has a pointer to the appropriate Customer entry.
Then we add the following beforeSave
hook to each Class:
Parse.Cloud.beforeSave("CLASS", function(request,response) {
var acl = new Parse.ACL();
var comp = request.object.get('Customer').id;
acl.setRoleReadAccess(comp + '_admin', true);
acl.setRoleWriteAccess(comp + '_admin', true);
acl.setRoleReadAccess(comp + '_user', false);
acl.setRoleWriteAccess(comp + '_user', false);
request.object.setACL(acl);
response.success();
});