# Firebase への配信

[Firebase](https://firebase.google.com) への配信方法について説明します。\
Firebaseへの配信は、[Firebase Hosting機能](https://firebase.google.com/docs/hosting/quickstart?hl=ja)を利用しています。また、Firebaseへの配信は、PWAビルドされたアプリのみ対応しています。

## 準備

配信のするための事前準備として、`プロジェクトID`と`APIトークン`を用意する必要があります。

### プロジェクトID

1. [Firebaseコンソール](https://console.firebase.google.com)にて、プロジェクトを作成します。
2. プロジェクトIDは、下の赤枠に表示されます。

![](/files/-MgzMEi5BNhIgz1h4cC0)

### API トークンの取得方法

1. [Firebase CLI ガイド](https://firebase.google.com/docs/hosting/quickstart?hl=ja) に沿って`Firebase CLI をインストール`します。
2. Firebase CLIをインストールした後、次のコマンドにてトークンを取得します。

```bash
firebase login:ci
```

### firebase.jsonファイル

初期化後、Firebaseはfirebase.jsonファイルをローカルプロジェクトのルートに追加します。このファイルをMonacaの対象プロジェクトのルートに追加する必要があります。

## デプロイサービスの登録

事前に用意したFirebaseの情報をMonacaへ登録する方法は、次のとおりです。

1. Monaca クラウド IDE メニュー&#x306E;**`設定 → デプロイサービス`**&#x3092;選択します。
2. &#x20;`新しく追加する`をクリックします。
3. `Firebase` を選択し、以下の必要情報を入力します。
   * `エイリアス名`: 各サービスの一意の識別子 (Monaca内で管理するための識別子)
   * `API トークン`: Firebase CLI で取得した API トークン
   * `プロジェクト ID`: Firebase コンソールから取得したID
4. &#x20;`追加`をクリックします。

## デプロイを実施

登録したデプロイサービスを利用して、Firebaseへの配信を行います。

1. PWAビルドを行います。ビルドの手順は、[PWA アプリのビルド](/products_guide/monaca_ide/build/build_pwa.md)を参照ください。
2. ビルド完了後に、ビルド結果画面に遷移します。
3. ビルド結果画面からデプロイを実行します。画面下部に登録したデプロイサービスが表示されますので、クリックし配信を開始します。

![](/files/-MgzMfm3DowMHUxpPlSM)


---

# 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://ja.docs.monaca.io/products_guide/monaca_ide/monaca_ci/firebase.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.
