'How to set up single instance multi tenant structure using node.js and express

I am trying to move our application to a multi-tenant structure, with a different database per customer.

We are using node.js, express and passport for authentication. I tried looking into passports.js but it seems to have been published 2 years ago and keeps having issues with node.

Is there an alternative?

Or, how do you set up multi-tenancy with passport.js?



Solution 1:[1]

passport is for authentication, so you need to make sure, email can be duplicated only with different tenant id. Here is a package to manage one database for all tenants: https://www.npmjs.com/package/node-express-multitenant

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shaul Zuarets