How to Deploy and Host your React.js Projects To Google Firebase Using your Terminal

How to Deploy and Host your React.js Projects To Google Firebase Using your Terminal

First you need to use your google account to create a Firebase Console account at https://console.firebase.google.com

Then create a project, using your react project name, (example AppName), do not do anything else after it is done creating, go back to your terminal.

Then back at your VS Code you use the terminal to set up a fresh project to firebase using the following steps below…

Step 1 — npm install -g firebase-tools

Step 2 — npm install firebase

Step 3 — firebase login or npx firebase login (or firebase logout when you want to change to another email account instead, logout using that.)

Step 4— firebase init (this initalizes firebase set up.)


Sub-step 5A — Select > Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys.

  • Here you need to use your direction keys to scroll down and your space bar to select. Then you use enter key to choose.

Sub-step 5B — Select > Use an existing project,

  • Then select the firebase project name that you have created above earlier (example AppName).

Sub-step 5C — Specify the folder where Firebase will look for assets to deploy the?

Type In > build

Sub-step 5D — Configure as a single-page app?

Type In > or yes

Sub-step 5D — Setup automatic builds and deploys with GitHub?

Type In > or no

Sub-step 5E — Overwrite your existing build/index.html file?

Type In > or no

Sub-step 5F — Once the initialization part is done you can check the directory, you should see two new files .firebaserc and firebase.json

These files are automatically generated.


Step 6 — npm run build

Step 7 — firebase deploy

This will deploy your latest “built” code to firebase console server and also show you the URL at the bottom of terminal message so you can visit it.


Lastly, if you have already done the initial setup to your project and you need to make a new deployment again after an update to your code base, you follow the 2 steps below.

Step 1— npm run build

Step 2— firebase deploy

That’s all folks!… 😉

To view or add a comment, sign in

More articles by Chukwuebuka Nwoba

Explore content categories