Reputation: 112
I'm at the very beginning phase building a SaaS solution. The requirements are:
So, I think that I should go with microservices and database-per-tenant. I'm now trying to find out how to design the databases.
My first thought is if I have 10 services and 15 tenants then I have 150 databases because each service should have its own DB and each tenant should have its own DB as well.
Is that a valid approach or should I go with another design? Also, what should I do to route the connection from a service to the correct tenant DB?
Upvotes: 0
Views: 141
Reputation: 324
Yes: that's exactly the right approach.
Use a subdomain in the URL to route traffic to the correct portal service like this: https://tenantN.domain.tld
You've probably thought of this too, but set up access controls such that somebody authenticated for one tenant cannot access another tenant's services by guessing an FQDN, or a malicious person using brute force generation of FQDNs.
Upvotes: 1