When you research how to build a multi-tenant SaaS on Firestore, most articles stop at one idea: put a tenantId field on every document . That's true, but it's the easy half. The more tricky question is how do you arrange your collections so that reads, writes, and costs stay within budget as the business scales.
Background
I was afraid of creating a system that was more trouble and expensive than it was worth.
I built a multi-tenant SaaS Trogern for managing informal taxi businesses in Zimbabwe. I was the first tenant. The industry here is so volatile and unpredictable that instant record retrieval and logging is key for business operations. In the process I got obsessed with designing a database that wouldn't generate reads and writes which I couldn't manage.
For most people, this is not a problem you need to solve today. Firestore is dirt cheap.β¦