Reputation: 160
I am creating 2 projects:
1: For Managers. Where all data are manipulated by managers. These are contents, pictures etc.
2: For users. Where all information are indexed for users to search contents easily. User information are stored such as names etc.
I want to configure the first project's cloud functions to index the information managed and store it to the second project.
Is this possible? Or should I just put them all in one project. I want to scale them individually in the long run. Thanks for any help.
Upvotes: 0
Views: 1006
Reputation: 317828
You can refer to any project you want using the Firebase Admin SDK. You can add it to your functions index.js and initialize it to point to the project you want to use:
const admin = require('firebase-admin');
admin.initializeApp(...);
The object you pass to initializeApp() should describe the project you're trying to connect to. See the docs for that.
Upvotes: 1
Reputation: 2579
Firebase rules can be used to easily limit visibility and/or modifiability by user or class/group of user so that's not a good reason to use two firebases. You can create an app that hits two firebases but you will be pretty far outside the normal usage. That means you will run into issues that few people have had to solve so you will not have much experience to draw upon. Unless you have a good reason that you can validate with experts I would recommend avoiding it. Start with the assumption one firebase is the correct design and only got to two if the requirements make it essential for some quality required.
Upvotes: 1