Firebase Remote Config supports server-side configuration using the Firebase Admin Node.js SDK v12.1.0+. This capability empowers you to dynamically manage the behavior and configuration of server-side applications using Remote Config. This includes serverless implementations like Cloud Functions.
Unlike Firebase client SDKs, which fetch a client-specific configuration derived from the Remote Config template, the server-side Remote Config SDK downloads a complete Remote Config template from Firebase. Your server can then evaluate the template with each incoming request and use its own logic to serve a customized response with very low latency. You can use conditions to control and customize responses based on random percentages and client attributes defined in custom signals.
With server-side Remote Config, you can:
You can deploy server-side Remote Config on Cloud Run, Cloud Functions, or self-hosted server environments.
Remote Config in server environments is a Preview release. This means that the functionality might change and the release may receive limited support.
As you use server-side Remote Config, we encourage you to share your feedback with us.
Follow the instructions in Add the Firebase Admin SDK to your server to create a Firebase project, set up a service account, and add the Firebase Admin Node.js SDK to your server.
When you initialize the Admin SDK with no parameters, the SDK uses Google
Application Default
Credentials
and reads options from the GOOGLE_APPLICATION_CREDENTIALS environment
variable. To initialize the SDK and add Remote Config:
import { initializeApp } from "firebase-admin/app";
import { getRemoteConfig } from "firebase-admin/remote-config";
// Initialize Firebase
const firebaseApp = initializeApp();
Identify the variables in your app that you want to dynamically update with Remote Config. Then, consider which variables must be set by default in your application and what their default values should be. This ensures that your application runs successfully even if its connection to the Remote Config backend server is interrupted.
For example, if you are writing a server application that manages a generative AI function, you might set a default model name, prompt preamble, and a generative AI configuration, like the following:
| Parameter name | Description | Type | Default value |
|---|---|---|---|
model_name |
Model API name | String | gemini-2.0-flash |
preamble_prompt
|
Prompt to prepend to the user's query | String | I'm a
developer who
wants to learn
about Firebase and
you are a helpful
assistant who
knows everything
there is to know
about Firebase! |
generation_config
|
Parameters to send to the model | JSON |
{"stopSequences":
["I hope this
helps"],
"temperature":
0.7,
"maxOutputTokens":
512, "topP": 0.1,
"topK": 20} |
After you've determined the parameters you want to use with Remote Config, configure your application to set default values, fetch the server-specific Remote Config template, and use its values. The following steps describe how to configure your Node.js application.
Access and load the template.
// Initialize server-side Remote Config
const rc = getRemoteConfig(firebaseApp);
const template = rc.initServerTemplate();
// Load Remote Config
await template.load();
If you're using Node.js within a Cloud Functions, you
can use the asynchronous getServerTemplate to initialize and load the
template in a single step:
// Initialize server-side Remote Config
const rc = getRemoteConfig(firebaseApp);
const template = await rc.getServerTemplate();
To ensure that your application runs successfully even if its connection to
the Remote Config backend server is interrupted, add default values for
each parameter to your app. To do this, add a defaultConfig inside your
initServerTemplate or getServerTemplate template function:
const template = rc.initServerTemplate({
defaultConfig: {
model_name: "gemini-pro",
generation_config: '{"stopSequences": [], "temperature": 0.7, "maxOutputTokens": 512, "topP": 0.1, "topK": 20}',
preamble_prompt: "I'm a developer who wants to learn about Firebase and you are a helpful assistant who knows everything there is to know about Firebase!"
},
});
// Load Remote Config
await template.load()
After the template loads, use template.evaluate() to import parameters and
values from the template:
// Add template parameters to config
const config = template.evaluate();
Optionally, if you set conditions in your Remote Config template, define and provide the values you want:
randomizationId that you want to use to evaluate your
condition(s) within the template.evaluate() function.For example, you might set a Firebase installation
ID as
the randomizationId, or a user ID, to ensure that each user that
contacts your server is added to the proper randomized group,
version as a custom signal to target specific client versions, and
platform as a custom signal to target client platform.
For more information about conditions, see Condition rule types.
// Add template parameters to `config`. Evaluates the
// template and returns the parameter value assigned to
// the group assigned to the {randomizationId} and version.
const config = template.evaluate({
randomizationId: "2ac93c28-c459-4760-963d-a3974ec26c04",
version: "1.0",
platform: "Android"
});
Next, extract the parameter values you need from
the config constant. Use getters to cast the values from
Remote Config into the expected format. The following types are
supported:
getBooleangetValuegetNumbergetStringFor example, if you are
implementing Vertex AI on your
server
and want to change the model and model parameters, you might want to
configure parameters for model_name and generation_config. Here's an
example of how you could access Remote Config's values:
// Replace defaults with values from Remote Config.
const generationConfig =
JSON.parse(
config.getString('generation_config'));
const is_ai_enabled = config.getBool('is_ai_enabled');
const model = config.getString('model_name');
// Generates a prompt comprised of the Remote Config
// parameter and prepends it to the user prompt
const prompt = `${config.getString('preamble_prompt')} ${req.query.prompt}`;
If your server is long-running, as opposed to a serverless environment,
use setInterval to periodically reload the template to confirm that you're
fetching the most up-to-date template from the Remote Config server.
Next, create a server Remote Config template and configure parameters and values to use in your app.
Here's how to create a server-specific Remote Config template:
In the Firebase console, go to the DevOps & Engagement > Remote Config > Parameters page.
From the Client/Server selector at the top of the page, select Server.
Define Remote Config parameters with the same names and data types as
the parameters that you defined in your app and provide values. These
values will override the defaultConfig you set in Configure your
server application when you fetch and evaluate the
template and assign these values to your variables.
Optionally, set conditions to persistently apply values to a random sample of instances or custom signals you define. For more information about conditions, see Condition rule types.
When you've finished adding parameters, click Publish changes.
Review the changes and click Publish changes again.
If your server application is lightweight and event-driven, you should consider deploying your code using Cloud Functions. For example, say you have an app that includes character dialogue powered by a generative AI API (for example, Google AI or Vertex AI). In this case, you could host your LLM-serving logic in a function that your app calls on-demand.
To work through a solution that uses 2nd gen Cloud Functions with server-side Remote Config, see Use server-side Remote Config with Cloud Functions and Vertex AI.
To learn more about deploying your app with Cloud Functions, see Get started: write, test, and deploy your first functions.
Try out a sample callable function with server-side Remote Config and App Check at Call the Vertex AI Gemini API with Remote Config and App Check.
If you're building a server-rendered web app, App Hosting has support for popular web frameworks.
Otherwise, you might consider Cloud Run. To deploy your server app with Cloud Run, follow the guide at Quickstart: Deploy a Node.js service to Cloud Run.
For more information about the best use cases for Cloud Run and Cloud Functions, refer to Cloud Functions vs. Cloud Run: when to use one over the other.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-12 UTC.