Skip to content
VercelLogotypeVercelLogotype
LoginSign Up

Growthbook Flags SDK Example

Learn how to set up Growthbook flags and experiments using Flags SDK.

DeployView Demo
Growthbook example image (not appropriate for changelogs or flags-sdk.dev)

Growthbook Flags SDK Example

This example uses GrowthBook for feature flags with the Flags SDK along with the @flags-sdk/growthbook GrowthBook adapter and the Flags Explorer.

Demo

https://flags-sdk-growthbook.vercel.app

How it works

This demo controls the visibility of two banners on the home page, and the color of the checkout button.

Once you visit the page, you can see a variation of both/one/none of the banners.

To test different variations, you can use the Dev Tools at the bottom to reset the stable id and reload the page.

When you create and link a project on Vercel, you may use the Flags Explorer to see what variants are active, and test different variations by creating overrides.

Deploy this template

Step 1: Link the project

In order to use the Flags Explorer, you need to link the project on your local machine.

vercel link

If your project does not exist yet, you will be prompted to create it.

Step 2: Pull all environment variables

This allows the Flags SDK and the Flags Explorer to work correctly, by getting additional metadata.

vercel env pull

If you are building this on the CLI, you can set the environment variables with vercel env add

Step 3: Create Feature Gates and Experiments

On GrowthBook, create a project with the following flags split by id:

  • free_delivery (50% rollout or experiment)
  • summer_sale (50% rollout or experiment)
  • proceed_to_checkout (Multiple variants serving red, green or blue)

The id of the flags in GrowthBook should match the key of the flags in the flags.ts file.

If you have not started your experiments yet, you must do so in order to see the traffic split.

GitHub
Ownervercel
Repositoryexamples
Use Cases
Edge Config
Edge Middleware
Stack
Next.js
Tailwind
Experimentation
Growthbook

Related Templates

Flags SDK with Hypertune and Next.js

An e-commerce example built with Hypertune and Flags SDK that works well with Vercel Marketplace
Flags SDK with Hypertune and Next.js thumbnail

Statsig Experimentation with Flags SDK

Run experiments on static pages with Statsig and the Flags SDK
Statsig Experimentation with Flags SDK thumbnail

LaunchDarkly Flags SDK Example

Learn how to set up LaunchDarkly, including experimentation alongside Flags SDK and Edge Config.
LaunchDarkly Flags SDK Example thumbnail

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • EveNew
  • ConnectNew

Core Platform

  • CI/CD
  • Content Delivery
  • Fluid Compute
  • Observability

Security

  • Platform Security
  • WAF
  • Bot Management
  • Bot ID

Tools

  • Vercel DropNew
  • Vercel Agent
  • Vercel PluginNew
  • Next.js
  • Domains
  • v0

Frameworks

  • Nuxt
  • SvelteKit
  • Nitro
  • Turborepo
  • Tanstack Start
  • FastAPI
  • xmcp
  • All frameworks

SDKs

  • Vercel SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDKNew
  • Queues SDKNew
  • Streamdown

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
  • Platform Engineers
  • Design Engineers

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Articles
  • Community

Explore

  • Customers
  • Marketplace
  • Templates
  • Partner Finder
  • Vercel + AWS

Company

  • About
  • Careers
  • Press
  • Events
  • Startups
  • Shipped on Vercel
  • Open Source Program
  • Enterprise
  • Pricing
  • Help

Legal & Trust

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DPA
  • Acceptable Use Policy
  • Legal (all documents)
  • Trust Center
  • Status

Social

  • GitHub
  • X
  • LinkedIn
  • YouTube
  • Instagram
  • VercelVercel
Agent Stack
  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • Eve
Core Platform
  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • CI/CD
Tools
  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains
  • v0
Learn
  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base
Build
  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
Explore
  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community
EnterprisePricing
Contact
Log InSign Up
Dashboard

Products

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • Eve

Core Platform

  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • CI/CD

Tools

  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains
  • v0
Resources

Learn

  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce

Explore

  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community
Enterprise
Pricing
Sign UpLog In
Contact
DeployView Demo

Loading status…

Select a display theme: