Feature Flags
Experiments

Best 7 free alternatives to LaunchDarkly

A graphic of a bar chart with an arrow pointing upward.

A free feature flag plan can remove a subscription line item. It cannot remove the engineering work required to make release control reliable.

That distinction is the key to comparing free LaunchDarkly alternatives. One vendor gives you a managed cloud allowance with hard limits. Another publishes an open-source control plane that you run yourself. A third bundles feature flags into a broader analytics product and meters the events or requests around them. All 3 can honestly say “free,” but they create very different costs, risks, and upgrade paths.

This guide compares 7 options that offer a permanent $0 path rather than a time-limited trial: GrowthBook, Unleash, Flagsmith, ConfigCat, DevCycle, PostHog, and Flipt. GrowthBook is the best overall choice when feature flags need to lead into trustworthy A/B testing. ConfigCat and DevCycle are strong managed choices for small flag workloads. Unleash, Flagsmith, and Flipt are better fits when open-source deployment control matters. PostHog makes sense when flags belong inside a broader product analytics stack.

The ranking gives the most weight to what you can run at $0, how the SDK behaves in production, whether you can measure impact, and what happens when the free boundary is crossed. Plan limits and prices change, so verify the linked pricing pages against your own workload before committing.

Free LaunchDarkly alternatives at a glance

Before choosing a free plan, capture one week of real topology data: SDK processes, client identities, configuration downloads, flag requests, experiment exposures, events, environments, and collaborators. Project that workload at twelve and twenty-four months, then apply the vendor's actual meter. A plan with many included users may still be constrained by connections; a plan with unlimited evaluations may meter configuration traffic; an open-source edition may move the bill into hosting and on-call work. Also price the capabilities that appear only after the pilot, including SSO, approvals, audit export, support, data retention, and additional projects. This exercise turns “free” from a marketing label into a bounded engineering assumption. It also reveals when keeping LaunchDarkly's own free Developer tier is more rational than migrating, and when GrowthBook's traffic-independent core pricing or a self-hosted specialist creates a cleaner long-term path.

AlternativeFree pathBest forMain free-tier constraint
GrowthBookFree cloud Starter and open-source self-hostingFlags plus rigorous experimentationCloud workspace is limited to 3 users and 1 project
UnleashAGPL-licensed self-hosted platformOpen-source feature management specialistsYour team owns hosting; advanced enterprise controls are paid
FlagsmithFree managed plan and open-source self-hostingFlags and remote configurationManaged free plan has 1 team member and 50,000 requests per month
ConfigCatForever Free managed planSimple hosted flags with generous config downloads10 flags, 2 environments, and 2 products
DevCycleFree managed planDeveloper workflow and OpenFeature adoption1,000 client-side MAU plus request and event allowances
PostHogMonthly free usage across flags and analyticsProduct teams consolidating analytics and flags1 project and usage meters after 1 million flag requests
FliptFree open-source self-hostingGit-native flag operationsNo free managed service; your team runs the platform

These tools are alternatives, not identical replacements. LaunchDarkly remains a mature managed platform for enterprise feature management, release governance, and observability. Its current Developer plan and usage meters can also be enough for evaluation or a small workload. The point of evaluating alternatives is to find a better operating model, not to assume every team should leave the incumbent.

What “free” should mean in a production evaluation

A free hosted allowance

A hosted free plan minimizes setup. The vendor operates the control plane, distributes configuration, maintains the dashboard, and usually offers community support. Your application still needs safe defaults, SDK initialization, fallback behavior, targeting tests, and flag cleanup.

Hosted allowances are easy to compare incorrectly. Some vendors meter monthly active users. Others meter configuration downloads, server requests, client requests, events, projects, environments, or team members. Translate every allowance into your architecture. A serverless function that initializes an SDK on every invocation can consume a request-based plan differently from a long-running service with a cached configuration.

Free open-source software

An open-source edition can remove the subscription and give you control over deployment, storage, network paths, and upgrades. Check the actual license and required components. The Open Source Definition is a useful baseline, but a production decision also depends on which governance and security features remain in the open edition.

Self-hosting is not a zero-cost managed plan. Budget for compute, database storage, high availability, monitoring, backups, upgrades, vulnerability response, identity integration, and an on-call owner. A narrow internal flag service can be inexpensive. A highly available global release-control system is infrastructure.

Free enough to complete the workflow

A free plan is useful only when it lets you test the workflow you intend to adopt. At minimum, create a flag, integrate an SDK, target a cohort, ramp exposure, observe evaluation behavior, turn the flag off, and inspect the change history.

If experimentation matters, “free flags” are not enough. You also need stable randomization, exposure logging, governed metrics, quality checks, uncertainty estimates, and a decision rule. A tool can assign 2 variants without providing an experimentation system.

1. GrowthBook: Best free overall alternative

Best for

GrowthBook is the best free LaunchDarkly alternative for product, engineering, and data teams that want feature flags to support both safe delivery and trustworthy measurement. It is particularly strong when your warehouse already contains the metrics used to evaluate product changes.

Key strengths

GrowthBook Feature Flags supports Boolean, string, number, and JSON values, targeted rules, percentage rollouts, prerequisites, environments, SDKs, APIs, and kill switches. SDKs commonly evaluate locally after loading configuration, so normal flag checks do not require a blocking network call to the control plane.

The main advantage over a free flag-only service is the measurement layer. A flag can become an experiment, and the same assignment can be analyzed through GrowthBook Experimentation. Teams can use Bayesian or frequentist analysis, sequential testing, CUPED variance reduction, guardrails, dimensions, holdouts, and sample ratio mismatch checks as their program matures.

GrowthBook is also open source. The GrowthBook repository exposes the core platform and statistics, while cloud and self-hosted deployment options share the same product foundation. That gives a small team a managed starting point without closing off a future self-hosting requirement.

The warehouse-native architecture is most useful when business metrics already live in Snowflake, BigQuery, Databricks, Redshift, or another supported data source. Instead of creating a second set of vendor-specific metrics for experiments, teams can reuse governed definitions and inspect the SQL behind results.

Watchouts

The cloud Starter workspace is intended for a small team. Larger groups, multiple projects, advanced permissioning, approval workflows, managed-warehouse volume, and some advanced statistics or governance needs can require a paid plan. Verify exact packaging before assuming the free pilot maps directly to an enterprise rollout.

GrowthBook also asks more of your measurement discipline than a simple toggle service. You need reliable identifiers, exposure data, and metrics. If your only requirement is turning 5 flags on and off, a narrower hosted service may be quicker.

Pricing and implementation notes

The current GrowthBook pricing page lists a free Cloud Starter plan for up to 3 users and 1 project, with unlimited feature flags, experiments, and core traffic. The managed warehouse has a separate monthly event allowance. The open-source self-hosted edition is free and supports unlimited users, but your organization owns its infrastructure.

Use the free pilot to test one release flag and one experiment. The flag should prove environment separation, targeting, ramping, rollback, and cache behavior. The experiment should prove stable assignment, exposure logging, a warehouse metric, a guardrail, and result interpretation. If you can complete both workflows without building a second analytics path, the platform is solving more than the subscription problem.

2. Unleash: Best open-source flag specialist

Best for

Unleash fits platform and engineering teams that want a substantial open-source feature-management control plane and are willing to operate it. It is a better free choice when release management is the primary job and a full statistical experimentation platform is not required.

Key strengths

The Unleash open-source repository is licensed under AGPL-3.0 and includes activation strategies, variants, segments, environments, tags, audit history, stale-flag insights, APIs, integrations, and SDK support. The architecture synchronizes configuration to SDKs for local evaluation patterns and supports cached state for network interruptions.

Unleash has a clear feature-management center of gravity. Teams can implement gradual rollouts, canary releases, kill switches, targeted releases, and multivariate flags. Its documentation also covers imports and exports, lifecycle management, context, stickiness, and deployment options. That breadth makes it a credible platform rather than a small flag library.

The project participates in the wider standards ecosystem. An application wrapper based on the OpenFeature specification can centralize flag access and reduce direct SDK coupling, although it cannot make vendor-specific targeting and rollout semantics identical.

Watchouts

The $0 path is self-hosted. Your team owns the database, server, upgrades, monitoring, backups, availability, and security. Commercial Unleash plans add managed hosting, service levels, advanced controls, and enterprise support; the official Unleash pricing comparison should be checked if those requirements are likely.

Unleash supports variants, impression data, and impact-oriented capabilities, but buyers should distinguish release measurement from a complete experimentation engine. If you need warehouse metrics, CUPED, sample ratio mismatch diagnostics, multiple-testing controls, or a formal statistical decision workflow, plan an additional analysis layer or choose a platform where experimentation is central.

Pricing and implementation notes

Start by deploying Unleash in a non-production environment and integrating one server SDK plus one client SDK. Test a fresh startup when the control plane is unavailable, recovery after configuration loads, update propagation, fallback values, and a targeted percentage rollout.

Then price the operating model. Include database availability, edge or proxy components, log retention, secrets, identity, and engineering ownership. The open-source license removes a vendor fee, but the proof of concept should estimate the cost of keeping release infrastructure healthy for 2 years.

Compare flag operating models

See how GrowthBook and LaunchDarkly differ on feature delivery, experimentation, warehouse metrics, deployment control, and pricing shape.

Compare the Platforms

3. Flagsmith: Best for remote configuration

Best for

Flagsmith is a strong free option for developers who need feature flags and remote configuration across web, mobile, and server applications. It is attractive when a team wants both a managed free tier and an open-source self-hosted route.

Key strengths

The managed platform supports unlimited feature flags, environments, identities, and segments on its free plan, subject to fair-use and request limits. Flags can carry remote configuration values, which makes the tool useful for changing application behavior or parameters without another deployment.

Flagsmith documents client-side and server-side SDKs, APIs, integrations, OpenFeature compatibility, and self-hosting. The Flagsmith repository provides the open-source deployment path. Teams can begin with the hosted service and use the same general platform concepts if infrastructure control later requires self-hosting.

Flagsmith also supports identity and segment-based targeting. That makes it practical for beta programs, account entitlements, staged SaaS releases, and configuration changes that need more than a Boolean value.

Watchouts

The managed free allowance is built for a small operating group. The live Flagsmith pricing page lists 1 team member and 50,000 requests per month. Collaboration, more included requests, support, scheduled flags, and testing capabilities move into paid packaging.

“Unlimited flags” can therefore be a distracting headline. A real application is more likely to reach the request or collaboration boundary before it reaches a flag-count boundary. Estimate how SDKs fetch configurations, how many environments connect, and how many people must change production rules.

Flagsmith offers A/B and multivariate testing in paid packaging, but teams seeking rigorous product experimentation should verify exposure collection, metric computation, statistical methods, and diagnostic controls. Variant delivery alone does not answer whether a change caused an outcome.

Pricing and implementation notes

The hosted free plan is a practical test bed for one developer. Use it to create Boolean and multivariate flags, target a segment, connect a production-like SDK, and observe request use during normal traffic and deployments. Check whether CI jobs, serverless cold starts, or multiple services consume the allowance faster than expected.

For self-hosting, add the database, deployment, cache, monitoring, backups, and upgrades to the cost model. Compare the open-source feature set with the controls your security and release process require rather than assuming both hosted and self-hosted editions contain the same governance surface.

4. ConfigCat: Best simple managed free plan

Best for

ConfigCat is best for teams that want a managed flag service with a simple free plan, broad SDK coverage, and no need to operate a control plane. It fits small products that can stay within a limited number of flags and environments.

Key strengths

ConfigCat distributes feature configuration as JSON through its CDN. SDKs download and cache that configuration, then evaluate flags from the local cache. The current plan counts configuration downloads rather than every flag evaluation, service connection, or monthly active user. That can be easy to reason about for a small set of applications with controlled polling intervals.

The Forever Free plan currently includes 5 million configuration downloads per month, 20 GB of network traffic, unlimited team members, unlimited service connections, and unlimited MAU. It also includes targeting, percentage options, an API, a webhook, and a short audit-log window.

The SDK list covers common web, mobile, backend, game, and systems languages. Teams that need a hosted Boolean or remote-configuration service can therefore test their actual stack without first building infrastructure.

Watchouts

The free plan is capped at 10 feature flags, 2 environments, and 2 products. It also limits segments, targeting rules, percentage options, permission groups, and audit-log retention. Those boundaries can matter before traffic does.

ConfigCat is a feature-management specialist, not a complete experimentation platform. Percentage targeting can create treatment groups, but a trustworthy A/B test still needs exposure data, metrics, quality checks, and statistical analysis elsewhere. If experimentation is part of the selection criteria, include that second system in cost and workflow comparisons.

ConfigCat is proprietary managed software. Dedicated or on-premises packaging exists at higher tiers, but the Forever Free plan is not an open-source self-hosting path.

Pricing and implementation notes

ConfigCat's free allowance is generous for configuration distribution and narrow in flag inventory. Inventory your current flags before migrating. Separate active release flags from stale flags and long-lived entitlements; otherwise, technical debt can make a 10-flag plan look smaller than it really is.

During the pilot, tune refresh intervals and simulate a CDN or network interruption. Confirm the SDK uses cached values as expected, that defaults are safe during first initialization, and that sensitive targeting data stays in an appropriate evaluation context. If the pilot needs more environments or fine-grained permissions, model the paid tier now rather than after integration.

5. DevCycle: Best for OpenFeature-first teams

Best for

DevCycle is a strong free managed choice for developers who want OpenFeature-native integration, unlimited seats, and experimentation available in the same product. It works well for a small application whose client-side audience and configuration traffic fit the published allowance.

Key strengths

DevCycle focuses on feature flags throughout the development workflow. Its documentation covers reusable targeting, scheduled releases, real-time updates, debugging, schemas, integrations, permissions, audit logs, and A/B testing. Native OpenFeature integrations help teams put a standard interface between application code and the provider.

The DevCycle free plan currently includes unlimited seats and flags, core integrations, debugging tools, A/B testing, an MCP server, and flag and property schemas. That is an unusually broad collaboration surface for a free managed plan.

DevCycle's public OpenFeature SDK repositories also make it possible to inspect integration code and providers even though the managed control plane is not an open-source platform. This is useful for teams that care about application-level portability but do not want to run the service.

Watchouts

The free plan has several workload meters: 1,000 client-side MAU, 10,000 cloud configuration requests, 100,000 server configuration requests, and 5,000 events per month. A mobile or consumer application may hit the client allowance quickly, while a backend service may care more about configuration patterns.

OpenFeature reduces code-level coupling, but it does not make targeting models, bucketing algorithms, experiment histories, or governance portable. A future provider change still requires semantic tests and likely a configuration migration.

The step from free to the published Business tier is material for a small team. If role-based access control, SSO, SCIM, event relays, larger allowances, or support are foreseeable, model that tier against the alternatives during the initial evaluation.

Pricing and implementation notes

Build the pilot through an OpenFeature provider rather than calling a vendor SDK throughout the codebase. Centralize defaults, user-context mapping, logging, and error handling in one wrapper. Then create contract tests for Boolean, string, numeric, and JSON values plus percentage rollouts.

Watch the usage dashboard during a realistic load test. A free plan is only a fit if the application's initialization and polling behavior match the plan's meters. Include expected growth and the Business-tier floor in a 24-month cost model.

6. PostHog: Best all-in-one product stack

Best for

PostHog fits product teams that want feature flags, experiments, product analytics, session replay, surveys, and related tools in one managed platform. The free plan is compelling when consolidation is more important than specialized release governance.

Key strengths

PostHog connects flags to the event and analytics data already captured in the platform. A product team can target a release, run an experiment, inspect funnels or cohorts, and review session replays without integrating several vendors.

The current PostHog pricing page includes 1 million feature-flag requests per month for free, with experiments billed through feature-flag usage. It also offers separate monthly free allowances for analytics events, replays, surveys, warehouse rows, and other products. The free workspace includes unlimited team members, 1 project, community support, and 1 year of data retention.

PostHog publishes much of its code in the PostHog repository. Teams should review the current license and self-hosting guidance for the exact product components they need rather than treating “open source” as one uniform deployment promise.

Watchouts

Feature management is one product inside a broad analytics platform. Large engineering organizations may find the release-governance, approval, lifecycle, and environment model less specialized than a platform designed primarily around flags.

The free tier is usage-based. Product analytics events and flag requests can both grow with traffic, so consolidation can create several meters inside one bill. PostHog lets customers set billing limits, but a hard limit on a runtime feature deserves careful application behavior and alerting.

Your event data also needs to fit PostHog's analytics model. Teams whose governed metrics already live in a warehouse should compare the cost and reconciliation work of sending another event stream with a warehouse-native experiment analysis path.

Pricing and implementation notes

Pilot a flag and experiment using a real product funnel, not a synthetic click. Verify assignment, exposure, event identity, metric filters, and how anonymous and identified users merge. Then estimate requests and analytics events separately at current and projected traffic.

PostHog is strongest when replacing several products creates genuine operational simplicity. If you already trust a warehouse and only need release control, the bundle may be more surface than you need.

7. Flipt: Best free Git-native option

Best for

Flipt is best for platform teams that want feature flags represented in Git workflows and deployed inside their own infrastructure. It is a strong free choice when pull requests, declarative configuration, and data control matter more than a managed service.

Key strengths

Flipt's open-source edition provides unlimited feature flags, Git-native workflows, an administrative UI with Git synchronization, real-time updates, REST and gRPC APIs, and community support. The Flipt repository includes Docker and local quick starts plus configuration examples for Git-backed storage.

Git becomes the review and history layer. A team can use familiar pull requests, branch protection, code owners, signatures, and CI checks for flag configuration. That model fits infrastructure organizations that already govern changes through GitOps.

Because Flipt is self-hosted, sensitive flag definitions and targeting configuration can remain within the chosen network and storage boundary. The application team also avoids a hosted MAU or request allowance on the core open-source path.

Watchouts

Flipt is primarily feature management. It supports variants and evaluation, but teams that need rigorous experiment analysis must provide exposure collection, metrics, and statistics elsewhere. Add that system to the architecture before calling it a replacement for LaunchDarkly experimentation.

Git-native operation can also trade immediacy for control. Emergency changes need a clear fast path, and the team must test how UI edits, repositories, deployments, and running instances converge. A stale or conflicting configuration is an operational incident, even if Git preserves the history.

The free path is self-hosted. Paid Flipt Pro adds collaboration and managed Git-provider workflows. The current Flipt pricing should be checked if the team expects vendor support or a richer UI-to-pull-request experience.

Pricing and implementation notes

Run Flipt with the same repository protections used for production infrastructure. Create a flag change through Git, promote it across environments, observe propagation, roll it back, and rehearse an emergency kill switch. Confirm that the fastest safe workflow is fast enough for an incident.

Estimate operations separately from authoring. The service, storage, availability, observability, upgrades, and security remain your responsibility even when every seat and evaluation is free.

A free plan still needs production controls

Protect flag changes like code changes

A feature flag can change customer-visible behavior without a deployment. That makes production access a software-delivery permission, not a harmless dashboard role. Decide who may create a flag, edit targeting, change a production value, approve a rollout, and use an emergency kill switch.

The free plans differ sharply here. Some allow many collaborators but only one permission group. Some limit the workspace to one user. Open-source editions may expose the primitives for authentication and audit history while reserving advanced roles or single sign-on for commercial packaging. Do not postpone this review because the pilot team has only 2 engineers. A successful pilot is likely to add product managers, QA, support, data scientists, and more engineering teams.

At minimum, require individual accounts, multi-factor authentication where available, separate development and production environments, a retained change history, and an owner for every production flag. Higher-risk releases should have an approval path even if the free tool cannot enforce it. A repository pull request, ticket, or documented peer review can provide a temporary control during evaluation.

Design for control-plane failure

The flag service will eventually be slow, unreachable, misconfigured, or presented with unexpected context. Write down what the application should do before choosing an SDK. A safe default is specific to the flag: a checkout kill switch may default off, while a migration flag may need to retain the last known value to avoid switching users between incompatible paths.

Test cold start separately from a network interruption after configuration has loaded. Local evaluation and cached values can preserve runtime behavior, but only after the application has a valid payload. Inspect initialization timeouts, bootstrap data, cache persistence, refresh behavior, and what the SDK returns for an unknown or malformed flag.

Also rehearse an operator mistake. Apply a targeting rule that matches the wrong cohort, detect the problem through telemetry, restore the previous configuration, and confirm every running service receives the rollback. The exercise tests the dashboard, audit trail, distribution path, SDK, and incident process together.

Keep experiments valid during migration

If a LaunchDarkly flag currently assigns an experiment, do not migrate it like an ordinary release toggle. Providers can use different hashing inputs, salts, context fields, and allocation behavior. Reassigning users halfway through a test mixes exposures and invalidates the estimate.

Finish the experiment before moving it, preserve assignment explicitly, or start a new experiment after migration. Compare at least 10,000 synthetic identities across the old and new evaluators when continuity matters. Reconcile exposure counts and segment membership, not only the headline percentage.

This is also where flag lifecycle policy matters. Inventory stale flags, permanent entitlements, operational controls, and active experiments before planning the move. The detailed feature flag governance guide covers ownership, lifecycle, observability, and cleanup practices that belong in the platform evaluation.

How to choose without being fooled by the $0 label

Choose the center of gravity first

The 7 options fall into 4 groups:

  • Flags plus experimentation: GrowthBook is the strongest free overall fit when the same rollout should support causal measurement.
  • Open-source feature management: Unleash, Flagsmith, and Flipt provide different balances of control-plane breadth, remote configuration, and Git-native operation.
  • Simple managed flags: ConfigCat is easy to adopt for a small flag inventory; DevCycle offers a broader developer workflow with OpenFeature and testing.
  • Product-suite consolidation: PostHog is compelling when analytics, replay, flags, and experiments should share one event platform.

Do not begin with a 100-row feature checklist. Begin with the job you need the system to own. A platform optimized for product decisions should not be judged only on toggle latency. A flag specialist should not be penalized for omitting an analytics warehouse it never promised to replace.

Build a 24-month workload model

Record the variables that can change the bill:

Cost driverQuestions to answer
PeopleHow many users need to view, edit, approve, or audit flags?
RuntimeHow many client MAU, service instances, config downloads, and evaluations will you generate?
DataHow many experiment, analytics, or exposure events will be stored and processed?
TopologyHow many projects, products, environments, regions, and services are required?
GovernanceWhen do SSO, roles, approvals, audit retention, and support become mandatory?
OperationsWho owns hosting, upgrades, backups, monitoring, incidents, and security reviews?

A free plan can be the correct long-term tier. It can also be a cheap integration followed by an expensive forced upgrade. Price the first paid boundary before you write production code.

Run one production-like proof of concept

Use the same workload on each finalist:

  1. Create a Boolean release flag with a safe default.
  2. Add a string or JSON remote configuration value.
  3. Target an internal account and a reusable segment.
  4. Ramp from 1% to 10% without moving already assigned users unexpectedly.
  5. Disconnect the control plane and confirm cached or fallback behavior.
  6. Roll back the change and inspect the audit history.
  7. Run one experiment with a primary metric and guardrail if the platform supports it.
  8. Archive the flag and confirm the code-cleanup workflow.

Open user discussions can help identify failure modes. A recent product-management thread emphasized cost growth, analytics needs, and the difference between a cheap toggle service and an experimentation platform. Treat community comments as hypotheses, not product truth. Reproduce the concern in your own workload.

Test exit before adoption

Export a project or inspect the management API during the trial. Document flags, types, variations, targeting rules, segments, prerequisites, environments, and audit history. Then recreate a representative configuration outside the platform.

An OpenFeature wrapper can reduce application-code migration, but it cannot preserve every provider's rule semantics or user bucketing. Keep provider-specific contract tests and record the hash or assignment behavior for active experiments.

The best free option depends on what comes after the flag

Choose ConfigCat when you want a simple managed service and can live within a small flag inventory. Choose DevCycle when OpenFeature and developer workflow matter. Choose PostHog when the goal is consolidating flags with product analytics. Choose Unleash, Flagsmith, or Flipt when open-source control is worth the operating responsibility.

GrowthBook is the best overall recommendation because it covers the complete product loop: release with a flag, measure the result with governed metrics, and keep deployment choice through an open-source foundation. Its free cloud plan is useful for a real small-team pilot, not only a demo, and the self-hosted edition provides a credible route when infrastructure control becomes a requirement.

The final decision should still come from a production-like test. Start with GrowthBook for free if flags and experiments belong in the same workflow. For a larger migration, book a demo to review SDKs, data architecture, governance, and rollout sequencing before touching critical flags.

Start with a free flag pilot

Create a GrowthBook workspace, test one production-like rollout, and connect the same flag to an experiment when you are ready to measure impact.

Start the Free Pilot

Table of Contents

Related Articles

See All Articles
Feature Flags
Experiments

Add local feature flags to a React app with TypeScript

Nov 20, 2026
x
min read

A magazine's home page shows two recent issues. The design team wants subscribers to try a shelf with four. All four covers are public, and changing editions while the page is open should update the shelf immediately. That gives you a small React feature with a useful acceptance test. Click from guest to subscriber and back, and count the covers each time.

We'll put the display limit in a typed local flag, evaluate it inside a React component, and leave the choice of edition with the app. The example runs in a client-rendered React app without a GrowthBook account, an SDK key, or a request for flag rules. For the wider workflow, free feature flags for coding agents explains what to ask an agent to implement and how to review the result.

Define what one flag controls

Start with an existing React and TypeScript app, or create a Vite React project for the example. Install both GrowthBook packages so the definitions and the hooks resolve against compatible SDK versions.

npm create vite@latest issue-shelf -- --template react-ts
cd issue-shelf
npm install
npm install @growthbook/growthbook@^2.2.0 @growthbook/growthbook-react@^2.2.0

Create src/flags.ts. Here the feature value is a number, which lets the component use the same rendering code for either edition. A future change from four covers to three is one edit to the rule.

import type { LocalFeatures } from "@growthbook/growthbook";

export type Edition = "guest" | "subscriber";
type Features = { issueLimit: number };
type Attributes = { id: string; edition: Edition };

declare module "@growthbook/growthbook" {
  interface Register {
    features: Features;
    attributes: Attributes;
  }
}

export const features: LocalFeatures = {
  issueLimit: {
    defaultValue: 2,
    rules: [
      { condition: { edition: "subscriber" }, force: 4 },
    ],
  },
};

A guest falls through to the default of two. A subscriber matches the rule and gets four. This rule applies to every subscriber, so the ID has no effect on the result here. If you later roll the shelf out to a percentage of subscribers, you already have an identity to use for repeatable assignment.

The type registration release note explains the version requirement for LocalFeatures. The registration connects the definition, the attributes, and the value returned by the hook. For the TypeScript mechanics, see Jeremy Dorn's Register pattern walkthrough.

Put the current reader above the shelf

Replace src/App.tsx with the component below. The edition switch is a local fixture so anyone reviewing the change can reproduce both states. In an existing app, take those two values from the active reader in your session layer.

import { useMemo, useState } from "react";
import { GrowthBook, GrowthBookProvider } from "@growthbook/growthbook-react";
import { features, type Edition } from "./flags";
import { IssueShelf } from "./IssueShelf";

export default function App() {
  const readerId = "reader-17";
  const [edition, setEdition] = useState<Edition>("guest");

  const gb = useMemo(() => new GrowthBook({
    attributes: { id: readerId, edition },
    defaultHashVersion: 2,
  }).initSync({ payload: { features } }), [readerId, edition]);

  return (
    <GrowthBookProvider growthbook={gb}>
      <main>
        <h1>Recent issues</h1>
        <p>Current edition: {edition}</p>
        <button onClick={() => setEdition(
          edition === "guest" ? "subscriber" : "guest"
        )}>
          Switch edition
        </button>
        <IssueShelf />
      </main>
    </GrowthBookProvider>
  );
}

The provider receives an instance initialized with the current reader and the checked-in rules. React can render the correct shelf on the first pass for that reader. If the app is still loading a session, decide what should occupy the shelf in the meantime. For this public list a two-cover guest view is reasonable. On a page where a switch would interrupt the reader, wait for the session before mounting the shelf.

Give your agent the React setup

Use the local flags guide to ask for a typed definition, a provider with the current reader, and a test that changes the edition.

Open the Agent Guide

The useMemo dependencies include the ID and the edition. If a reader subscribes while signed in, their ID can stay the same while their edition changes. Depending only on the ID would leave the old SDK instance in place. Passing a fresh object as the dependency on every render would create unnecessary instances. The example uses the two primitive values the rule setup actually needs.

Read the numeric flag where React renders the list

Create src/IssueShelf.tsx. Keep one stable ID per issue and let the component use the resolved value to select how many items to render.

import { useFeatureValue } from "@growthbook/growthbook-react";

const issues = [
  { id: "nov", title: "November · Print shops" },
  { id: "oct", title: "October · Bookbinders" },
  { id: "sep", title: "September · Type designers" },
  { id: "aug", title: "August · Paper mills" },
];

export function IssueShelf() {
  const limit = useFeatureValue("issueLimit", 2);

  return (
    <ul aria-label="Recent magazine issues">
      {issues.slice(0, limit).map(issue => (
        <li key={issue.id}>{issue.title}</li>
      ))}
    </ul>
  );
}

Keep the hook at the top of the component, inside the provider's subtree. The React SDK supplies the flag value through that provider. Calling a hook inside a click handler or inside the list loop would break the Rules of Hooks. Use the returned number in ordinary render logic.

There are two places you can see the number two in this implementation. The definition's defaultValue is what an ordinary guest gets through evaluation. The 2 passed to the hook is a fallback for a value the SDK can't supply. Giving them the same value makes the basic shelf a sensible fallback, but checking only the guest case would let a broken provider arrangement or missing definition go unnoticed. The subscriber case proves that the component actually received the rule.

The list keys identify magazine issues. Keep those keys independent of the flag. Switching from two covers to four should preserve the identity of the first two rows. There's also no need to remount the whole app with an edition-specific key. React preserves state according to component position and keys. For example, a search input outside the shelf shouldn't lose its text because someone subscribed.

Check the transition in both directions

Use the template's build script to type-check and bundle the app. Once that passes, start the dev server and open the local address it prints.

npm run build
npm run dev

On first load, the page says guest and lists November and October. Click Switch edition. The same page should say subscriber and add September and August. Click again. The list should return to the original two issues, in order. This last check catches code that appends more results on upgrade and never removes them on downgrade.

For a compile-time check, temporarily replace the numeric fallback with the string "2". Run the build again and inspect the error on the hook call. Then restore 2 and rebuild. If the string compiles, check that src/flags.ts belongs to the same TypeScript project as the component and that the package manager resolved compatible core and React versions.

npm ls @growthbook/growthbook @growthbook/growthbook-react

Look for the core package used by your app and by the wrapper. If the app has several incompatible installations, align the versions before diagnosing the JSX. A team using an existing build script should also confirm it actually runs the TypeScript checker.

Hand off a React change someone can review

Give your coding agent the one-shot local feature flags guide and a short description of the observable behavior. For this shelf, the request can be as specific as the test.

Show two public issues to guests and four to subscribers.
Keep the same reader ID when switching editions in the test.
Report the initial titles, the titles after upgrading, and the titles
after switching back. Include the type-check command you ran.

The shelf controls how many public titles to display. If your actual feature unlocks paid articles, enforce access when the server serves an article. A client-rendered flag only decides what to show in that browser. Whenever a change to the display limit can wait for a deployment, the small local file keeps the decision reviewable alongside the component. When an editor needs to change it between issues without an engineering release, compare the free GrowthBook options for managing flag rules.

Manage the shelf in GrowthBook

Start a GrowthBook workspace when your magazine team is ready to manage shelf rules between deployments.

Get Started with GrowthBook
Feature Flags
Experiments

Use local feature flags per request in Node.js

Nov 20, 2026
x
min read

Two customers download the same weekly report. One has agreed to preview a new CSV column. The other feeds the old two-column format into an importer. Both requests can land on the same Node.js process, and each needs the right file even if the other request arrives while the report is loading.

This tutorial builds that endpoint with one checked-in feature flag. The process loads the rules once. Each request supplies its own workspace attributes and receives its own evaluation. You can run the whole example on your machine without an account, a client key, or a flag server. The free feature flags for coding agents walkthrough introduces the local approach. Here we'll give the agent a server-specific test to pass.

Set up a small TypeScript service

Use Node.js 22 or newer for this example. In an empty directory, create an npm project that uses ES modules, install the core SDK, and add the TypeScript tools.

npm init -y
npm pkg set type=module
npm install @growthbook/growthbook@^2.2.0
npm install -D typescript tsx @types/node@22

Create tsconfig.json at the project root. The sample runs TypeScript directly with tsx and checks types in a separate step. Type checking with tsx explains why the two commands serve different purposes.

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "strict": true,
    "noEmit": true,
    "skipLibCheck": true,
    "types": ["node"]
  },
  "include": ["*.ts"]
}

The following files all live next to that configuration. The server imports ./flags.js even though the source file is flags.ts. That spelling follows TypeScript's Node.js module resolution for ESM and works with this runner.

Define the report contract in one flag

Create flags.ts. The public format has two columns. The sample preview workspace gets one additional column. The only targeting attribute the rule needs today is reportPreview. Carry the workspace ID too, so two people downloading a report on behalf of the same workspace can share an assignment if you introduce a percentage rollout later.

import type { LocalFeatures } from "@growthbook/growthbook";

type Features = { includeUniqueReaders: boolean };
export type Workspace = { workspaceId: string; reportPreview: boolean };

declare module "@growthbook/growthbook" {
  interface Register {
    features: Features;
    attributes: Workspace;
  }
}

export const features: LocalFeatures = {
  includeUniqueReaders: {
    defaultValue: false,
    rules: [{ condition: { reportPreview: true }, force: true }],
  },
};

The SDK type registration update covers this rule syntax and the 2.2.0 minimum. If you misspell reportPreview in a condition or use a string where the boolean flag expects a value, TypeScript can point at the definition. The Register pattern also makes the same feature name available in other modules without threading a generic type through each handler.

Before you add the endpoint, decide what belongs to the process and what belongs to the request. The feature definitions are identical for both customers. Their identity and preview enrollment can differ. If a handler changes an attribute on a single shared user instance before awaiting a database query, another handler could replace that attribute before the first handler resumes.

Give your agent a server-side task

Use the one-shot guide to add checked-in rules. Ask your agent to keep workspace attributes local to each request and demonstrate both CSV formats.

Open the Local Flags Guide

Create a scope when the request arrives

Create server.ts. The Node.js SDK provides GrowthBookClient for the process and createScopedInstance for the current request. The two fixture paths below stand in for two authenticated workspaces. The server binds to the loopback address so you can exercise it locally.

import { createServer } from "node:http";
import { setTimeout as delay } from "node:timers/promises";
import { GrowthBookClient } from "@growthbook/growthbook";
import { features, type Workspace } from "./flags.js";

const client = new GrowthBookClient({ defaultHashVersion: 2 })
  .initSync({ payload: { features } });

const demos = new Map<string, Workspace>([
  ["/demo/preview", { workspaceId: "press-a", reportPreview: true }],
  ["/demo/standard", { workspaceId: "press-b", reportPreview: false }],
]);

createServer(async (req, res) => {
  const workspace = demos.get(req.url ?? "");
  if (req.method !== "GET" || !workspace) {
    res.writeHead(404).end();
    return;
  }

  const gb = client.createScopedInstance({ attributes: workspace });
  await delay(10); // Stand-in for loading this workspace's report.
  const expanded = gb.isOn("includeUniqueReaders");
  const csv = expanded
    ? "period,downloads,unique_readers\nweek-1,80,55\n"
    : "period,downloads\nweek-1,80\n";

  res.writeHead(200, {
    "Content-Type": "text/csv; charset=utf-8",
    "Cache-Control": "private, no-store",
  });
  res.end(csv);
}).listen(4178, "127.0.0.1", () => {
  console.log("Report server listening on http://127.0.0.1:4178");
});

The HTTP handler looks up a workspace, creates its scope, and holds that scope across an asynchronous operation. The short promise-based timer gives a second request time to arrive. In a real export, that's where the database or storage read would happen. Keep the stable client at module scope and the scoped instance inside the handler. If a formatter needs the decision, pass it the boolean or the scoped instance.

In production, resolve the workspace and its access rights from the authenticated session before reading the report. The two selectable paths here are fixtures for public sample data. A caller's choice of a header, query string, or workspace slug can't establish permission to read another customer's report. The endpoint also prevents shared response caching. If you cache real exports, the cache needs to distinguish the workspace and the report format, along with any other inputs that change the response.

Test two requests that overlap

In the first terminal, type-check the service and start it. A successful type check exits quietly. The next command prints the loopback address and keeps the server running.

npx tsc --noEmit
npx tsx server.ts

Save the following as verify.mjs. In a second terminal, run node verify.mjs. Node's built-in fetch calls the local server. Strict assertions compare the full header and data row, including where each row ends.

import assert from "node:assert/strict";

async function report(name) {
  const response = await fetch("http://127.0.0.1:4178/demo/" + name);
  assert.equal(response.status, 200);
  return response.text();
}

const [preview, standard, previewAgain] = await Promise.all([
  report("preview"), report("standard"), report("preview"),
]);

assert.equal(preview, "period,downloads,unique_readers\nweek-1,80,55\n");
assert.equal(standard, "period,downloads\nweek-1,80\n");
assert.equal(previewAgain, preview);
console.log("Both workspaces received the expected CSV.");

You should see the single success line. Testing just the preview workspace proves that the code can add a column. Testing both responses catches the more expensive mistake of silently changing an existing customer's export. Keeping the old format assertion around is especially valuable when the downstream importer belongs to someone outside your team.

To check the compile-time boundary, temporarily change gb.isOn("includeUniqueReaders") to gb.isOn("includeUniqueReader") and rerun npx tsc --noEmit. The diagnostic should identify the misspelled key. Restore it before running the server again. A coding agent can include the before-and-after type check and the two CSV headers in its pull request.

Decide when to expand the report

When one preview customer is ready, leave everyone else on the default. If the next step is to enroll a fraction of workspaces, choose an attribute that matches the promise you're making. Hashing a workspace ID lets colleagues downloading the same report share a format. Hashing each user's ID could give two analysts in the same company different column sets. The one-shot guide shows how to express a percentage and hash attribute in a local rule.

A new rule in flags.ts reaches a process through your deployment. During a rolling deploy, the same workspace might hit old and new processes. If customers need a durable choice of export schema, keep supporting the agreed format in the API itself. When the operational requirement is to change targeting between deploys, you can keep the scoped evaluation in the handler and change how the process receives its rules. The free GrowthBook offerings overview covers Cloud Starter and self-hosting for teams that want to manage those rules.

Manage report targeting in Cloud

Create a GrowthBook workspace when the team supporting exports needs to expand the preview independently of a server release.

Get Started with GrowthBook
Feature Flags
Experiments

Use local feature flags in the Next.js App Router

Nov 20, 2026
x
min read

Your conference agenda has a new “Show room” button. Reviewers should see it on the first page load. Everyone else should get the existing agenda. If a Server Component renders the old agenda and a browser hook independently decides to show the new button, the first HTML and the browser can disagree.

In the Next.js App Router, the server can make this decision once and pass a boolean to the interactive component. We'll define the flag in the repo, select the preview audience with a local test cookie, and verify the actual HTML for both visitors. Clicking the button will still work after hydration. You can follow along without a GrowthBook account or client key. If you're assigning this work to an agent, the free feature flags for coding agents walkthrough gives the background.

Keep the flag definitions on the server

Use a TypeScript App Router project, or create a small one with create-next-app. These paths assume the project has an app directory at its root. If yours uses src/app, put both app and lib under src so the relative imports still match.

npx create-next-app@latest agenda-flags --ts --app --empty --use-npm --no-src-dir --no-tailwind --yes
cd agenda-flags
npm install @growthbook/growthbook@^2.2.0 server-only

Keep the starter's root layout. Create lib/agenda-flags.ts with the following code. The SDK type registration update explains how LocalFeatures checks the flag and its rule against the registered types. This setup requires version 2.2.0 or later.

import "server-only";
import { GrowthBookClient, type LocalFeatures } from "@growthbook/growthbook";

type Features = { agendaRoomDetails: boolean };
type Attributes = { audience: "preview" | "public" };

declare module "@growthbook/growthbook" {
  interface Register {
    features: Features;
    attributes: Attributes;
  }
}

const features: LocalFeatures = {
  agendaRoomDetails: {
    defaultValue: false,
    rules: [{ condition: { audience: "preview" }, force: true }],
  },
};

const client = new GrowthBookClient({ defaultHashVersion: 2 })
  .initSync({ payload: { features } });

export function showRoomDetails(audience: Attributes["audience"]) {
  const gb = client.createScopedInstance({ attributes: { audience } });
  return gb.isOn("agendaRoomDetails");
}

The module can reuse the client and rules across requests handled by the same process. It only holds the current visitor's audience inside the function call. Two requests can therefore use the same flag file and get different results. The Node.js SDK documents the scoped client used under the App Router here.

This particular rule has no percentage and needs no visitor ID. The two audiences are sufficient. If the team later asks for a rollout to 10% of attendees, add a stable attendee or registration ID and choose which of those units should stay together. Jeremy Dorn's Register pattern article explains how a change to an attribute type reaches the call sites that construct it.

Read the cookie for this request

Create app/agenda/page.tsx. The static heading can render for everyone. The request-specific content sits behind a Suspense boundary, so the fallback can show a neutral loading message until the server has the cookie.

import { Suspense } from "react";
import { cookies } from "next/headers";
import { showRoomDetails } from "../../lib/agenda-flags";
import { Agenda } from "./Agenda";

async function AgendaForVisitor() {
  const jar = await cookies();
  const audience = jar.get("agenda-preview")?.value === "1"
    ? "preview"
    : "public";

  return <Agenda showRoom={showRoomDetails(audience)} />;
}

export default function AgendaPage() {
  return (
    <main>
      <h1>Conference agenda</h1>
      <Suspense fallback={<p>Loading the agenda…</p>}>
        <AgendaForVisitor />
      </Suspense>
    </main>
  );
}

The App Router's cookies function reads the incoming request asynchronously. Read it inside the visitor-specific component. Keeping that read out of shared cached code lets the surrounding page reuse common content without treating one visitor's decision as another's. This placement also accommodates App Router projects using Cache Components.

Give your agent the Next.js setup

Use the local flags guide with a concrete request to evaluate one flag on the server and return the same decision to the browser.

Open the Local Flags Guide

The cookie in this demo is a convenient way to preview a public UI treatment. Anyone with that cookie can see the room label. To target paying attendees or private sessions, obtain the audience from the verified session on the server and authorize the underlying data separately.

Pass one decision to the interactive component

Create app/agenda/Agenda.tsx. It's a Client Component because a visitor can open and close the room details. Its initial branch comes directly from the boolean supplied by the page.

"use client";

import { useState } from "react";

export function Agenda({ showRoom }: { showRoom: boolean }) {
  const [open, setOpen] = useState(false);

  return (
    <section data-agenda={showRoom ? "preview" : "standard"}>
      <h2>10:00 · Designing for print</h2>
      {showRoom && (
        <>
          <button aria-expanded={open} onClick={() => setOpen(!open)}>
            {open ? "Hide room" : "Show room"}
          </button>
          {open && <p>Room 204</p>}
        </>
      )}
    </section>
  );
}

The client boundary takes a serializable prop. The component receives true or false. The SDK instance, targeting rules, and cookie handling stay in the server module. You don't need a React provider for this component because its only browser-side choice is whether the visitor has clicked the button.

Follow one page load through server rendering and hydration. For a preview visitor, the server can send a section with a “Show room” button. React's first client render gets the same showRoom value and starts with open set to false. Hydration attaches the click handler. Opening the room detail then updates component state and doesn't require another flag evaluation.

Verify the HTML and the click separately

Build the production app and start it on port 3100.

npm run build
npm run start -- -p 3100

In a second terminal, save this as verify-agenda.mjs in the project root and run node verify-agenda.mjs. The test makes two requests to the same route and looks for a marker on the rendered section. A marker in the HTML helps catch an implementation that only adds the intended layout after JavaScript runs.

import assert from "node:assert/strict";

async function agenda(cookie) {
  const response = await fetch("http://localhost:3100/agenda", {
    headers: cookie ? { Cookie: cookie } : {},
  });
  assert.equal(response.status, 200);
  return response.text();
}

const [standard, preview] = await Promise.all([
  agenda(""), agenda("agenda-preview=1"),
]);
assert.match(standard, /<section data-agenda="standard"/);
assert.doesNotMatch(standard, /<section data-agenda="preview"/);
assert.match(preview, /<section data-agenda="preview"/);
assert.doesNotMatch(preview, /<section data-agenda="standard"/);
console.log("Both agenda layouts arrived in the server HTML.");

Now open http://localhost:3100/agenda in a fresh browser profile. You should see the session title without a room button. In that local page's browser console, set the demo cookie and reload.

document.cookie = "agenda-preview=1; Path=/; SameSite=Lax";
location.reload();

Click Show room and look for Room 204. Click Hide room and the room should disappear. This second check proves the component became interactive. If the server response test passes but the click fails, inspect the browser console for a hydration error before changing the flag rules.

Remove the fixture and reload once more. The button should disappear and the agenda title should remain.

document.cookie = "agenda-preview=; Path=/; Max-Age=0";
location.reload();

The reload is deliberate. Editing the cookie in an already open document doesn't rerun its Server Component. In your app, use the normal session-change flow to request a fresh server render when a visitor signs in, signs out, or leaves a preview group.

Choose where the next flag should be evaluated

For a decision needed in the initial HTML, give the agent an observable requirement. Ask it to show the two HTTP responses, then click the interactive control in the preview. The first check catches an incorrect layout. The second catches correct HTML that never becomes interactive.

If a later feature depends on an action entirely within the browser, evaluate whether its flag belongs in the client tree. The one-shot local flags guide covers both placements. This agenda only needs one server decision. Updating its checked-in rule takes a deployment. Keep that tradeoff in view if the event organizer needs to pause a preview while attendees are already arriving. For that case, compare GrowthBook’s free options for changing flags between deploys.

Manage the agenda rollout in Cloud

Create a GrowthBook workspace when the organizer needs to adjust a preview audience while your Next.js app is serving attendees.

Get Started with GrowthBook

Ready to ship faster?

No credit card required. Start with feature flags, experimentation, and product analytics—free.

Simplified white illustration of a right angle ruler or carpenter's square tool.White checkmark symbol with a scattered pixelated effect around its edges on a transparent background.