Why GrowthBook is better than LaunchDarkly for enterprise customers

Enterprise feature flag platforms fail in two ways: they become too expensive to use broadly, or they become too disconnected from the metrics that decide whether a release worked.
That is why the GrowthBook vs LaunchDarkly decision is not only a feature checklist. LaunchDarkly is a mature feature management platform. It is strong at enterprise rollout control, targeting, approvals, and release workflows. If your main problem is coordinating many engineering teams around production releases, LaunchDarkly deserves a serious look.
But most enterprise product teams are not buying feature flags only to flip features on and off. They want to ship safely, measure impact, reuse trusted metrics, control vendor costs, satisfy security reviews, and make experimentation part of normal product development.
That is where GrowthBook is better than LaunchDarkly for many enterprise customers. GrowthBook combines feature flags, experimentation, product analytics, warehouse-native metrics, and flexible deployment in a way that fits how product, engineering, and data teams actually work together.
This article breaks down the comparison across the enterprise criteria that matter: pricing, experimentation depth, data architecture, deployment control, governance, reliability, and migration risk.
The short answer: GrowthBook is better when measurement matters as much as rollout control
LaunchDarkly is strongest when feature management is the main job. GrowthBook is stronger when feature management needs to connect directly to experimentation, trusted metrics, data ownership, and cost control.
That distinction matters more as an organization grows. A small team can manage feature flags as a developer convenience. An enterprise has to manage them as production infrastructure. The platform affects engineering workflow, data governance, procurement, security review, and how product teams decide whether a release should keep rolling out.
| Enterprise decision criterion | GrowthBook | LaunchDarkly |
|---|---|---|
| Best center of gravity | Feature flags, A/B testing, product analytics, and warehouse-native metrics in one platform | Feature management, release workflows, targeting, and enterprise rollout control |
| Pricing shape | Seat-based cloud pricing, free cloud tier, Enterprise, and self-hosted open-source options | Developer tier, usage-priced Foundation, custom Enterprise and Guardian packaging |
| Data model | Queries your warehouse and exposes SQL for experiment analysis | Offers experimentation and warehouse-native metrics, but the broader platform is SaaS-first |
| Deployment control | GrowthBook Cloud or Self-hosted GrowthBook, including air-gapped options | Managed cloud service, with enterprise infrastructure options but no full self-hosted product |
| Experimentation fit | Experimentation is a core workflow tied to flags and metrics | Experimentation exists, but the platform is feature-management-first |
| Enterprise strength | Cost control, data control, self-hosting, transparent analysis, unified product-development workflow | Mature release governance, approvals, targeting, SDK breadth, and release monitoring |
This does not make LaunchDarkly weak. It makes the evaluation sharper.
Choose LaunchDarkly if the company primarily needs a centralized release control plane with mature enterprise workflows.
Choose GrowthBook if the company wants feature flags to become the operating layer for experimentation, product analytics, and measurable product development.
Pricing becomes an architecture question at enterprise scale
Enterprise pricing problems rarely show up during a pilot. They show up after the platform becomes standard.
The first few flags are easy to justify. The bill becomes harder to forecast when every service, environment, frontend surface, mobile app, experiment, and release workflow starts depending on the platform. That is why pricing model matters as much as sticker price.
LaunchDarkly pricing has several usage dimensions
LaunchDarkly's current pricing page has a free Developer tier, a usage-priced Foundation tier, and custom Enterprise and Guardian tiers. Foundation pricing includes service connections and client-side monthly active users. The comparison table also introduces other dimensions such as experimentation usage, observability usage, replays, errors, traces, logs, data export, and higher-tier governance features.
That shape can make sense for some teams. A platform engineering organization with stable service counts and clear release governance needs may find the model workable.
The challenge is forecasting. LaunchDarkly's service connections documentation defines a service connection as one server-side SDK instance connected to one LaunchDarkly environment for a measured period. In practice, applications, replicas, environments, and SDK instances can all affect the count. A company that thinks in terms of "apps" can be surprised when billing follows the actual runtime topology.
Client-side usage adds another variable. If browser, mobile, or desktop users encounter flags directly, pricing can move with product adoption. Experimentation, observability, and data export can add more planning questions.
None of this means LaunchDarkly is overpriced for every enterprise. It means the pricing model needs a real architecture review before standardization.
GrowthBook pricing is easier to model for high-scale product teams
GrowthBook's pricing page is built around a different idea: charge for the internal users who manage flags, experiments, and analytics, not for every end user who encounters a flag.
That is especially useful for enterprise teams where product traffic grows faster than the number of people operating the platform. A high-traffic product can run many feature flags and experiments without treating end-user exposure as the primary cost driver.
GrowthBook also gives teams more deployment choices. GrowthBook Cloud and Self-hosted GrowthBook use the same core platform, and the self-hosted path includes open-source and enterprise options. That gives procurement and security teams more ways to match the platform to internal requirements.
The practical enterprise question is not "which tool is always cheaper?" It is "which pricing model still makes sense when every team starts using the platform?"
For many enterprise teams, GrowthBook wins because the cost model is easier to explain to engineering, finance, and data leaders.
Experimentation should not be an add-on to release control
Feature flags answer one question: who sees this code?
Experimentation answers a different question: did this code improve the product?
Enterprise teams need both. If those workflows live too far apart, releases become visible but not measurable. Product teams ship behind flags, but the decision to roll forward still depends on dashboards, analyst tickets, manual exports, or disconnected metric definitions.
LaunchDarkly has experimentation, but its center of gravity is feature management
LaunchDarkly supports experimentation. Its experimentation documentation covers running experiments, analyzing results, Bayesian and frequentist analysis, multi-armed bandits, holdouts, and warehouse-backed metrics. Its experiment flags documentation describes temporary flags that test a hypothesis and pair variations with metrics.
That is a credible experimentation surface. LaunchDarkly is not a "flags only" tool anymore.
The question is where the product is optimized. LaunchDarkly is organized around feature management first: flags, targeting, release workflows, approvals, monitoring, and governance. Experimentation sits alongside that release-control model.
That may be fine for teams where experimentation is occasional. It is less ideal for companies where experiments are the operating model for product development.
GrowthBook treats experimentation as the primary measurement loop
GrowthBook is built around the idea that every meaningful product change can be shipped safely and measured rigorously.
Feature flag experiments in GrowthBook use experiment rules to assign variations, target specific users, track exposure through your event pipeline, and analyze results against metrics in your data warehouse. The same flag can support rollout control and measurement, so the product team is not bolting an experiment workflow onto a separate release tool.
That matters for enterprise adoption. Engineers care about safe rollout. Product managers care about decision quality. Data teams care about metric definitions, assignment data, sample ratio mismatch, statistical methods, and whether results can be audited. GrowthBook brings those groups into one workflow.
GrowthBook's experimentation platform also supports the practices mature teams need: A/B tests, feature-flag experiments, holdouts, sequential testing, Bayesian and frequentist workflows, variance reduction, metric libraries, and decision frameworks.
For an enterprise that wants to make experimentation normal, not occasional, GrowthBook is usually the better fit.
Warehouse-native metrics make experiment results easier to trust
Enterprise teams already have metric definitions. They live in the data warehouse, BI layer, semantic layer, dbt models, notebooks, dashboards, or a mix of all of those. A feature flag platform becomes more useful when it can work with those definitions instead of asking teams to rebuild them in a vendor system.
This is one of GrowthBook's clearest advantages.
GrowthBook uses the warehouse as the measurement source of truth
GrowthBook's warehouse-native architecture is designed around the data enterprises already trust. GrowthBook queries data where it lives, exposes visible SQL, and lets teams define metrics in a way that matches their business logic.
The data source configuration docs explain the mechanics. GrowthBook connects to your data warehouse, defines assignment queries and metric queries, and uses SQL templates to generate experiment results. It works with common event sources and custom schemas, which matters because enterprise data rarely fits a vendor's perfect example.
This has three practical benefits:
- Data teams can inspect and reproduce the SQL behind an experiment result.
- Product teams can use metrics the company already trusts.
- Engineering teams can connect feature rollout to measurable impact without building a separate analytics pipeline for every release.
GrowthBook's statistics docs reinforce the same point: experiment analysis should be understandable, inspectable, and connected to the data the organization already uses.
LaunchDarkly has warehouse-native metrics, but not the same platform model
LaunchDarkly has moved toward warehouse-backed experimentation. Its documentation includes warehouse-native metrics, external warehouse setup, and warehouse-backed experiment workflows.
That is important, and it is a real strength compared with older feature flag tools.
The difference is architectural emphasis. GrowthBook is warehouse-native by design. LaunchDarkly is a SaaS feature management platform that has added warehouse-native measurement capabilities for experimentation.
For enterprises where the data warehouse is the source of truth, that distinction affects more than analytics. It affects security review, metric governance, debugging, cost control, and how quickly data teams trust experiment results.
If the buyer is a platform engineering team, LaunchDarkly's release control may matter most. If the buyer includes data science, analytics, product, and growth leadership, GrowthBook's warehouse-native model is usually the stronger enterprise argument.
Deployment control is a real enterprise requirement
Some enterprises can use any managed SaaS product after a standard security review. Others cannot.
Healthtech, fintech, edtech, AI infrastructure, public sector-adjacent software, and large B2B platforms may need stricter control over data residency, access boundaries, infrastructure, and compliance posture. For those teams, deployment options are not a nice-to-have.
GrowthBook supports cloud, self-hosted, and air-gapped deployment paths
GrowthBook deployment options include GrowthBook Cloud and Self-hosted GrowthBook. The self-hosted path gives teams control over updates, scaling, infrastructure, data boundaries, and deployment topology. GrowthBook's security page also describes self-hosted and air-gapped options for teams that require infrastructure control.
That changes the enterprise conversation. Security teams can evaluate GrowthBook as software that can run inside the organization's own infrastructure, not only as a vendor-managed control plane.
Self-hosting is not free. Someone has to operate the system, manage upgrades, monitor uptime, and own incident response. But for enterprises with strict data requirements, that operating cost may be easier to justify than sending more production control and experiment metadata through a third-party SaaS platform.
LaunchDarkly is strong SaaS infrastructure, but not self-hosted-first
LaunchDarkly is a mature managed platform. That is a strength for many enterprise buyers. Teams get a hosted control plane, broad SDK coverage, release workflows, and vendor-managed infrastructure.
But it is not the same as full self-hosting. If the requirement is "run the platform inside our network," GrowthBook has a clearer answer.
This is not only about security posture. It is also about long-term control. Enterprises that want to inspect code, manage deployment, avoid vendor lock-in, and keep measurement close to their own data infrastructure should include self-hosting in the evaluation.
GrowthBook is better when deployment control is part of the buying criteria.
Feature flag governance still matters
The case for GrowthBook should not pretend that feature flag governance is simple.
Feature flags are production controls. A targeting rule can expose a half-finished feature. A configuration value can change business logic. A stale flag can leave dead code in a critical path. A rollback can disable a user workflow. Enterprises need permissions, audit trails, approval workflows, ownership, naming conventions, cleanup habits, and emergency procedures.
LaunchDarkly deserves credit for enterprise release governance
LaunchDarkly has invested deeply in release governance. Its approvals documentation describes approval requests for changes to feature flags, AgentControl configs, experiments, and segments. Its pricing page shows higher-tier governance features such as SSO/SAML, SCIM, audit logging, custom roles, approvals, and security and compliance packaging.
LaunchDarkly also has guarded rollouts, code references, feature monitoring, release pipelines, and workflow tooling. For platform teams standardizing release practices across many engineering groups, this is meaningful.
If an enterprise's main pain is release governance, LaunchDarkly may be the safer incumbent choice.
GrowthBook gives governance a measurement layer
GrowthBook's advantage is not that governance disappears. It is that governance connects to experimentation and product impact.
GrowthBook feature flags support targeted rollouts, percentage rollouts, instant kill switches, remote configuration, scheduled flags, approval workflows, audit history, and stale flag management. The same platform also connects flags to experiments and metrics.
That pairing matters. A release approval answers "is this change allowed to go live?" An experiment readout answers "did this change improve the product?" Mature organizations need both.
GrowthBook is especially strong when governance needs to include data teams and product teams, not only engineering and release management.
Reliability depends on evaluation model, not only vendor uptime
Enterprise buyers often ask for uptime numbers. They should. But feature flag reliability is not only a vendor uptime question. It is also an SDK evaluation question.
What happens if the control plane is slow? What value does the SDK return when configuration is stale? Does flag evaluation require a network call on the critical path? Can the app keep serving a safe default during an incident?
GrowthBook's SDK overview is explicit about how its SDKs work: they fetch feature definitions, cache them, and evaluate features wherever the SDK runs, whether in the browser, server, or edge. That local evaluation model keeps normal flag checks close to the application.
LaunchDarkly also has mature SDK behavior and infrastructure patterns, including streaming and polling. It is not fragile by default. But LaunchDarkly's value proposition often includes a live managed control plane with streaming updates, observability, and release workflows. That can be powerful, but it also requires teams to understand how their SDKs behave under network loss, stale config, initialization delay, and fallback scenarios.
For enterprise teams, the right proof of concept should include failure testing:
- Start the app with no network access.
- Serve a request while flag configuration is stale.
- Test a missing user attribute.
- Test client-side and server-side evaluation separately.
- Verify fallback values.
- Confirm whether rollout changes require a live vendor call or a cached local rule.
- Run the same test under production-like traffic.
GrowthBook is better when teams want flag evaluation and experiment assignment to be boring, inspectable, and close to their own application and data infrastructure.
The migration should prove value before it proves coverage
Do not migrate from LaunchDarkly to GrowthBook by recreating every flag first.
That is the slowest way to learn. It also moves old flag debt into a new tool.
A better migration starts with one representative workflow that proves why GrowthBook is being considered in the first place. For most enterprise teams, that workflow should include feature rollout and measurement, not only a toggle.
| Migration step | What to test | Why it matters |
|---|---|---|
| Inventory current flags | Separate release flags, experiment flags, permission flags, kill switches, and stale flags | Avoid migrating dead code and old rollout habits |
| Pick one representative service | Choose a flag used by a real backend, frontend, or mobile path | Proves SDK integration in a real environment |
| Recreate targeting rules | Match account, user, plan, geography, or internal-user targeting | Validates rule expressiveness before broader migration |
| Add one metric | Connect the rollout to a primary metric and guardrail metric | Shows whether GrowthBook improves decision quality |
| Run a feature-flag experiment | Assign variations, log exposure, and analyze results | Tests the full flag-to-experiment loop |
| Model cost at 3x and 10x usage | Compare seats, traffic, services, experiments, and support needs | Prevents the next platform from recreating the same pricing problem |
| Define cleanup | Archive the old flag, remove old code paths after review, and record ownership | Prevents migration from becoming a flag-copying project |
This is also the point where GrowthBook's broader platform becomes visible. A team can compare LaunchDarkly and GrowthBook on rollout speed, metric trust, data-team workflow, developer experience, governance, cost model, and security review at the same time.
The best migration proof is not "we recreated a flag." It is "we shipped a change, measured it with trusted metrics, made a decision, and cleaned up the flag."
One useful exercise is to write the success criteria before anyone opens either platform. The platform should pass if a product manager can define the release audience, an engineer can implement the SDK with safe defaults, a data scientist can verify assignment and metric SQL, and finance can model the same rollout at higher traffic without changing the economic logic. That forces the evaluation to reflect real enterprise work instead of demo momentum.
It also prevents the most common migration mistake: comparing the prettiest workflow in one tool against the messiest legacy workflow in the other. If LaunchDarkly has accumulated stale flags, inconsistent naming, and unclear ownership, clean those up in the baseline. If GrowthBook is being evaluated for warehouse-native measurement, include a metric that actually matters to the business. A proof of concept only proves something when both platforms are tested against the same operating standard.
When LaunchDarkly is still the better choice
GrowthBook is not the right answer for every enterprise.
LaunchDarkly may be better when:
- The organization mainly needs enterprise release governance, not experimentation.
- Platform engineering owns the buying decision and product/data teams are secondary users.
- Release workflows, approval routing, guarded rollouts, and observability are the primary requirements.
- The company's pricing model fits LaunchDarkly's service connection, client-side MAU, and enterprise packaging.
- The organization wants a mature managed SaaS control plane and does not need self-hosting.
- Existing LaunchDarkly adoption is broad, clean, and cost-effective enough that migration risk outweighs the upside.
That last point matters. A working incumbent has value. If LaunchDarkly is already standardized, the cost is predictable, and teams trust the workflow, there may be no urgent reason to switch.
The case for GrowthBook is strongest when LaunchDarkly has become expensive, experimentation has become important, metrics are hard to trust, or security teams want more deployment control.
When GrowthBook is the better enterprise choice
GrowthBook is the better enterprise choice when the company wants feature flags to become part of a broader product-development system.
That usually means the team cares about:
- Predictable pricing as traffic, services, and experiments grow.
- Warehouse-native metrics and visible SQL.
- Experimentation as a core workflow, not an occasional add-on.
- Feature flags and experiments in the same platform.
- Product analytics connected to the same data and metrics.
- Cloud and self-hosted deployment options.
- Open-source transparency and lower vendor lock-in.
- Security review that can include self-hosting or air-gapped deployment.
- A migration path that can start with one flag and one real experiment.
GrowthBook does not win because LaunchDarkly is bad. It wins because enterprise product development has changed.
Shipping safely is no longer enough. Teams also need to know whether what they shipped worked. They need the answer in metrics the company trusts. They need costs that do not punish every extra user, service, or experiment. They need infrastructure choices that fit their security profile.
That is the GrowthBook advantage.
Build the evaluation around the work your teams actually do
The GrowthBook vs LaunchDarkly comparison should end with a proof of concept, not a deck.
Pick one real feature. Put it behind a flag. Roll it out to a targeted segment. Add one primary metric and one guardrail metric. Run it as an experiment. Ask engineering how the SDK felt. Ask product whether the decision was clear. Ask data whether the result was trustworthy. Ask finance whether the 10x usage model still works. Ask security whether the deployment model fits.
If the evaluation is only about toggles, LaunchDarkly will look strong. It should.
If the evaluation is about product development at enterprise scale, GrowthBook usually tells a better story: feature flags, experimentation, product analytics, warehouse-native metrics, open-source control, and predictable pricing in one platform.
Start with a real pilot, not a generic feature matrix. Try GrowthBook free, compare it against your current LaunchDarkly workflow, and make the decision with your own flags, your own metrics, and your own architecture.
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, that's the point to consider managed 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.
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.
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.



