Hi,
We're in the process of building a SaaS platform over Firebase serving multiple customers.
To date, we're serving a handful of customers and are achieving isolation in the RTDB by using separate "root" keys in the database.
Example:
{customerId}/orders/{orderId}...
This allows us to easily read/write to right place + protect any actions using database rules checking if the reading/writing user belongs to that `customerId`.
Also allows us to set function triggers such as:
functions.database.ref('{customerId}/orders/{orderId}').onCreate(processOrder)
That would work for any customer.
This would provide better isolation per customer and allow different DB rules + help solve potential performance problems as we grow.
One thing we haven't figured out is what to do with the function triggers. Does this mean we'd have to duplicate all of the DB triggered functions per DB/customer?
Is there a way to define a trigger on the same path {customerId}/orders/{orderId} for multiple DBs?
Even if you disregarded the manual work required to support such a deployment, it also means we'll hit the MAX ALLOWED functions per project limit really fast.
Any input/ideas would be appreciated
Shai.