firebase-remote-config-basics

bởi firebase

Hướng dẫn toàn diện về Firebase Remote Config, bao gồm quản lý template và cách sử dụng SDK. Sử dụng kỹ năng này khi người dùng cần trợ giúp thiết lập Remote Config, quản lý feature flag, hoặc cập nhật hành vi ứng dụng một cách linh hoạt.

npx skills add https://github.com/firebase/agent-skills --skill firebase-remote-config-basics

Remote Config

This skill provides a complete guide for getting started with Remote Config on Android or iOS. Remote Config allows you to change the behavior and appearance of your app without publishing an app update by maintaining a cloud-based configuration template.

Prerequisites

Provisioning Remote Config requires both a Firebase project and a Firebase app, either Android or iOS. To manage the Remote Config template and conditions via the command line, use the Firebase CLI. See the firebase-basics skill for references on project initialization.

Troubleshooting Execution

Handling npx 403 Forbidden Errors

If npx -y firebase-tools@latest fails due to registry permissions (403 error):

  1. Inform the user: "I am unable to fetch the latest Firebase tools via npx due to a registry error."
  2. Fallback: Attempt to use the local firebase command directly if the user confirms it is installed globally (npm install -g firebase-tools).

Handling Project Context Issues

If a command fails because "no active project is selected":

  1. Check login: Run npx -y firebase-tools@latest login:list.
  2. Prompt for ID: If logged in but no project is active, ask the user: "Please provide your Firebase Project ID to proceed."
  3. Use Flag: Append --project <PROJECT_ID> to every subsequent command.

SDK Setup

To learn how to set up Remote Config in your application code, choose your platform:

Best Practices and Template Management

Follow these guidelines and use the associated CLI tools to ensure efficient and safe use of Remote Config.

Fetching Strategies

To optimize app performance and user experience, follow these recommended patterns (see Loading Strategies):

  • Load new values for next startup: The most effective pattern is to activate previously fetched values immediately on startup and fetch new values in the background to be used next time. This minimizes user wait time.
  • Real-time Updates: Use the SDK's real-time listener to update the app instantly without a refresh when server-side configuration changes.

Template Management via CLI

Use the following commands to manage your Remote Config template and version history through the terminal:

Template Management via CLI

Use the following commands to manage your Remote Config template and version history through the terminal:

  • Get current template: Save the remote template to a local JSON file for auditing or modification.

    npx -y firebase-tools@latest remoteconfig:get -o remote_config.json
    
  • Autonomous Editing & Discovery : Modify the local remote_config.json directly. Determine the correct signal (e.g., device.country or percent) and update the "conditions" array and "parameters" map accordingly.

  • MANDATORY: User Review and Verification : STOP and ask the user to verify your changes before proceeding to deployment.

    • Action: Inform the user: "I have prepared the changes in remote_config.json. Please review the file for accuracy. Once you are satisfied, tell me to 'deploy' to make the changes live."
  • Deployment Orchestration : To push changes, you must ensure the environment is configured for deployment.

    • Config Mapping: If a firebase.json file is missing, create one to map the local JSON to the Remote Config service:
      { "remoteconfig": { "template": "remote_config.json" } }
    
    • Deploy: Execute the partial deployment command
      npx -y firebase-tools@latest deploy --only remoteconfig
      
  • Verification: After deployment, verify the update by listing the version history.

    npx -y firebase-tools@latest remoteconfig:versions:list
    

The SDK provides a number of features to make your application dynamic and responsive to user segments.

  • Set In-App Defaults: Define baseline values to ensure the app functions offline or before the first fetch.
  • Fetch and Activate: Retrieve values from the Firebase backend and apply them to the local UI/Logic.
  • Template Management: Use the Firebase CLI to version-control, get, and deploy your config JSON files.

Thêm skills từ firebase

developing-genkit-dart
firebase
SDK AI hợp nhất cho Dart hỗ trợ tạo mã, đầu ra có cấu trúc, công cụ, luồng và tác nhân. Cung cấp API cốt lõi cho việc tạo sinh, định nghĩa công cụ, điều phối luồng, nhúng và phát trực tuyến với một giao diện duy nhất. Bao gồm 8+ plugin cho các nhà cung cấp LLM (Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Giao thức Ngữ cảnh Mô hình, tích hợp trình duyệt Chrome và lưu trữ máy chủ HTTP qua Shelf. CLI tích hợp sẵn với giao diện phát triển cục bộ để thực thi luồng, theo dõi, thử nghiệm mô hình và...
official
developing-genkit-go
firebase
Phát triển ứng dụng AI sử dụng Genkit trong Go. Sử dụng khi người dùng yêu cầu xây dựng tính năng AI, tác nhân, luồng hoặc công cụ trong Go bằng Genkit, hoặc khi làm việc…
official
developing-genkit-js
firebase
Xây dựng ứng dụng Node.js/TypeScript hỗ trợ AI với các luồng, công cụ và hỗ trợ đa mô hình của Genkit. Genkit không phụ thuộc vào nhà cung cấp; hỗ trợ Google AI, OpenAI, Anthropic, Ollama và các nhà cung cấp LLM khác thông qua plugin. Xác định luồng với lược đồ an toàn kiểu dữ liệu sử dụng Zod, thực thi các yêu cầu sinh và soạn thảo quy trình AI đa bước trong TypeScript. Yêu cầu Genkit CLI v1.29.0+; các thay đổi API lớn gần đây có nghĩa là bạn phải tham khảo tài liệu genkit:read và common-errors.md để biết các mẫu hiện tại, không dựa vào kiến thức trước đó...
official
developing-genkit-python
firebase
Phát triển ứng dụng hỗ trợ AI bằng Genkit trong Python. Sử dụng khi người dùng hỏi về Genkit, tác nhân AI, luồng hoặc công cụ trong Python, hoặc khi gặp Genkit…
official
firebase-ai-logic
firebase
Tích hợp Gemini phía máy khách cho ứng dụng web với suy luận đa phương thức, phát trực tuyến và thực thi kết hợp trên thiết bị. Hỗ trợ đầu vào chỉ văn bản và đa phương thức (hình ảnh, âm thanh, video, PDF); các tệp trên 20 MB được định tuyến qua Cloud Storage. Bao gồm các phiên trò chuyện với lịch sử tự động, phản hồi phát trực tuyến để hiển thị thời gian thực và thực thi đầu ra JSON có cấu trúc. Cung cấp suy luận kết hợp trên thiết bị qua Gemini Nano trong Chrome, với khả năng dự phòng tự động lên đám mây. Yêu cầu App Check cho môi trường sản xuất...
official
firebase-ai-logic-basics
firebase
Kỹ năng chính thức để tích hợp Firebase AI Logic (Gemini API) vào ứng dụng web. Bao gồm thiết lập, suy luận đa phương thức, đầu ra có cấu trúc và bảo mật.
official
firebase-app-hosting-basics
firebase
Triển khai và quản lý ứng dụng web full-stack với Firebase App Hosting sử dụng Next.js, Angular và các framework được hỗ trợ khác. Yêu cầu dự án Firebase ở gói giá Blaze; hỗ trợ quy trình Server-Side Rendering (SSR) và Incremental Static Regeneration (ISR). Triển khai qua cấu hình firebase.json với tệp apphosting.yaml tùy chọn cho thiết lập backend, hoặc kích hoạt triển khai tự động "git push to deploy" thông qua tích hợp GitHub. Bao gồm quản lý bí mật qua lệnh CLI để truy cập an toàn vào các khóa nhạy cảm...
official
firebase-auth-basics
firebase
Thiết lập Firebase Authentication với nhiều nhà cung cấp danh tính và quy tắc truy cập dữ liệu an toàn. Hỗ trợ email/mật khẩu, số điện thoại, ẩn danh, các nhà cung cấp liên kết (Google, Facebook, Twitter, GitHub, Microsoft, Apple) và tích hợp xác thực tùy chỉnh. Mỗi người dùng đã xác thực nhận được một ID duy nhất và token dựa trên JWT (token ID tồn tại ngắn và token làm mới tồn tại lâu) để truy cập các dịch vụ Firebase. Kích hoạt các nhà cung cấp qua CLI cho Google Sign In, ẩn danh và email/mật khẩu; sử dụng Firebase Console...
official