Google エコシステムで AI アプリを構築する

1. 始める前に

ソフトウェア開発は進化しています。最も成功しているデベロッパーは、コードを記述するだけでなく、AI ツールとエージェントをオーケストレートして、より優れたものをより迅速に構築しています。Google のツール エコシステムは、UI 生成、アプリのプロトタイピングとデプロイ、AI 機能の開発、安全でスケーラブルなバックエンド統合など、ライフサイクル全体をカバーする包括的なスイートを提供します。この Codelab では、Google Stitch を使用して UI を設計し、Google AI Studio を使用してバイブ コーディングとアプリのデプロイを行い、Firebase を使用して AI 機能を開発し、安全でスケーラブルなバックエンドに情報を保存します。

この Codelab で作成するアプリは、Decide For Me という名前です。これは、人生の選択(アパートの引っ越し、転職、趣味の選択など)に直面している優柔不断な人のための意思決定アシスタントです。ユーザーがジレンマと人生の優先事項を入力すると、アプリは AI を使用して、長期的な失望を最小限に抑える方法に基づいてユーザーが決定を下せるよう支援します。また、このアプリはユーザーに具体的な最初のステップを提示します。アプリの最終バージョンは次のようになります。

チャット インターフェースと優先度パネルが表示された Decide For Me アプリケーションのスクリーンショット

学習内容

  • Google Stitch で UI を設計する。
  • Google AI Studio でウェブアプリをバイブ コーディングする。
  • Firebase を使用して AI 機能を開発し、情報をクラウドに保存します。
  • Google AI Studio(Cloud Run を利用)を使用して、ウェブアプリを本番環境にデプロイします。

2. Stitch を使用して UI を設計する

  1. モックアップ画像(DecideForMeScreen.jpeg)をダウンロードします。見つけやすいローカル フォルダに保存します。
  2. [Stitch] に移動し、入力フィールドを見つけて、[Web] オプションを選択します。(この Codelab ではウェブ エクスペリエンスに焦点を当てますが、Stitch を使用してモバイル画面を生成することもできます)。
  3. モックアップ画像をアップロードします。
    1. +(追加ボタン)をクリックします。
    2. [Upload Files] を選択します。
    3. 設定手順(DecideForMeScreen.jpeg)でダウンロードした画像を添付します。この手描きのモックアップを使用して、Stitch のマルチモーダル機能をテストできます。
  4. 次のプロンプトをコピーして、入力フィールドに貼り付けます。
    # General Guidance
    Create a modern, clean, and highly polished UI for a web application called
    "Decide For Me" - a hyper-rational decision assistant.
    
    CRITICAL: Replicate the exact layout, structure, and element placement shown in
    the hand-drawn mockup file DecideForMeScreen.jpeg. Do not add any extra menus,
    sidebars, buttons, or top/bottom navigation bars that are not explicitly drawn
    in the file. Stick strictly to the skeleton provided in the mockup.
    
    # Layout & Structure
    - Two-Column Split Screen:
      - Left Side (Main Chat Area): Takes up roughly 70-75% of the screen width. It
        should feel like a premium, focused workspace.
      - Right Side (Configuration Panel): A sidebar taking up 25-30% of the screen
        width with a distinct, subtle background color to separate it from the
        chat.
    
    # Right Panel: Configuration Screen
    - Header: Title it "My Priorities" with a clean, minimalist typography.
    - Content Card: A styled card containing a text box or paragraph area
      showcasing the user's priorities.
    - Interactions: Include a clear "Edit Priorities" button. When clicked, this
      area should visually toggle into an editable textarea or input field.
    
    # Left Panel: Chat & Dilemma Decision Screen
    - Chat History: A clean vertical flow of message bubbles.
      - The first message bubble must be aligned to the left (system message) and
        say: "Tell me your dilemma". Use a friendly, neutral background color for
        this bubble.
    - Bottom Input Area: Instead of a traditional single-line chat bar, create a
      unified, beautiful "Decision Submission" layout positioned at the bottom:
      - Dual Input Fields: Place two horizontal or cleanly stacked input fields.
        - Input 1 label: "Option A"
        - Input 2 label: "Option B"
      - Action Button: A prominent, styled "Go" action button to trigger the
        reasoning loop.
    
    # Theme & Aesthetic
    - Vibe: Hyper-rational, clean, trustworthy, and modern. Use a sophisticated
      color palette (e.g., deep slates, clean whites/grays, and a sharp accent
      color like a subtle indigo or teal for active states and buttons).
    - Spacing & Typography: Use generous whitespace, soft rounded corners
      (border-radius) for cards and buttons, and a highly legible sans-serif font.
    
  5. 入力フィールドの右下にある生成矢印をクリックします。Stitch は、画面とデザイン システム全体を生成します。これには、カラーパレット、フォント オプション、アイコン、UI 要素の一般的な雰囲気などが含まれます。

生成された「おまかせ」の UI デザインとデザイン システムが表示されている Stitch のインターフェース

3. Google AI Studio でアプリを構築する

  1. Firebase プロジェクトを作成します。
    1. Stitch で使用した Google アカウントと同じアカウントを使用して Firebase コンソールにログインします。
    2. ボタンをクリックして新しいプロジェクトを作成し、プロジェクト名(例: Decider App)を入力します。
    3. [続行] をクリックします。
    4. Firebase の利用規約が表示されたら、内容を読み、同意して [続行] をクリックします。
    5. (省略可)Firebase コンソールで AI アシスタンス(「Gemini in Firebase」)を有効にします。
    6. この Codelab では Google アナリティクスは不要なため、Google アナリティクスのオプションをオフにします。
    7. [プロジェクトを作成] をクリックし、プロジェクトがプロビジョニングされるまで待ってから、[続行] をクリックします。
  2. Stitch で作成した画面を Google AI Studio にエクスポートします。
    1. Stitch で生成されたデザインをクリックします。
    2. 画面右上の [エクスポート] をクリックします。
    3. 選択されているオプションが [Google AI Studio] であることを確認します。
    4. [説明] フィールドまで下にスクロールします。
  3. 次のプロンプトをコピーして、[説明] フィールドに貼り付けます。[FIREBASE_PROJECT_ID] を、ステップ 1 で確認した実際のプロジェクト ID に置き換えます(プロジェクト ID がわからない場合は、[プロジェクトの設定] で確認できます)。
    # General Guidance
    Build the "Decide For Me" app: A hyper-rational decision assistant for
    chronically indecisive people facing life choices (moving apartments, changing
    careers, picking a hobby). The user enters a dilemma and their top priorities
    in life. The app will help with the decision. Follow the instructions below to
    build it:
    
    # UI Instructions
    Using the design artifacts exported from Stitch (the PNG image and HTML file),
    build a fully functional web application that accurately mirrors the design and
    layout.
    
    # App Architecture & Initialization Instructions
    - Initialize the latest Firebase JS SDK for client-side services. Use the
      Firebase project with ID [FIREBASE_PROJECT_ID].
    - Enable Firebase Authentication in this project using the Google provider.
      If a user is not logged in, show a clean, minimalist sign-in state. If the
      user is logged in, take them directly to the dilemma decision screen.
    - Initialize Firebase App Check in debug mode with the following code:
      `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;`
      `initializeAppCheck(app, { /* App Check options */ });`
    
    
    # State & Database Management Instructions
    - User Priorities:
      - Once authenticated, pull the user's saved priorities from Firebase
        Firestore at the path: `users/{userId}`. Each document should contain one
        string field: 'priorities'.
      - Bind this data to the Right Panel ("My Priorities").
      - When the user clicks the "Edit" button, toggle the view to a textarea, with
        a 'save' button. When saved, write the updated string back to
        `users/{userId}`.
      - Make sure to implement and deploy strong Security Rules for Firestore.
    
    # UI Stream Update & Display Instructions
    - Once the user submits option A and option B in the dilemma decision screen,
      display both options as a single message on the user side of the chat. Then,
      display a sleek loading state in the main chat panel. Leave the app in this
      "loading" state and do nothing else, we will process both options and build
      the server-side thinking later.
    
  4. [Build with Google AI Studio] をクリックします。これにより、Google AI Studio が新しいタブで開き、デザイン ファイルとプロンプトが引き継がれます。
    1. プロンプトが完全に引き継がれたことを確認します。
    2. プロンプトの一部しか表示されない場合は、プロンプト全体をもう一度貼り付けます。
  5. [Build] をクリックします。Google AI Studio が、プロンプトと UI 設計に従って Decide For Me アプリの生成を開始します。
    1. 生成中に、代替の UI デザインが提案されます(この Codelab ではこれらのデザインを無視しますが、今後は別のデザインを選択できます)。
    2. Firebase を有効にするよう求めるプロンプトが表示されたら、[有効にする] をクリックします。
  6. 生成されたアプリを検査して確認します。
    1. [プレビュー] タブでアプリをテストします。
    2. [コード] タブに切り替えて、生成されたすべてのファイルとコードを確認します。
    3. Google AI Studio は、Firebase プロジェクトを作成し、Firebase Authentication と Firestore を有効にして、コードベースで Firebase を構成しました。この Firebase プロジェクトには、この Codelab の次のステップでアクセスして操作します。

4. App Check デバッグ トークンを登録する

Google AI Studio でアプリを生成すると、Firebase プロジェクトが作成され、アプリがそのプロジェクトに接続されます。この Firebase プロジェクトにアクセスし、Firebase App Check という重要なセキュリティ サービスに開発環境を登録する必要があります。

Firebase プロジェクトにアクセスする

  1. Google AI Studio で作成された Firebase プロジェクトのプロジェクト ID を確認します。
    1. Google AI Studio の [Code] タブに切り替えます。
    2. firebase-applet-config.json ファイルを開きます。
    3. projectId フィールドの値をコピーします。
  2. Firebase コンソールに移動し、この ID を使用してプロジェクトを検索します。

デバッグ トークンを登録する

アプリで Firebase App Check を使用すると、受信トラフィックが正規のアプリからのみ発信されるようにすることで、バックエンド サービスと AI モデルを不正使用から保護できます。

アプリは Google AI Studio のプレビュー環境で実行されているため、App Check デバッグ プロバイダ(self.FIREBASE_APPCHECK_DEBUG_TOKEN = true)を使用します。ウェブアプリが読み込まれると、Firebase は自動的にデバッグトークンをブラウザのデベロッパー コンソールに出力します。

  1. デバッグ トークンを確認します。
    1. Google AI Studio で、アプリのプレビューを表示しながら、ブラウザのデベロッパー ツールを開きます。
      • Chrome、Edge、Firefox: F12 キーを押すか、プレビュー内の任意の場所を右クリックして [検証] を選択し、[コンソール] タブを選択します。
      • macOS: command+option+I キーを押し、[Console] タブを選択します。
    2. コンソールログで、App Check のデバッグ メッセージを見つけます。
      AppCheck debug token: "123a4567-b89c-12d3-e456-789012345678".
      You will need to safelist it in the Firebase console for it to work.
      
    3. トークン文字列をコピーします(引用符は除きます)。
  2. デバッグ トークンを登録します。
    1. Firebase コンソールで、[セキュリティ] > [App Check] > [アプリ] タブに移動します。
    2. リストでウェブアプリを見つけ、その他メニュー(⋮)をクリックして、[デバッグ トークンを管理] を選択します。
    3. [デバッグ トークンを追加] をクリックし、コピーしたトークンを貼り付け、名前(Google AI Studio Preview など)を入力して、[保存] をクリックします。
    Firebase コンソールの [デバッグ トークンを管理] メニュー項目のスクリーンショット

5. アプリをテストする

プロジェクトが接続され、デバッグ トークンが App Check に登録されたので、ベースライン機能である Authentication と Firestore をテストします。

  1. ユーザー認証をテストし、優先度を保存します。
    1. Google AI Studio の Decide For Me アプリのプレビューで、Google アカウントでログインして認証画面をテストします。
    2. 右側のパネル([My Priorities])を使用して、人生の優先事項を保存します。
  2. Firebase コンソールで認証を確認します。
    1. Firebase コンソールに移動し、[Authentication] を開きます。
    2. Decide For Me アプリでの認証に使用した Google アカウントが一覧に表示されていることを確認します。
    認証済みの Google アカウントが表示されている Firebase コンソールの Authentication ページ
  3. Firestore データ ストレージを確認します。
    1. Firebase コンソールで Firestore を開きます。
    2. 優先度が users/{userId} パスのドキュメントに保存されていることを確認します。
    users/{userId} に保存された優先度が表示された Firebase コンソールの Firestore データベース

6. Firebase を使用して AI 搭載 Decider フローを構築する

アプリは AI を使用しておまかせアクションを強化します。Firebase を使用して、この AI 搭載の Decider フローを構築できます。

Firebase AI Logic を設定する

  1. Firebase AI Logic で Gemini Developer API を有効にします。
    1. Firebase コンソールで Firebase AI Logic を開き、[使ってみる] をクリックします。
    2. [Gemini Developer API] を選択し、コンソールの手順に沿って API を有効にします。
  2. Firebase AI Logic の設定を構成します。
    1. [設定] タブに移動します。
    2. [テンプレート専用モードの適用] オプションを [適用] に切り替えます。
    3. [認証済みユーザーモードの適用] オプションを [適用] に切り替えます。

サーバー プロンプト テンプレートを作成する

この Codelab では、Firebase AI Logic を介して Gemini API とやり取りするために、サーバー プロンプト テンプレートを使用します。

テンプレートに進む前に、モデル構成、システム指示、プロンプトをサーバーサイドに保存することが重要である理由を理解するために、以下を確認してください。

  • 知的財産の保護: クライアント デバイスからプロンプトを pull し、バックエンドで安全に保管します。
  • プロンプト インジェクション攻撃の防止: クライアントは、バックエンド スキーマ検証を使用して特定の変数のみを入力できます。
  • アプリのリリースなしで更新: 新しいアプリ バージョンをリリースすることなく、コンソールでプロンプト、システム指示、モデル構成を更新できます。

サーバー プロンプト テンプレートを作成してテストする方法は次のとおりです。

  1. サーバー プロンプト テンプレートを作成します。
    1. [プロンプト テンプレート] タブに移動します。
    2. [テンプレートを作成] をクリックします。
    3. [空のテンプレート] を選択します。
    4. 次の情報を使用して最初のテンプレートを作成します。
      • テンプレート名: Decider Flow
      • テンプレート ID: decider-flow
      • 構成(frontmatter)
        model: "gemini-3.5-flash-lite"
        input:
          schema:
            priorities: "string, user's core priorities"
            optionA: "string, option A under consideration"
            optionB: "string, option B under consideration"
        output:
          format: json
          schema:
            verdict: string
            justification: string
            firstStep: string
        
      • プロンプトと(省略可能な)システム指示
        {role "system"}
        You are the Decider Agent, a multi-stage reasoning engine that
        combines the roles of an honest and polite behavioral economist, a
        long-term strategic forecaster, and an executive decision coach.
        Your job is to take a user's dilemma and their core priorities, run
        them through a rigorous, adversarial 3-phase thinking process, and
        output a highly analytical, reasoning-backed final verdict. You must be
        direct, sharp, and realistic. Do not give generic platitudes or claim
        that "both options are great." You must force a clear choice.
        
        {role "user"}
        # Context & Inputs
        You are analyzing a critical life decision for the user. Base your
        entire multi-phase reasoning flow strictly on these three specific
        inputs:
        - User's Core Priorities: {{priorities}}
        - Option A under consideration: {{optionA}}
        - Option B under consideration: {{optionB}}
        
        Execute your reasoning flow through the following three phases:
        
        # Phase 1: Cynical Breakdown (Input-Driven Analysis)
        Analyze {{optionA}} and {{optionB}} strictly through the lens of the
        user's explicit {{priorities}}. Do not evaluate them in a vacuum.
        - Identify the hidden flaws, compromises, and psychological costs
          embedded in both choices.
        - Pinpoint exactly how {{optionA}} could directly conflict with or
          undermine their {{priorities}}.
        - Pinpoint exactly how {{optionB}} could directly conflict with or
          undermine their {{priorities}}.
        - Uncover any cognitive biases (like status quo bias or loss aversion)
          the user might be falling for in either option.
        
        # Phase 2: Long-Term Regret Projection
        Project the user 5 years into the future. Apply the Regret Minimization
        Framework to both paths:
        - The {{optionA}} Timeline: Quantify the absolute worst-case, deep,
          structural 5-year regret of choosing this path. Focus heavily on
          failures of courage vs. failures of action based on their
          {{priorities}}.
        - The {{optionB}} Timeline: Quantify the matching 5-year regret for
          this path.
        - Contrast these two timelines. Which option carries the kind of regret
          that fundamentally breaks the user's {{priorities}}?
        
        # Phase 3: Final Recommendation & Action Step
        Synthesize the cynical critiques and long-term regret scores.
        Weigh them against the user's {{priorities}} to determine which
        choice minimizes long-term disappointment.
        - Verdict: You must declare either {{optionA}} or {{optionB}} as the
          definitive winner. No compromise, no "it depends," and no hybrid
          options.
        - Justification: Provide a sharp, reasoning-backed explanation showing why
          the losing option was eliminated based on the Phase 1 and Phase 2
          analysis.
        - First Step: Give one microscopic, low-friction task the user can
          execute within the next 15 minutes to commit to or move toward the
          chosen verdict.
        
        {role "system"} と {role "user"} の前後に {} を追加して、システム指示とプロンプトを正しい構文(9db2a4f2c5cf2ec7.png)で記述します。
      • テスト入力
        {
          "priorities": "Be financially stable, have a good work-life balance where I can travel twice a year",
          "optionA": "Buy a house for 615000 British pounds with a mortgage of 2800 per month for the next 35 years",
          "optionB": "Keep renting for 2400 per month for the foreseeable"
        }
        
  2. [テンプレートを保存] をクリックします。
  3. テンプレートをテストします。
    1. [プロンプト テストを実行] をクリックします。
    2. [テスト レスポンス] を見つけて、プロンプトで指定したすべてのフィールド(verdict、justification、firstStep)が含まれていることを確認します。
    3. すべてが想定されるレスポンスと一致する場合は、テンプレートの右上にある鍵アイコンを使用してテンプレートをロックし、バージョンの安定性を確保して、誤って変更されないようにします。

テンプレートをアプリで使用できるようになりました。

7. アプリで Decider プロンプト テンプレートを使用する

ウェブアプリでテンプレートを使用するようにします。

  1. Google AI Studio でアプリに戻ります。
  2. Google AI Studio エージェントに、Decide For Me アクションを実装するよう依頼します。
    1. 次のプロンプトをコピーします。
      Now let's implement the "Decide For Me" button action. When clicked, it
      should call the Firebase AI Logic SDK using a Template Generative Model.
      The prompt is stored in a prompt template with the id "decider-flow". When
      calling the API, pass the following variables as the input payload object:
      - priorities
      - optionA
      - optionB
      
      The API will return a JSON object. Handle the response asynchronously and
      extract:
      - verdict
      - justification
      - firstStep
      
      Once the data is received, update the UI state to append a new message to
      the chat array. Ensure it renders as a system chat bubble positioned on
      the left side of the chat screen, mapping these three fields clearly into
      the bubble's layout.
      
      Please provide the necessary front-end component state updates and the
      Firebase SDK call.
      
    2. Google AI Studio のチャット入力にプロンプトを貼り付け、[送信] をクリックします。
  3. 構成を確認し、意思決定アシスタントをテストします。
    1. Google AI Studio がアプリに Firebase AI Logic を追加し終えるまで待ちます。
    2. [コード] タブに切り替え、firebase-applet-config.json ファイルに API キーがあることを確認します。Firebase API キーが構成ファイルにない場合は、Google AI Studio にインポートを依頼します。
    3. [プレビュー] タブに切り替えます。
    4. オプション A と B を送信し、AI が判定結果、理由、最初のステップを返すことを確認します。

参考までに、Google AI Studio で生成されたコードは次のようになります。

const aiInstance = getAI(app);
const templateModel = getTemplateGenerativeModel(aiInstance);

const result = await templateModel.generateContent('decider-flow', {
  priorities: priorities,
  optionA: optA,
  optionB: optB
});

const rawText = result.response.text();

// Parse response text to extract fields
const cleaned = rawText.replace(/```json|```/g, '').trim();
const parsedData: { verdict?: string; justification?: string; firstStep?: string } = JSON.parse(cleaned);

const verdict = parsedData.verdict;
const justification = parsedData.justification;
const firstStep = parsedData.firstStep;

リクエストをデバッグしてモニタリングする

アプリでエラーが発生した場合、レスポンスの生成に失敗した場合、または API トラフィックを詳細に検査する場合は、Firebase AI Logic の組み込みの分析ツールとモニタリング ツールを使用します。

  1. Firebase コンソールで、[AI Services] > [AI Logic] > [AI モニタリング] タブに移動します。
  2. ダッシュボードで定量的な指標を確認します。
    • リクエストの量とステータス: 受信リクエストがバックエンドに到達して 200 OK を返すか、クライアント エラーまたはサーバーエラーで失敗するかを確認します。
    • レイテンシ: レイテンシ グラフを調べて、エンドツーエンドのレスポンス時間を確認します。
    • トークン数: リクエストごとに入力トークンと出力トークンの使用量をモニタリングします。
  3. 個々のリクエスト トレースを検査して詳細なデバッグを行う:トレース テーブルで特定のリクエスト トレースをクリックして、そのペイロードを検査します。
    • 入力: 変数(priorities、optionA、optionB)がクライアント アプリから正しく渡されたことを確認します。
    • 出力: モデルによって生成された未加工のテキストを表示して、スキーマに一致する有効な JSON が返されたかどうかを確認します。
    • エラーの詳細: リクエストが失敗した場合は、トレースエラーログで、無効な App Check トークン、認証の拒否、割り当て制限、プロンプト検証エラーなどの理由を確認します。
  4. Google AI Studio に関する問題のトラブルシューティングと解決:
    • トレースでエラー(不正な形式の JSON レスポンスの解析やパラメータの欠落など)を特定した場合は、エラー メッセージまたはペイロードをコピーします。
    • Google AI Studio に戻り、アプリコードの対応する問題を修正するようアシスタントに指示します。

8. 省略可: アプリをデプロイする

アプリがプレビュー モードで動作するようになったので、本番環境にデプロイします。

本番環境で Firebase エンドポイントを保護するには、Firebase App Check で使用する本番環境の構成証明プロバイダを構成します(この Codelab では、reCAPTCHA v3 を使用します)。

すべての ai.studio アプリを許可するのではなく、特定のドメインを reCAPTCHA に登録できるように、まずアプリをデプロイして正確な一般公開 URL を取得する必要があります。

アプリをデプロイして reCAPTCHA を構成します。

  1. Google AI Studio を使用してウェブアプリをデプロイする:
    1. Google AI Studio で、上部のナビゲーション バーにある [Publish] をクリックします。
    2. [使ってみる] をクリックし、アプリケーションの名前と説明を確認またはカスタマイズして、[アプリを公開] をクリックします。
    3. Google AI Studio でアプリがビルドされ、デプロイされるのを待ちます(通常は 1 ~ 2 分)。
    4. 生成されたライブ バニティ URL(https://decide-for-me-123.ai.studio など)をコピーし、そのドメイン(decide-for-me-123.ai.studio など)をメモします。
  2. Google reCAPTCHA で reCAPTCHA v3 キーを作成する:
    1. Google reCAPTCHA 管理コンソールに移動します。
    2. ラベルを入力します(例: Decide For Me - Production)。
    3. [reCAPTCHA のタイプ] > [reCAPTCHA v3(スコアベース)] を選択します。
    4. [ドメイン] セクションで、アプリのデプロイされた正確なドメイン(decide-for-me-123.ai.studio など、https:// とパスを省略)を追加します。カスタム ドメインを使用する場合は、カスタム ドメインを追加します。
    5. 利用規約に同意し、[送信] をクリックします。
    6. このタブは開いたままにしてください。サイトキー(公開クライアントキー)と秘密鍵(秘密サーバーキー)の両方が必要になります。
  3. Firebase コンソールで秘密鍵を登録します。
    1. Firebase コンソールの [App Check] に移動します。
    2. [アプリ] タブに移動します。
    3. リストでウェブ アプリケーションを見つけてクリックし(またはその他メニュー ⋮ をクリックし)、[reCAPTCHA v3] を選択します。
    4. [reCAPTCHA Secret Key] フィールドに reCAPTCHA 秘密鍵を貼り付け、[Save] をクリックします。
  4. ReCaptchaV3Provider を使用するようにクライアント アプリを構成します。
    1. Google AI Studio でチャットパネルに切り替え、本番環境用に App Check 構成を更新するようアシスタントに指示します。
      Please update our Firebase App Check initialization to use
      ReCaptchaV3Provider with the reCAPTCHA site key "YOUR_RECAPTCHA_SITE_KEY",
      while retaining support for debug tokens in non-production environments.
      
    2. [コード] タブでコードを直接確認する場合は、App Check の初期化が次の構造と一致していることを確認してください。
      import { initializeAppCheck, ReCaptchaV3Provider } from "firebase/app-check";
      
      const appCheck = initializeAppCheck(app, {
        provider: new ReCaptchaV3Provider("YOUR_RECAPTCHA_SITE_KEY"),
        isTokenAutoRefreshEnabled: true
      });
      
    3. コードを更新したら、Google AI Studio でアプリを再公開して、更新された App Check 構成をライブサイトに push します。
  5. 本番環境のトラフィックを確認し、App Check をモニタリングする:
    1. シークレット ブラウザ ウィンドウでライブアプリの URL を開き、Google でログインして、ジレンマの送信をテストします。
    2. Firebase コンソールの [App Check] に戻り、[API] タブと [モニタリング] タブを調べて、Firestore と Firebase AI Logic のリクエストが正常に登録されていることを確認します。

9. まとめ

おめでとうございます!Google のビルダー スタックのツールを使用して、AI 機能を備えた便利なアプリをゼロから構築しました。これはほんの始まりにすぎません。Google ツールでできることは他にもたくさんあります。Firebase + Google Cloud プロジェクトが作成されました。利用可能なすべてのサービスを試してみましょう。

こちらのリンクにアクセスして、Completed Builder Journey バッジを獲得しましょう。

学習を続けるには、goo.gle/builders にアクセスして次のラボに進んでください。

複数の自律型エージェントを並行してオーケストレートするための Google 専用プラットフォームである Antigravity 2.0 をすでに使用している場合は、Google AI Studio からプロジェクトをエクスポートして Antigravity にインポートすることで、ローカルで作業を継続できます。Antigravity には、ワンクリックでインストールできる Firebase 用のエージェント スキルが用意されています。これらのスキルはモバイル開発もサポートしているため、必要に応じて Android と iOS の両方の環境でこのアプリを複製できます。