I love the ease of using firebase auth and how quickly I can get a project up and running using firestore and firebase functions. In the not so distant past I used to create a linux instance and build mysql and use php. Firebase makes everything so much easier and less stressful. With that said, I have recently run into an architecture problem that is giving me problems.
I am creating an abstract application that each company can customize to an extent and they will have their own users.
Problem 1: I want to use firebase auth, but each company will have their own users and it is possible that a user can create an account with multiple companies. I am not worried about security rules or data structure, what worries me is what happens when a user already has an account with one company, and then they go to another company and try to create an account. To the user the companies are unrelated, but unknown to them the already have a firebase user that was created from a previous company.
Potential Solution: I am still waiting to hear from firebase help, but I was planning to use the firebase project API to spin up new firebase projects when a new company is formed, so they will have their own project and users. I plan on using google app engine or perhaps firebase hosting to host my application, but I also want to user firebase functions to control logic and interact with the firestore. If I am able to programmatically spin up a new firebase project when a new company signs up, will I have to somehow upload the firebase functions to that project or can I somehow reference the same firebase functions across multiple projects?