Add Mutli-Tenant Feature #11671
Replies: 4 comments 8 replies
-
|
you can have multiple databases in one database server by mapping site name to database name. This way no unnecessary schema level changes need to be done and data will also be protected which can otherwise be exposed by some wrong query or missed permissions |
Beta Was this translation helpful? Give feedback.
-
|
I tried to do this a short while ago. There doesn't appear to be any way with existing features to accomplish this. My workaround so far has been to implement each of my tenants as a sales channel and apply middleware to restrict / apply sales_channel_id filtering on many features. This has been pretty successful thus far. |
Beta Was this translation helpful? Give feedback.
-
You can create a a store and use module link to link it with partner or your desired namespace and keep using that everywhere the same reference! You might need to develop your API route like say partner which can handle all the required isolation. It’s doable not complex but it’s a choice of design ! Store is associated with location and currency which doesn’t need isolation as such , products are connected with channels which are connected with stores and each public key is associated to store which creates the isolation per store level. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @BjornTheProgrammer, hope this helps a bit in topic We (Rigby) have had many conversations about multi-tenancy and multi-store setups in Medusa and decided to do a deep dive as eBook: Multi-Tenant Architecture in Medusa, covering the different technical approaches and trade-offs. You can also read a summary on the official Medusa blog: Building a multi-tenant commerce platform with Medusa, written by our CTO. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you for your amazing framework, It is incredibly useful!
I would like to instantiate multiple Medusa stores for separate tenants, this way I would not need to use multiple different databases for each tenant's store alongside different instances of MedusaJS. It would be much harder to maintain such a setup without Medusa handling it natively, additionally, it would consume much more compute resources.
To do so, we would only really need a store_id or tenant_id on every table. I have a client that would be interested in maintaining this feature in the future as well, otherwise, they will likely maintain a fork of Medusa.
Please let me know if you would be interested in such a feature set, and the requirements that you might have for such a feature!
Beta Was this translation helpful? Give feedback.
All reactions