How to deploy react app to firebase hosting

M. Ilham Margatama
3 min readAug 22, 2022

I decided to share my experience & best practice that I use in my day-to-day work. Usually, I use this for testing purposes because it is simple. I don’t need to configure the domain, DNS, etc.

This article will help you guys to deploy your react app in firebase hosting through your terminal. I’m using Visual Studio Code as my IDE and PowerShell as my terminal.

Photo by Lautaro Andreani on Unsplash
  • First, log in to firebase then click “Go to console” in the top right of the browser window.
  • After getting redirected here, click on “Add project”. Enter the project name then continue until the project is created.
  • Move to the terminal, here I’m using VS Code and npm.
  • Install the firebase package by typing “npm install firebase” and “npm install -g firebase-tools
  • Login to firebase through the terminal “firebase login”.
  • Build the app “npm run build”.
  • After building the app, initialize the firebase “firebase init”.
  • Configure the firebase.

1. Select hosting.

hosting — firebase config

2. Use existing projects (because we have created one before).

existing project — firebase config

3. Choose the project. For example, my project name is exchanger-1.

choose project — firebase config

4. Select the “build” directory by typing “build”.

select build directory — firebase config

5. Select y (to make a single web app).

select y — firebase config

6. Set up automatic builds and deploys with GitHub. Here I choose no.

set-up automatic build — firebase config

7. Override index.html with firebase template index.html? Of course, I choose no.

override index.html — firebase config
  • After configuring firebase, it’s time to deploy the app “firebase deploy”.
deploy app — firebase config
  • Done.
done — firebase config

That’s all. Hopefully, this article will help me and you guys in the future.

Buy me a coffee!

--

--