I am looking for advice to see if my architectural decisions could be improved.
I have an application with several customers. I want to give each customer an isolated child-database, due the benefits of true data isolation, better performance and less complex queries that child-databases provides vs having all the customers in the same DB.
Here’s a simplified version of my planned architecture:
In the users_collection under the MainDatabase I am planning to store each customer login credentials, current tier details and a reference to a child database (referenced via an admin key). So each child-database is tied to a user document in the users_collection. I need the users_collection in the MainDatabase in order to share the same UI layer to all the customers.
When an user gets logged in I would return the associated admin key instead of the authentication token retrieved by the Login function.
What’s the recommended way to handle the authentication in this scenario? Storing the child-databases admin keys along the users_collection data is the only way? is there a better way or a better strategy?
I would appreciate any feedback or suggestions.