How to deploy Angular app to Firebase

Deploying Angular applications to Firebase Hosting provides fast, secure, and globally distributed static hosting with automatic SSL certificates. As the creator of CoreUI, a widely used open-source UI library, I’ve deployed Angular applications to Firebase throughout my 11 years of framework development. The most straightforward approach is using the Firebase CLI to initialize hosting and deploy your built application. This method provides automatic CDN distribution and simple rollback capabilities.

Install Firebase CLI, initialize hosting, and deploy your Angular build.

npm install -g firebase-tools
firebase login
firebase init hosting
ng build --configuration production
firebase deploy

Here you first install the Firebase CLI globally and authenticate with your Google account. The firebase init hosting command configures Firebase Hosting in your project, prompting you to select your Firebase project and specify the public directory (use dist/your-app-name/browser). Build your Angular app for production, then firebase deploy uploads the build files to Firebase Hosting and provides a live URL.

Best Practice Note:

This is the deployment method we use for CoreUI Angular demo applications requiring global distribution and zero configuration. Configure rewrites in firebase.json to handle Angular routing with "rewrites": [{"source": "**", "destination": "/index.html"}], enable caching headers for static assets, and use deployment targets for staging environments.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.

Answers by CoreUI Core Team