[Video](https://www.youtube.com/watch?v=P0x0LmiknJc)

Firebase Hosting gives you a fast, secure, and reliable way to host your
app's static assets (HTML, CSS, JavaScript, media files, etc.) as well as to
[serve dynamic content and host microservices](https://firebase.google.com/docs/hosting/serverless-overview.md.txt).

Our production-grade hosting is backed by a global content delivery network
(CDN). Hosting serves your content over SSL, by default, and can be used
with your own [custom domain](https://firebase.google.com/docs/hosting/custom-domain.md.txt) or on your project's
subdomains at no cost on `web.app` and `firebaseapp.com`.

<br />


<br />


<br />

### AI prompt for AI assistance


***For AI assistance, copy the prompt below into your
AI coding agent (like Antigravity, Claude Code, Codex, and Cursor).**
You can customize the prompt and iterate with your agent. Visit
[Firebase agent skills](https://firebase.google.com/docs/ai-assistance/agent-skills.md.txt)
for detailed installation info.*

```
Help me use Firebase in my app.
1. Make sure that **Firebase agent skills** are installed and updated. For Claude Code, Codex, or Cursor agents, help me install the Firebase plugin. For other agents, run `npx skills add firebase/agent-skills`.  Always try to use **Firebase agent skills** for Firebase-related tasks.
2. Help me use Firebase to host my web app. Set up my app to use Firebase, and then deploy my app.
```

## Before you begin

Before you can set up Firebase Hosting, you need to
[create a Firebase project](https://firebase.google.com/docs/web/setup.md.txt).

## **Step 1** : Install the Firebase CLI

Visit the Firebase CLI documentation to learn how to
[install the CLI](https://firebase.google.com/docs/cli.md.txt#install_the_firebase_cli) or
[update to its latest version](https://firebase.google.com/docs/cli.md.txt#update-cli).

> [!NOTE]
> **Note:** You can also run Firebase CLI commands in Cloud Shell. [Cloud Shell](https://firebase.google.com/docs/cloud-shell.md.txt) is a browser-based, pre-authenticated command-line environment, accessible from the Firebase console, and comes with the Firebase CLI pre-installed. This makes it a convenient option for getting started quickly, provided you add your project files to the Cloud Shell environment.

## **Step 2**: Initialize your project

To connect your local project files to your Firebase project, run the following
command from the root of your local project directory:

```
firebase init hosting
```

During project initialization, from the Firebase CLI prompts:

1. **Select a Firebase project to connect to your local project directory.**

   The selected Firebase project is your "default" Firebase project for your
   local project directory. To connect additional Firebase projects to your
   local project directory, set up [project aliases](https://firebase.google.com/docs/cli.md.txt#project_aliases).
2. **Specify a directory to use as your public root directory.**

   This directory contains all your publicly served static files, including your
   `index.html` file and any other assets that you want to deploy to
   Firebase Hosting.
   - **Static apps**: If you are deploying a static app:

     - The default for the public root directory is called `public`.

     - You can specify your public root directory now or you can
       [specify it later](https://firebase.google.com/docs/hosting/full-config.md.txt#public) in your
       `firebase.json` configuration file.

     - If you select the default and don't already have a directory called
       `public`, Firebase creates it for you.

     - If you don't already have a valid `index.html` file or `404.html` file in
       your public root directory, Firebase creates them for you.

   - **Opt into App Hosting** : If the CLI detects features of
     an SSR web framework like Next.js or Angular Universal, it may recommend initializing
     [Firebase App Hosting](https://firebase.google.com/docs/app-hosting.md.txt) instead. App Hosting is the
     recommended deployment solution for full-stack framework apps. You can proceed with
     App Hosting setup or continue with Hosting (classic) for static-only deploys.

3. **Choose a configuration for your site.**

   If you select to make a one-page app, then Firebase automatically adds
   [rewrite configurations](https://firebase.google.com/docs/hosting/full-config.md.txt#rewrites) for you.

At the end of initialization, Firebase automatically creates and adds two files
to the root of your local app directory:

- A `firebase.json` configuration file that lists your project configuration.
  Learn more about this file on the
  [configure hosting behavior](https://firebase.google.com/docs/hosting/full-config.md.txt) page.

- A `.firebaserc` file that stores your
  [project aliases](https://firebase.google.com/docs/cli.md.txt#project_aliases).

## **Step 3**: Deploy to your site

To deploy to your site, run the following command from the root of your local
project directory:

```
firebase deploy --only hosting
```

> [!NOTE]
> **Note:** By running this command with the `--only hosting` flag, you're only deploying your Hosting content and config. If you *also* want to [deploy other project resources or configurations](https://firebase.google.com/docs/cli.md.txt#partial_deploys) (like functions or database rules), run this command with a comma-separated list in the flag (for example, `--only hosting,functions`).

This command deploys your Hosting content and config to the following
Firebase-provisioned subdomains:

- `PROJECT_ID.web.app`
- `PROJECT_ID.firebaseapp.com`

Learn more about
[deploys and even locally testing your site](https://firebase.google.com/docs/hosting/test-preview-deploy.md.txt).

## Next steps

Now your site is ready to share with the world!

- Continue to improve your site. Test locally, share changes at a temporary
  preview URL, then deploy to your live site. Follow this
  [step-by-step guide](https://firebase.google.com/docs/hosting/test-preview-deploy.md.txt).

- Learn about further hosting capabilities:

  - [Configure hosting behavior](https://firebase.google.com/docs/hosting/full-config.md.txt)
  - [Connect a custom domain](https://firebase.google.com/docs/hosting/custom-domain.md.txt)
  - [Serve dynamic content and host microservices](https://firebase.google.com/docs/hosting/serverless-overview.md.txt)
- Take a look at the full documentation for the [Firebase CLI](https://firebase.google.com/docs/cli.md.txt).

- Prepare to launch your app:


  - Set up [budget alerts](https://firebase.google.com/docs/projects/billing/budget-alerts.md.txt) for your project in the Google Cloud console.
  - Monitor the [*Usage and billing* dashboard](https://console.firebase.google.com/project/_/usage?useAutoProject=true) in the Firebase console to get an overall picture of your project's usage across multiple Firebase services. You can also visit the [Hosting *Usage* dashboard](https://console.firebase.google.com/project/_/hosting/usage?useAutoProject=true) for more detailed usage information.
  - Review the [Firebase launch checklist](https://firebase.google.com/support/guides/launch-checklist.md.txt).