Best feature flag tools for developers

The best feature flag tool for developers is not the one with the longest checklist. It is the one that fits how your team ships, measures, debugs, and cleans up production code.
Feature flags start as a simple idea: wrap a code path, turn it on for the right users, and roll it back if something breaks. But once flags become part of daily development, they touch SDKs, CI/CD, observability, product analytics, experimentation, permissions, and technical debt.
This guide compares feature flag tools through a developer lens. It prioritizes SDK quality, local or reliable evaluation patterns, rollout control, experiment support, deployment flexibility, pricing predictability, and how well the tool helps teams avoid flag sprawl.
Quick comparison
Use this table to narrow the shortlist. The right choice depends on which problem matters most: release safety, experimentation, self-hosting, pricing predictability, enterprise governance, or developer workflow.
How developers should evaluate feature flag tools
Feature flags become infrastructure. Evaluate them like infrastructure.
SDK behavior comes first
Before pricing or dashboards, look at the SDK. Developers need to know:
- Does the SDK support your languages and runtime environments?
- Are flag evaluations local, remote, streamed, polled, or proxied?
- What happens if the flag service is unreachable?
- Can defaults be made safe?
- Can engineers simulate flag values locally?
- Can flags be evaluated on the server, client, mobile, and edge where needed?
Poor SDK behavior turns a release-control tool into runtime risk.
Experimentation changes the bar
If a flag can become an A/B test, the tool needs more than targeting. It needs stable assignment, exposure logging, metric definitions, guardrails, and trustworthy analysis.
This is where tools split. Some are release-control platforms first. Some are experimentation platforms with flags. Some are analytics suites with flags. GrowthBook is strongest when your team needs feature flags and experiment analysis connected to warehouse-defined metrics.
Cleanup is part of the product
Developers do not just need to create flags. They need to remove them.
Look for owners, descriptions, tags, code references, lifecycle states, archived flags, stale flag detection, API access, and a team process for deleting old paths. No tool can remove stale code without engineering review, but a good tool can make stale flags visible.
Evaluation architecture affects production behavior
Two tools can both say they support feature flags while behaving very differently in production.
Some SDKs download a config payload, cache it locally, and evaluate flags in-process. Some stream updates from a control plane. Some call a remote service at evaluation time. Some support a proxy, relay, or edge layer between your application and the vendor. The right model depends on where the flag is used.
Server-side flags usually need predictable fallback behavior and low operational surprise. If a checkout service, billing workflow, or onboarding path depends on a flag, developers should understand exactly what value is returned when the SDK starts cold, when the network is unavailable, when cached config is stale, and when targeting attributes are missing.
Client-side and mobile flags have different concerns. Teams need to know which attributes leave the device, how often configs refresh, how much configuration is exposed to the client, and whether a user can inspect variation rules. Mobile teams also care about app-store review cycles: a flag service can change behavior faster than a mobile release, but only if the code path already exists in the shipped app.
Edge and serverless environments add another layer. Developers should test startup cost, cache persistence, request-scoped context, and whether the SDK works naturally in short-lived runtimes. A tool that feels excellent in a long-running Node or Java service may need extra care in an edge worker or serverless function.
This is why a real evaluation should include the runtimes you actually run, not only a sample app.
Permissions, APIs, and workflow matter at scale
The first flag is usually created by an engineer. The hundredth flag may involve engineering, product, data science, support, QA, security, and release management.
At that point, developer fit includes more than SDKs. Look for environment-level permissions, approval workflows, audit logs, service tokens, API coverage, CLI support, webhooks, code references, and integrations with issue trackers and incident tools. A platform team may want templates and naming conventions. A product team may need safe access to targeting rules without access to production secrets. A data team may care about whether exposures and assignments can be reconciled with warehouse events.
This is also where open source and self-hosting change the conversation. A self-hosted tool gives engineering more control over deployment, networking, data residency, and upgrade timing. A managed SaaS tool reduces operational work and may offer stronger enterprise workflows out of the box. Neither model is automatically better. The right choice depends on whether your organization treats feature management as product infrastructure, release tooling, or part of the analytics stack.
Experiment data should be designed, not guessed
Developers often implement the flag. Product and data teams often analyze the outcome. The handoff can break if the tool treats experimentation as an afterthought.
For experiment-ready feature flags, check how the tool handles randomization units, sticky assignment, exposure logging, holdouts, metric windows, guardrails, and segment analysis. Also check whether experiment data can be debugged. If the analysis says a variation won, developers should be able to answer basic questions: who was eligible, who was exposed, when assignment happened, which metric definition was used, and whether the result changed after filtering.
GrowthBook is strong here because the flag and the experiment can live in the same workflow while metrics can come from your warehouse. Statsig and PostHog are also strong when teams want a managed product analytics environment. LaunchDarkly and Harness can be strong when experimentation is part of a broader release platform. Flag-only tools can still work, but you may need to build more of the measurement path yourself.
1. GrowthBook
GrowthBook is the best feature flag tool for developer teams that want release control and product impact measurement in one workflow.
Best for
GrowthBook fits engineering-led product teams that use feature flags to ship safely and want those same flags to power experiments. It is especially strong when your data warehouse is the trusted source of metrics and you do not want to rebuild product metrics inside a separate flag vendor.
The current GrowthBook feature flags page positions flags around targeted rollouts, kill switches, A/B testing, debugging, and AI-native development. The feature flag docs explain the core model: control app behavior without deploying new code, target users, gradually roll out changes, or run A/B tests on client or server.
Key strengths
GrowthBook's main developer advantage is that feature flags are not isolated from experimentation. A flag can control rollout, then become an experiment rule with assignment and measurement attached. The feature flag experiments docs show how teams can use flags for randomized variation assignment and exposure tracking.
The platform is also open source and self-hostable. That matters for teams that want code transparency, deployment control, or a path away from managed SaaS dependency. The same product also exists as GrowthBook Cloud, so teams can start hosted and move self-hosted if requirements change.
Pricing is developer-friendly for high-traffic experimentation programs. The current GrowthBook pricing page lists a free Starter cloud plan with unlimited feature flags and experiments for up to three users, a $40 per-seat Pro plan, and a free self-hosted open-source option with unlimited feature flags, experiments, and traffic.
Watchouts
GrowthBook is strongest when your team has or wants a serious experimentation workflow. If all you need is a small hosted toggle service for a handful of flags, ConfigCat or DevCycle may feel simpler.
Advanced governance, permissioning, and statistics features vary by plan, so larger teams should verify exact requirements before rollout.
Pricing and implementation notes
Start with one flag that could become an experiment. Test SDK integration, targeting, rollback, exposure logging, and metric readout. If the team can move from "who sees this?" to "did it work?" without switching tools, GrowthBook is doing the developer job well.
For developer evaluation, include both a boolean release flag and a feature experiment. The boolean flag tests day-to-day release control: defaults, targeting, environment separation, and rollback. The experiment tests the harder workflow: stable assignment, exposure tracking, metric configuration, result interpretation, and cleanup.
GrowthBook is also worth evaluating with your actual data model. If your company already trusts warehouse tables for activation, retention, revenue, or expansion metrics, connect the proof of concept to those metrics rather than creating a toy event stream. That will show whether the tool fits the way your organization already makes decisions.
2. LaunchDarkly
LaunchDarkly is the strongest feature flag tool for enterprise teams that want mature release control, broad SDK coverage, and advanced governance.
Best for
LaunchDarkly fits larger engineering organizations managing many services, environments, teams, and release workflows. It is built for teams that treat feature management as a production control plane.
The current LaunchDarkly pricing page lists a free Developer plan, Foundation usage pricing, Enterprise, and Guardian tiers. It also exposes platform meters such as service connections, client-side MAU, experimentation MAU, observability usage, and custom enterprise licensing.
Key strengths
LaunchDarkly has a mature feature-management surface: targeting, segments, percentage rollouts, flag types, templates, flag history, flag reviews, environment management, observability, experimentation, and release workflows. The pricing page currently lists 30 idiomatic SDKs in the Developer plan, which is a meaningful developer coverage signal.
It is also strong for enterprise release governance. Teams that need approvals, SSO, SCIM, workflows, release automation, observability, and rollout monitoring will find a deep product.
Watchouts
The primary watchout is cost model complexity. LaunchDarkly's pricing now includes multiple usage dimensions: service connections, client-side MAU, experimentation MAU, observability data, session replays, errors, traces, and logs. That may be perfectly reasonable for a large enterprise, but teams should model total cost before standardizing.
LaunchDarkly is also not an open-source or self-host-first product. If infrastructure control, warehouse-native experimentation, or open-source transparency is central, evaluate GrowthBook, Unleash, Flagsmith, or Flipt.
Pricing and implementation notes
Choose LaunchDarkly when enterprise release control is the main requirement and the budget model fits. For a proof of concept, test approvals, audit history, SDK defaults, rollout monitoring, and flag cleanup, not just flag creation.
A LaunchDarkly proof of concept should also include a usage model. Count services, client-side users, experiment participants, and observability usage separately. This is not busywork. The platform can be a strong enterprise fit, but teams should understand how feature management, experimentation, and observability packaging interact before they make LaunchDarkly the default for every service.
3. Unleash
Unleash is a strong open-source feature management platform for teams that want self-hosting and enterprise governance.
Best for
Unleash fits platform and engineering teams that want to run feature management in their own infrastructure. It is a common shortlist option for teams comparing open-source alternatives to commercial SaaS flag platforms.
The current Unleash pricing page lists a Pay-As-You-Go Enterprise plan at $75 per seat per month, a 14-day trial, and self-hosted or cloud options. It also highlights unlimited feature flags, projects, environments, experiments, A/B/n testing with variants, targeting, segmentation, and SDK coverage in paid packaging.
Key strengths
Unleash has a mature feature-flag model: activation strategies, targeting, variants, stickiness, gradual rollouts, projects, environments, SDKs, import/export, naming conventions, and lifecycle management. It is not just a tiny toggle library.
The self-hosting story is the main draw. Teams that need infrastructure control can operate Unleash themselves and add enterprise capabilities as needed.
Watchouts
Unleash is feature management first. It can support A/B/n testing through variants, but teams that need deep experiment analysis and warehouse-native metrics may need another layer.
The hosted enterprise route is not a permanent free-tier play. It is a paid feature-management platform with an open-source path.
Pricing and implementation notes
Use Unleash when self-hosted feature management matters more than built-in experimentation depth. For a proof of concept, test flag variants, activation strategies, SDK behavior, and stale-flag workflow.
Also test the operating model. Who upgrades Unleash? Who owns backups? Which teams can change production strategies? How are SDK tokens issued and rotated? Self-hosting is valuable when it gives engineering the control the organization actually needs. It is less valuable when nobody has time to operate the control plane responsibly.
4. Flagsmith
Flagsmith is a good developer choice when you want open-source feature flags, remote config, and deployment flexibility.
Best for
Flagsmith fits teams that want a hosted free start, open-source core functionality, and the option to run the platform in their own environment later.
The current Flagsmith pricing page lists a free plan with 50,000 requests per month, one team member, unlimited feature flags, unlimited environments, unlimited identities and segments under fair-use terms, and API access. Paid tiers add more requests, team members, integrations, and governance capabilities.
Key strengths
Flagsmith covers the core developer needs: flags, segments, identities, remote config, multivariate flags, and local evaluation across supported languages. Its open-source page explains the boundary between open-source core functionality and paid enterprise governance.
That boundary is useful. Developers can validate core flagging without committing to enterprise packaging.
Watchouts
The free hosted plan is limited for a real team because it includes one team member. Teams that need collaboration, A/B and MVT testing, and integrations should review paid tiers early.
Experiment analysis is also not the same fit as GrowthBook. Flagsmith can support experiment assignment, but teams may need external analytics for deeper readouts.
Pricing and implementation notes
Flagsmith is worth trying when open-source control and deployment flexibility matter. Test cloud first if speed matters, then validate self-hosting before making it a production dependency.
For a deeper evaluation, test remote config alongside boolean flags. Many teams adopt a feature flag platform for rollouts and then discover they also need pricing-copy changes, threshold tuning, model-selection settings, or plan-specific configuration. Flagsmith's remote config model is useful when those values should be managed outside deploys, but the same discipline applies: owners, review, and cleanup still matter.
5. ConfigCat
ConfigCat is a simple hosted feature flag service with a clear free plan and a pricing model developers can understand.
Best for
ConfigCat fits small and mid-sized developer teams that want feature flags without adopting a broad experimentation or product analytics platform.
The current ConfigCat pricing page lists a Forever Free plan with 5 million config JSON downloads per month, 20 GB network traffic, 10 feature flags, two environments, two products, two segments, and four targeting rules per flag.
Key strengths
ConfigCat's pricing model is refreshingly concrete. It counts config JSON downloads from its CDN rather than every flag read or user context. The pricing page explains that SDKs download and cache config locally, and feature flags are evaluated from local cache.
For developers, that makes the runtime model easier to reason about. ConfigCat also has broad SDK coverage and integrations with tools like GitHub, GitLab, Jira, Datadog, Amplitude, Mixpanel, and others.
Watchouts
The free tier's 10-flag limit is real. If flags become central to your release process, you will likely move to a paid plan or need strict cleanup.
ConfigCat is also not a full experimentation platform. If you want flags, A/B testing, product analytics, and warehouse-native metrics together, GrowthBook is a better fit.
Pricing and implementation notes
Choose ConfigCat when you want a hosted flag service that is easy to start and forecast. For a proof of concept, test SDK caching, config update timing, targeting, rollback, and flag cleanup.
ConfigCat is a particularly good fit when developers want a narrow tool with a straightforward runtime model. The tradeoff is that teams need a separate analytics or experimentation workflow if they want to measure product impact. That can be fine for release toggles, permission checks, and operational settings. It becomes less attractive when every meaningful flag eventually asks a product question.
6. DevCycle
DevCycle is a developer-friendly feature flag platform with a generous free plan and strong OpenFeature alignment.
Best for
DevCycle fits teams that want modern hosted feature flagging with a low-friction developer experience. It is especially relevant when OpenFeature support matters.
Current DevCycle pricing lists a free plan with unlimited seats, unlimited flags, integrations, debugging tools, A/B testing, MCP Server, schemas, 1,000 client-side MAUs, 10,000 cloud config requests, 100,000 server config requests, and 5,000 events per month. The page also notes DevCycle is now part of Dynatrace.
Key strengths
The free plan is strong for developer evaluation because unlimited seats and flags reduce coordination friction. DevCycle also includes debugging tools, schemas, REST API, CLI, targeting, segmentation, percentage rollouts, and OpenFeature support across SDKs.
That makes it a good choice for teams that want a managed developer workflow without enterprise procurement at the start.
Watchouts
The free usage limits matter quickly in production. Client-side MAUs, cloud config requests, server config requests, and events all need modeling.
Dynatrace ownership may be positive for observability-oriented teams, but buyers should ask roadmap and packaging questions before long-term standardization.
Pricing and implementation notes
DevCycle is worth trying when hosted developer experience and OpenFeature matter. Run both client-side and server-side tests because those paths hit different meters.
7. Statsig
Statsig is a strong managed platform for teams that want feature gates, dynamic configs, experimentation, analytics, and product-development workflows in one place.
Best for
Statsig fits teams that want more than flags. It is a product-development platform with feature gates, dynamic configs, experiments, analytics, session replay, and observability-style surfaces.
Current Statsig pricing lists a free Developer tier with access to feature gates, dynamic configs, experimentation, and analytics, plus 2 million metered events per month. Paid tiers add event volume and enterprise packaging.
Key strengths
Statsig is strong when flags and experimentation should live in the same managed product suite. Developers can use gates and configs while product and data teams analyze experiments and product metrics in the same ecosystem.
The free tier is meaningful for small teams and pilots. It lets developers validate gates, configs, and experiments without starting with a custom contract.
Watchouts
Statsig is not open source or self-host-first. Teams that want infrastructure control or warehouse-native analysis as the default should compare GrowthBook carefully.
The event-based meter is also important. Feature flag checks may not be the only cost driver. Product analytics and experimentation volume can change the cost model.
Pricing and implementation notes
Use Statsig when a managed feature gate plus experimentation platform is the goal. For a proof of concept, include a gate, config, experiment, and event-volume forecast.
8. PostHog
PostHog is a good fit for developers who want feature flags as part of a broader product analytics platform.
Best for
PostHog fits startups and product teams that want event analytics, replays, feature flags, experiments, surveys, and debugging tools in one developer-friendly suite.
Current PostHog pricing lists free monthly allowances including analytics events, session recordings, feature flag requests, and experiments billed with feature flags.
Key strengths
The strength is context. A flag rollout can be connected to product events, funnels, replays, cohorts, and experiment readouts inside the same platform. That can be useful when a small team wants to understand behavior, not only control release.
PostHog also has open-source roots and a transparent usage-based pricing model, which many developer teams appreciate.
Watchouts
PostHog's breadth can make pricing harder to forecast as more products are adopted. Events, recordings, flag requests, surveys, and other usage can all matter.
If the company's trusted metrics live in the warehouse, teams should decide whether PostHog should become another source of product truth or whether flags should connect to warehouse-native analysis through a platform like GrowthBook.
Pricing and implementation notes
Use PostHog when product analytics and qualitative debugging are central. For a feature flag proof of concept, pair the flag with a funnel and one session-replay investigation.
9. Harness Feature Management & Experimentation
Harness Feature Management & Experimentation, built from the Split.io acquisition, is a strong fit for enterprises that want feature flags inside a broader software delivery platform.
Best for
Harness fits teams already using or evaluating the Harness ecosystem for CI/CD, governance, and software delivery. It is less of a lightweight standalone developer tool and more of an enterprise platform module.
Harness's Feature Management & Experimentation product page describes feature flags, targeting, release monitoring, and experimentation. The Harness plans documentation lists Free, Team, and Enterprise plans for Feature Flags, including a free plan with up to two developers, 25,000 client monthly active users, and unlimited feature flags and environments.
Key strengths
Harness is strong when flags should connect to delivery pipelines, GitOps, automations, monitoring, Jira issues, and enterprise engineering workflows. The feature management docs describe feature flag metadata, owners, tags, deterministic treatment assignment, and targeting.
That makes it relevant for engineering organizations that want release control embedded in software delivery governance.
Watchouts
Harness may be more platform than a small team needs. If you only want feature flags and experiments, the broader Harness ecosystem can feel heavy.
Pricing and packaging should be checked carefully because Harness's pricing pages span many modules. Validate the feature flag and experimentation limits directly with Harness before committing.
Pricing and implementation notes
Use Harness when feature flags belong inside a larger delivery platform. For a proof of concept, test flag creation, targeting, deterministic assignment, CI/CD integration, monitoring, and developer access controls.
10. Flipt
Flipt is a good open-source option for developer teams that want Git-native feature flag management.
Best for
Flipt fits teams that want flag state to live close to source control. It is especially attractive for teams already using GitOps practices and review-based infrastructure workflows.
The Flipt website lists an open-source edition that is free forever with unlimited feature flags, Git-native workflows, UI with Git sync, real-time updates, REST and gRPC APIs, and community support.
Key strengths
The differentiator is Git-native control. Feature flag changes can become reviewable commits, which is attractive to developers who dislike production behavior being changed only through a SaaS UI.
Flipt is also lighter than broader platforms. If your team wants a self-hosted control plane rather than analytics, experimentation, and enterprise governance bundled together, it is worth evaluating.
Watchouts
Flipt requires operational ownership. You need to deploy it, integrate it, manage workflows, and decide how non-engineering stakeholders participate.
It is also not the strongest option if the main need is experiment analysis or product metrics.
Pricing and implementation notes
Use Flipt when Git-native feature management is the core requirement. For a proof of concept, create a flag, make a UI change that syncs to Git, review the commit, and test rollback.
Decision framework
Pick based on the job your team needs the tool to do.
Two questions eliminate most bad fits.
First, do you need experiment analysis tied to trusted metrics? If yes, prioritize GrowthBook, Statsig, PostHog, or Harness over flag-only tools. If your metrics live in the warehouse, GrowthBook should be the first tool you test.
Second, do you need self-hosting or code transparency? If yes, prioritize GrowthBook, Unleash, Flagsmith, or Flipt. If no, hosted tools like LaunchDarkly, ConfigCat, DevCycle, PostHog, and Statsig may get you moving faster.
Proof-of-concept checklist
Run the same developer proof of concept for every finalist:
- Add the SDK to one backend service and one frontend or mobile surface.
- Create one boolean flag and one JSON or string flag.
- Target internal users.
- Roll out to a small percentage of production traffic.
- Test what happens when the flag service is unavailable.
- Confirm assignment is stable.
- Log exposure only when users experience the treatment.
- Connect one flag to an experiment or analytics readout.
- Roll back without redeploying.
- Add owner, description, and cleanup date.
- Archive or remove the flag after the test.
- Model pricing at current, 3x, and 10x usage.
This proof of concept finds practical differences faster than a feature matrix.
How to avoid a misleading evaluation
Most feature flag evaluations are too easy. A developer creates a flag in a demo app, sees a value change, and calls the integration successful. That proves the SDK can work. It does not prove the tool fits your production workflow.
Use production-shaped constraints from the beginning. Create environments that match your release process. Use the same identity keys and targeting attributes your application already has. Include a service that handles anonymous users if your product has them. Include one backend and one client-side surface if both matter. Send exposures or events through the same path you would use after launch.
Then involve the people who will live with the tool. Ask engineers whether defaults and local development feel safe. Ask product managers whether targeting is understandable without editing code. Ask data scientists whether assignment and exposure data can be trusted. Ask platform teams whether secrets, SDK keys, audit logs, and service ownership are manageable. Ask finance or operations to model likely usage, not only pilot usage.
Finally, delete the test flag. This is the part teams skip, and it is one of the best signals. A tool that makes flag creation delightful but cleanup invisible will create debt. A tool that encourages ownership, descriptions, references, archived states, and review habits is more likely to survive contact with a busy engineering organization.
How the shortlist changes by team type
An early-stage SaaS team usually needs speed, clarity, and low cost. GrowthBook, DevCycle, PostHog, ConfigCat, and Statsig are natural candidates depending on whether the team needs experimentation, analytics, or simple hosted flags first.
A data-mature product team should start with the measurement question. If warehouse metrics are the source of truth, GrowthBook deserves the first proof of concept. If the team wants a managed analytics suite with flags included, Statsig and PostHog belong in the evaluation.
An enterprise platform team should start with governance and operating model. LaunchDarkly, Harness, Unleash, and GrowthBook may all belong on the shortlist, but for different reasons. LaunchDarkly is strongest for mature managed release control. Harness fits delivery-platform standardization. Unleash fits self-hosted feature management. GrowthBook fits teams that want open-source control plus experimentation depth.
A compliance-sensitive or infrastructure-control-heavy team should decide early whether self-hosting is a requirement or only a preference. If it is a requirement, prioritize GrowthBook, Unleash, Flagsmith, and Flipt. If managed SaaS is acceptable, compare security, permissions, auditability, data flow, and contractual requirements in detail.
The practical recommendation
For developer teams that want feature flags and measurable product impact, GrowthBook is the strongest default.
LaunchDarkly is excellent for enterprise release management. Unleash and Flagsmith are credible open-source feature-management choices. ConfigCat and DevCycle are easy hosted options. Statsig and PostHog are strong when flags belong inside a broader product analytics suite. Harness makes sense when feature management belongs inside the delivery platform. Flipt is compelling for Git-native workflows.
GrowthBook stands out when flags should connect to experiments, product analytics, warehouse-native metrics, open-source control, and predictable pricing. That is the combination most developer-led SaaS teams eventually need if feature flags become more than release toggles.
Related Articles
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.
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.
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.
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 GuideThe 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.
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.
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.
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.
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 GrowthBookTwo 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.
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.
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.
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 GuideCreate 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.
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.
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.
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 GrowthBookYour 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.
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.
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.
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 GuideThe 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.
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.
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.
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.
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.
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 GrowthBookReady to ship faster?
No credit card required. Start with feature flags, experimentation, and product analytics—free.



