How to Manage Multiple project using firebase hosting…
So you might use firebase hosting to host your app. And for your app you can add multiple firebase app into same project to maintain your staging and production. If you don’t know how firebase hosting works read here
So Let’s assume you have a messenger app that you hosted on firebase. Now assume it has two server 1. Production 2. Staging. For that you will need two firebase app. Assuming you have two app called messenger-prod(production) & messenger-stage(staging). So to serve same project in multiple firebase app you have to use alias. Assuming you have firebase-tools installed already.
$ firebase use --add
then app available to authenticated gmail will pop-up select the app you want to use then you will ask for alias, use staging or production
in our case will choose staging app messenger-stage then give alias staging.
find the .firebaserc in your root it will look like this
{
"projects": {
"default": "messenger-prod",
"staging": "messenger-stage",
}
}
now you are set.
To deploy the project,
First,
$ firebase use default # sets environment to the default alias
$ firebase use staging # sets environment to the staging alias
then
$ firebase deploy
or
$ firebase deploy -P staging # deploy to staging alias
for a single line deploy