Implement a model for multitenancy architecture using the data segregation model
As the talawa app will be used by a number of different individuals, it is worth asking: how best can we separate different user instances to best optimise resources? This is at the heart of a concept called Multitenancy. There are in general two ways to go about doing this, namely, instance replication and data segregation. We will be focused on the data segregation method.
In the data segregation model, the application is shared between tenants but the data of each tenant is stored in separate data stores. Separate data stores could be separate databases or separate schema within the same database.
This issue asks to experiment with different data stores (whether using a model where one database would be sufficient or another model where more than one would be more suited for the data stores) and determine which model would be better suited for Talawa's purposes, in terms of performance, memory management, etc.
Implementation for Single DB per user: The implementation of multi-tenant architecture with a data segregation model (single DB per tenant) is distributed into 4 main components (the four points below are linked to separate issues).
- Model Management
- JWT Verification
- Middleware & Connection Management
- Multitenant Manager
Implementation for Single DB overall:
- Create the relevant schema and see if it is possible to manage all users for a single DB.
- Take into consideration the high memory issues that may pop up and see how well they can be managed with the implementation of Redis Server or hosting in cloud infrastructure.
It is also worth reading this blog post for a possible way to go about implementing this.

Child Issues:
- https://github.com/PalisadoesFoundation/talawa-api/issues/417
- https://github.com/PalisadoesFoundation/talawa-api/issues/418
Congratulations on making your first Issue! :confetti_ball: If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues.
This issue did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.