Deploy Angular apps to Firebase with continuous deployment
Fullstack Developer and Tech Author
Developers use JavaScript frameworks like Angular, React, and Vue.js to build every kind of single page application, from simple to complex. By separating JavaScript and CSS, frameworks let dev teams structure applications in modular chunks of code that carry out a single function.
That is great, but once your application is ready for deployment to production, you will need a command to compile and bundle the separate files into a single one. Then you will need to deploy to a platform like Firebase hosting.
Firebase is a development platform from Google that provides file storage, hosting, database, authentication, and analytics. Firebase has a no-cost Spark plan that includes Hosting, provides an SSL certificate by default, and offers impressive speed across multiple regions.
In this tutorial, I will show you how to set up continuous deployment for an Angular application to Firebase hosting.
Prerequisites
For this tutorial, you will need:
- Node.js 24 LTS installed on your system (Angular 22 also supports Node.js 22.22 or later and Node.js 26)
- Angular CLI installed globally
- A CircleCI account
- A GitHub account
- A Firebase account
- Familiarity with building web applications using Angular.
- Some knowledge of TypeScript.
Cloning the demo Angular project
To get started, run this command:
git clone https://github.com/CIRCLECI-GWP/automate-angular-firebase-app.git angular-ci-firebase
Git will clone the demo application into a new folder named angular-ci-firebase. Move into the newly cloned app and install all its dependencies:
# Change directory
cd angular-ci-firebase
# Install dependencies
npm install
# Run the application
ng serve
Open the application by going to http://localhost:4200.
This application retrieves the list of dummy users from a free REST API for testing.
Testing your Angular app locally
Run the test for the application with:
npm run test
The following output will be something like this:
> automate-angular-firebase-app@0.0.0 test
> ng test --no-watch --no-progress --browsers=ChromeHeadless
26 10 2026 23:03:33.839:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
26 10 2026 23:03:33.840:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
26 10 2026 23:03:33.843:INFO [launcher]: Starting browser ChromeHeadless
26 10 2026 23:03:34.080:INFO [Chrome Headless 156.0.0.0 (Linux x86_64)]: Connected on socket p_IGuejmz3cvTykkAAAA with id 66579844
Chrome Headless 156.0.0.0 (Linux x86_64): Executed 4 of 4 SUCCESS (0.038 secs / 0.035 secs)
TOTAL: 4 SUCCESS
The demo application is now set up locally and working perfectly.
Creating a project on Firebase
If you have not yet done so, open up a Firebase account and go to the Firebase console. Then use the following steps:
- Click Create a new Firebase project.
- Enter a name for your project. I have named mine
angular-circle-ci-project. Firebase generates a project ID from the name. Project IDs are unique across Firebase, so yours may differ, and you can’t change it after you create the project. - If prompted, accept the Firebase terms, then click Continue.
- On the AI assistance screen, turn off Enable Gemini in Firebase and click Continue.
- On the Google Analytics screen, turn off Enable Google Analytics for this project and click Create project. This project doesn’t need either one.
There you have it. You have successfully created a project on Firebase.
Setting up Firebase hosting
To successfully host your application on Firebase, you need to install its tools and initialize it within your project.
Install the Firebase CLI
Open a new terminal. To install Firebase tools globally, run this command:
npm install -g firebase-tools
You now have global access to Firebase Command Line interface tools. You can use them to deploy code and assets to your newly created Firebase project.
CircleCI needs the Firebase CLI too. From the root of the project, add it as a development dependency:
npm install --save-dev firebase-tools
This adds firebase-tools to package.json and package-lock.json. Commit both files with the rest of the project, so CircleCI installs the same version of the CLI.
Initializing a Firebase project
From the terminal, sign in to your Firebase account:
firebase login
Next, initialize the project:
firebase init
You will be prompted to respond to some questions.
- Choose hosting: Set up deployments for static web apps.
- Use an existing project: Select the Firebase project you created earlier:
angular-circle-ci-project. - Enter
dist/angular-circle-ci-project/browseras the public directory.dist/angular-circle-ci-projectis the build output path you’ll set in the next section, and the Angular CLI writes the files for the browser to abrowserfolder inside it. Changeangular-circle-ci-projectif your project name is different. - Configure as a single-page app: Yes.
- Set up automatic builds and deploys with GitHub: No. For this tutorial we are using CircleCI to run tests and handle deployment.
- Install agent skills for Firebase: No. This tutorial doesn’t need them.
Here is the output of the steps.
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
/home/node/angular-circle-ci-project
✔ Which Firebase features do you want to set up for this directory? Press Space
to select features, then Enter to confirm your choices. Hosting: Set up
deployments for static web apps
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
✔ Please select an option: Use an existing project
✔ Select a default Firebase project for this directory: roboreview-wbct30-ng
(roboreview-wbct30)
=== Hosting Setup
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
✔ What do you want to use as your public directory?
dist/angular-circle-ci-project/browser
✔ Configure as a single-page app (rewrite all urls to /index.html)? Yes
✔ Set up automatic builds and deploys with GitHub? No
✔ Wrote dist/angular-circle-ci-project/browser/index.html
=== Agent Skills Setup
If you are using an AI coding agent, Firebase Agent Skills make it an expert at Firebase.
✔ Would you like to install agent skills for Firebase? No
✔ Wrote configuration info to firebase.json
✔ Wrote project information to .firebaserc
✔ Firebase initialization complete!
The project’s initialization process also generated two unique files at the root of your project. These files are required for successful deployment and must be checked into source control. They are:
firebase.jsoncontains your project’s hosting configuration. Its content instructs Firebase CLI about the files in your project directory to upload and deploy..firebasercspecifies the project to connect to the uploaded code once you successfully deploy to Firebase.
Changing the output path
Once you are ready to build your production application, the Angular CLI will compile it into an output path specified in the angular.json file. Open this file and change the base of outputPath to dist/angular-circle-ci-project:
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": {
"base": "dist/angular-circle-ci-project"
},
"index": "src/index.html",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.css",
"src/styles.css"
],
"scripts": [],
"browser": "src/main.ts"
},
The @angular/build:application builder writes the files that the browser needs to dist/angular-circle-ci-project/browser. That’s the folder you entered as the public directory during firebase init.
Configuring CircleCI to deploy your Angular app to Firebase
Next, create a .circleci folder at the root of the project. In it, create a config.yml file with this content:
version: 2.1
orbs:
browser-tools: circleci/browser-tools@2.4.2
jobs:
build:
working_directory: ~/ng-project
docker:
- image: cimg/node:24.22-browsers
steps:
- browser-tools/install_chrome
- run:
command: google-chrome --version
name: Check install
- checkout
- restore_cache:
key: ng-project-{{ .Branch }}-{{ checksum "package-lock.json" }}
- run: npm ci
- save_cache:
key: ng-project-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- ~/.npm
- run:
name: "Run test"
command: npm run test
- run:
name: "Build application for production"
command: npm run build
- run:
name: "Generate Service Account Authentication"
command: 'echo "$GOOGLE_APPLICATION_CREDENTIALS_BASE_64" | base64 --decode > $GOOGLE_APPLICATION_CREDENTIALS'
- run:
name: "Deploy app to Firebase Hosting"
command: "npx firebase deploy --non-interactive"
- run:
name: "Remove credentials file"
command: "rm $GOOGLE_APPLICATION_CREDENTIALS"
This configuration specifies all the required tools to install and run the test for your application on CircleCI. The browser-tools orb installs Chrome for the headless unit tests, and npm ci installs the project’s dependencies, including the Firebase CLI. The config then sets up a command to automatically deploy your application to Firebase once the tests are successful.
Deployment to Firebase requires authentication from a service account with appropriate privileges on the project. The credentials required for this authentication are provided in a JSON file whose name is saved in the GOOGLE_APPLICATION_CREDENTIALS variable. The Firebase CLI finds the file through this variable, so you don’t need the deprecated --token flag or FIREBASE_TOKEN variable.
To get this JSON file, create a service account that can only deploy to Firebase Hosting:
- In the Google Cloud console, go to the Create service account page and select your Firebase project. It has the same project ID.
- Enter a name for the service account, such as
circleci-firebase-deploy, and click Create and continue. The console generates a service account ID from the name, which you can edit. - In the Permissions (optional) step, grant the service account the Firebase Hosting Admin, API Keys Viewer, and Service Usage Viewer roles, then finish creating the service account.
- On the Service accounts page, click the email address of the new service account and open the Keys tab.
- Click Add key, then Create new key. Select JSON as the key type and click Create. The JSON file downloads to your computer.
To check the roles later, open IAM in the Google Cloud console and filter the list by the service account:
NOTE: Firebase Hosting Admin, API Keys Viewer, and Service Usage Viewer are the only roles that the Firebase CLI needs to deploy to Hosting. The CLI uses Service Usage Viewer to check that the Firebase Hosting API is enabled. Avoid using the key of the Firebase Admin SDK service account, which you can generate from the Firebase console. That service account is highly privileged, so using it violates the principle of least privilege. Keep the JSON file private, and delete it from your computer once you’ve added it to CircleCI. If your Google Cloud organization blocks service account key creation, ask an administrator to allow it for this project.
The JSON file you just downloaded will need to be base64 encoded to get the string value of GOOGLE_APPLICATION_CREDENTIALS_BASE_64. On macOS, do this with the following command.
base64 -i path/to/key.json
Replace path/to/key.json with the path to the JSON file you downloaded earlier. On Linux, run base64 -w 0 path/to/key.json instead, so the output is on a single line.
Copy the output of the command and save it somewhere convenient. You will need it later on CircleCI.
When CircleCI is deploying your application to Firebase, the GOOGLE_APPLICATION_CREDENTIALS_BASE_64 variable will be decoded to a file whose name is the value of GOOGLE_APPLICATION_CREDENTIALS. This file will then be used by Firebase to authenticate and deploy the changes.
The next step is to set up a repository on GitHub and link the project to CircleCI. Review Pushing a project to GitHub for instructions.
Log in to your CircleCI account. The steps to set up the project depend on how your CircleCI organization connects to GitHub. The organization’s URL in the CircleCI web app shows which one it uses: /circleci/ for the CircleCI GitHub App, and /github/ or /gh/ for the GitHub OAuth app.
- CircleCI GitHub App: On the Home page, click Create project and follow the prompts. Name the project, set up a pipeline, and choose your repository. If CircleCI prompts you to connect to GitHub, install the CircleCI GitHub App and give it access to the repository. Keep the default trigger, which runs the pipeline on every commit, and use the existing
.circleci/config.ymlfile as the config source. When the project is created, push a commit to start the first pipeline. - GitHub OAuth app: Select Projects in the sidebar and find your repository. Click Set up, choose Fastest to use the
.circleci/config.ymlfile already in the repository, enter the name of your branch, and click Set Up Project. The first pipeline starts right away.
Your first pipeline will fail, as expected, because you haven’t yet created the GOOGLE_APPLICATION_CREDENTIALS_BASE_64 and GOOGLE_APPLICATION_CREDENTIALS environment variables.
To add them, open the Project menu on the project’s pipelines page and select Project settings. Click Environment Variables in the sidebar, then click Add to create each of these variables:
GOOGLE_APPLICATION_CREDENTIALS_BASE_64is the value of the base64 encoded JSON you generated from the terminal earlier.GOOGLE_APPLICATION_CREDENTIALSis the name of your credentials file, for example,credentials.json. Ensure that whatever name you choose has the .json extension.
Go back to the project’s pipelines page. In the Actions column of the failed workflow’s row, click the Rerun workflow from failed icon.
Your build should finish successfully!
Navigate to the Hosting URL shown in the Deploy app to Firebase Hosting step. It has the form https://<your-project-id>.web.app. Firebase also serves the app at https://<your-project-id>.firebaseapp.com, which is the address in the screenshot below.
Conclusion
You have reached the end of this Angular to Firebase deployment tutorial. With the Firebase tools installed locally on your system, you could just deploy to Firebase directly, but that defeats the purpose of continuous integration and continuous deployment (CI/CD). The ideal approach is to run tests using a platform like CircleCI, then once the tests pass, deploy immediately to your hosting provider, Firebase in this case.
With what you have learned in this tutorial, you can easily run tests and deploy your application every time you make changes to your codebase.
I hope that you found this helpful. The complete source code for this tutorial can be found here on GitHub.