Multi tenant implementation

How do we implement multi tenancy. I’m sure someone’s implemented this before, is it possible ?
I want to set it up so that any new user has their own api and own dasboard.

Ok - So I wanted to reask this.
Is it possible to add a must have tenantID propoerty to teh base / root parse objects ( classes ) ?
Now when we store it, it’s all stored with a tenant id and search etc must add that as well. Is that possible? Can we create an adaptor that does that ?

I’d create separate Parse Server instances and database instances for each of the tenants.

Isn’t there a way to add tenantId to each record / class ?

There is no such feature built-in.

Is it possible to add an extension / decorator at a global level ?

Parse Server is essentially an Express.js middleware. You can build another Express.js middleware that run before Parse.

so I’d have to have a gateway that managed the tenency and each tenant is passed on from there ? what about security / authorisation - where will that be handled ?

This conversation is too abstract to give an opinion on that. Maybe you should give it a try and check the specific problems that you will have to fix.

Is this what you’re suggesting ? put an express engine before and connect to the tenancy db??

What you seem to be trying to do has a multitude of approaches, each with different pros and cons. Which approach is right for you depends on the characteristics of the service you intend to build, for example considering:

  • scale
  • security context
  • efficiency
  • robustness / reliability

These are business decisions, so from a technical point of view there won’t be a right/wrong answer.

understood -
All I’m trying to do is have an install that has mutitenancy - but the information out there is very varied.
What mutiple approaches are you refering to ?

There are multiple architectural and technological approaches to achieve a similar outcome. Specifically, you would be looking for a solutions architect to design an infrastructure and technology solution that aligns with your product requirements - which you would have to formulate of course.

The simplest solution / proof concept for multi-tenancy would be 2 separate databases, 2 separate parse server instances and bind them to 2 different endpoints, for example:

  • External routes to internal http://server1/parse
  • External routes to internal http://server2/parse

Yes that’s what I’ve got in my diagram above. The binding is done dynamically via an xpress server . My concern with this (and your) suggestion is resources.

1- I’d need mutiple machines (or a really big one) that can run mongo efficiently for complex tasks.
2- How would I create new instances when a new tenant sights up?


This depends on how you want to set this up. If you use a cloud provider, they have their own APIs to manage the infrastructure. The example above that I gave is also not an efficient solution, but merely a proof of concept. There is a lot of know-how from different disciplines that goes into creating - and maintaining - a commercially viable solution.

That is not to discourage you. You could start with a simple proof of concept and go from there as you identify bottlenecks along the way. Keep in mind that the know-how required goes beyond this forum and is in many aspects not related to Parse Server specifically.