How to Deploy an Angular App to Firebase Hosting in 2021
Published on 13. Apr. 2021
- Firebase Hosting
- Angular Deploy
Attempting to deploy an Angular app with Firebase?
Then here's the complete guide to deploying your Angular app to Firebase Hosting (2021)
Why does it have to be SO hard to deploy your awesome Angular app to the cloud for others to admire?
If you’re like me, you’d rather focus on coding. Deploying should be something a toddler could do. But say…
…what are all these Firebase options about data storage, authentication, URL re-writes and distribution directory’s?
I thought coding was hard. Does deploying have to be harder?
Well… not any more code whiz! Let’s make you a deploying rock-star by following some simple steps to deploy a basic Hello World Angular website to Firebase Hosting.
Create Project in Firebase Console
Begin by going to the Firebase Console and click on “Add Project”.
Give it a name and click on continue.
Next choose if you want to use Google Analytics. The answer in your case is probably no.
And, last of all, wait for it to finish the setup.
Install and Configure Firebase
You can install Firebase by opening a terminal (or command prompt) and typing the following command.
npm install firebase-tools -g
Let the command line whir and twirl awhile…. and… then once it’s done, run the command below to log into your Firebase account and get it set up.
Upload Angular Application
Open a terminal (or command prompt) and cd into the directory with your Angular app. In my case...
Next, build your Angular application.
ng build --prod
Once the build has finished we’ll run
firebase init to initialize the Firebase project. This will give us the ability to upload the production files created when we built the app.
Select the “Firebase Hosting” option by using your arrow keys and then hitting Enter.
Select the Firebase project that you created in the Firebase Console.
You will be asked to select your public directory. This is the directory where your built app was saved to. In my case, it’s
It will ask if you want to redirect all request’s to index.html. Be sure to select yes.
You’ll be asked if you want to overwrite index.html. Of course the answer is no!
And you are ready to deploy! 😀
Type firebase deploy and give it some time to upload your files.
Bravo! You’re done!
Questions? Or comments? Don't hesitate to reach out.