0
votes

I am working on a multi-tenant app in MEAN stack, in which user will signup and using their business names I will create an account(sub-domain) for them : abc.example.com.

So what approach should I use for this multi-tenant app?

  1. A single database in which each client have their specific collection.
  2. Or, should I maintain separate db for each user signup ?

In my application, I will be having 3-4 fixed collections for each user. So out of these two which will be more beneficial and If you can also provide any example to support your answer ?

1
Hi Bhushan, I am looking for some tips on multi-tenant implementation for a MEAN stack app. Can you help me to some reading material or provide some guidelines to handle mongoose.connect part in app.js to connect to separate db for a user. - hemant

1 Answers

0
votes

There are a lot of criteria that you need to look into before switching to the separate database per tenant model

  1. Tenant volume, the number of tenants in the system
  2. Volume of data per tenant
  3. Compliance requirements like HIPAA that you have to adhere to the tenant
  4. Geographical diversity, one tenant in USA and other tenant in Asia etc...

Both the options are fine, but once you are not able to predict beforehand the values for the points 1 through 3, you can just use the same database with a tenantid column and later scale out to per tenant database with ease.

If you have some values for the above mentioned points, the community here will be able to guide you better.