# 5. Upload to Firebase Hosting

## 5.1 Install the firebase-tools CLI <a href="#d31b" id="d31b"></a>

Skip this step if you already have Firebase tools installed. If you do not have this, you must install that first.

> npm download link: <https://nodejs.org/> (Download and install it)

{% hint style="info" %}
If you are not sure whether `npm` is installed on your machine, run `$ npm -v` , and see if it lists a version number. If it does, then you already have `npm`. If it says “command not found”, you need to install it.
{% endhint %}

Once `npm` is installed, run the following command:

```
npm install -g firebase-tools
```

`firebase-tools` is now installed!

## 5.2 Install the required command line tools <a href="#install-cli-tools" id="install-cli-tools"></a>

* Log into Firebase using your Google account by running the following command:

```
firebase login
```

<figure><img src="/files/VSFjWevPbhyA58HBRjRW" alt=""><figcaption></figcaption></figure>

* Type Y and you will be redirected to your browser.

* Follow the command prompt and the link in your browser. Accept the permissions by clicking **Ok**. When you return to your terminal you should see that you are now logged in.

* Now you have to initialize the firebase. Run the following command:

```
firebase init
```

<figure><img src="https://lh5.googleusercontent.com/gmQTg_qE7UUhxmflNhNDI8UHT67Y6E16sIFUjH_gXWoNVUqODbCXBSE4v_YnBXlxu4AyZi20GfLVCVdLUahzASmKyUzPH2W9MMSQWlqAHduLDQ78GdAm3hpKEK7kjBVqfR5MNtgfzdGpa8XlM9uY0WZu5fHwXZ3wqbUXN_TttvZJoMr9jmpV37HfpS2M" alt=""><figcaption></figcaption></figure>

* Use the arrow keys to navigate the cursor to **Hosting** and hit the spacebar to select it, then press enter. Now you will see this screen:

<figure><img src="https://lh3.googleusercontent.com/PAlC0Ta4gYhgJ6EBOLkGnGbtiYgM5EwPfzZ7Pl-2FHZBsrB-pf-phgGz8QYx3pUVJT4CI8LzcXyQYD2pm0JXR3E_ai1r6q8Gzzpb6KnPSiVcgx66EkBmsCdzpQHjpUyBUR-KXBhJwrKstlmm63wNxDGKD9d3595NXeZNg3AsMbOTLjO27qa4ydDuIyRO" alt=""><figcaption></figcaption></figure>

* Select an existing project by pressing Enter. Use the arrow keys to select the project you have made in the Firebase console.
* Next, enter **build/web** as the public directory and press enter, then enter **y** (for yes) to select the single page app option.
* Enter **n** (for no) to Set up automatic builds and deploys with the GitHub option.

<figure><img src="/files/VJ5ZfdKzqP8XhEWBosC3" alt=""><figcaption></figcaption></figure>

## 5.3 Build The Web App

Run the following command to build the app for the web:

```
flutter build web --release
```

## 5.4 Upload to Hosting

Run the following command to upload the admin app to the Firebase hosting:

```
firebase deploy
```

<figure><img src="/files/9ynb3JWXF4C7Ux4gBhi2" alt=""><figcaption></figcaption></figure>

After this command, you will get a **Hosting URL** from Firebase which will be your **Admin URL**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.newshour.mrb-lab.com/admin-setup/5.-upload-to-firebase-hosting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
