0

We are designing a multi-tenant architecture. In our multi-tenant architecture, there are different email templates that are shared across all the tenants.

Email template looks like

subject: {tenantName} welcomes you. body: Hi {userName} welcome to the new platform.(Generic template).

But a tenant can have their own specific email templates as well.

subject: {tenantName} welcomes you. body: Hello {userName}/{userEmailId} welcome to the new journey and thank you for joining us.(tenant specific template).

For multi-tenancy, we are using a different database for each new tenant. Now the question arises of how to store the email template keeping in mind that the template for welcoming (in this case) may be tenant-specific and if the tenant has not configured then the generic template will be used. In which collection should one keep these templates?

2
  • an idea, if that does not change that often, assuming something like a default configuration and then if such property exists in the tenant collection will override this value... maybe a default collection that would generate a defaults file in the application?... that way you only have defaults setup and no need for a secondary db connection to read such
    – balexandre
    Jun 4 '21 at 6:46
  • You can make a single document in Templates collection, with all the templates + the default one. Then is matter of projections and atomic fields updates.
    – Laiv
    Jun 4 '21 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.