Skip to content

feat: install GrowthBook SDK for feature flags - #546

Merged
mohanadft merged 6 commits into
mainfrom
feat/growthbook-sdk-setup
Sep 17, 2026
Merged

mohanadft merged 6 commits into
mainfrom
feat/growthbook-sdk-setup

Conversation

@mohanadft

Copy link
Copy Markdown
Collaborator

Summary

  • Installs @growthbook/growthbook-react and creates a client instance (src/growthbook.ts) connected to a GrowthBook Cloud SDK connection (dev environment)
  • Adds a reusable GrowthBookProvider wrapper (src/components/GrowthBookProvider.tsx) for client:only="react" islands, since this app has no single React entry point to mount a provider once
  • Fixes an env-var bug from the automated wizard install: it wrote VITE_GROWTHBOOK_CLIENT_KEY, but Astro's client-exposed env prefix defaults to PUBLIC_, not VITE_ — the key would have silently never reached the browser. Renamed to PUBLIC_GROWTHBOOK_CLIENT_KEY.
  • Adds docs/GROWTHBOOK.md (research notes: SDK options, CSP implications, secrets handling) and GROWTHBOOK_SETUP.md (setup log/status)
  • No flags or experiments created yet — install-only, verified via gb-check (all 7 checks passing) and pnpm tsc --noEmit

Test plan

  • pnpm tsc --noEmit passes
  • gb-check --language react reports all checks passing
  • Confirm the GrowthBook dashboard shows the SDK connection as reachable once a page actually uses GrowthBookProvider (nothing does yet — install-only)

Adds the GrowthBook React SDK, a client instance, and a reusable
GrowthBookProvider wrapper for client:only="react" islands (there's no
single app entry point to mount a provider once, unlike a typical SPA).

Fixes a bug from the automated wizard install: it wrote the client key
as VITE_GROWTHBOOK_CLIENT_KEY, but Astro's client-exposed env prefix
defaults to PUBLIC_, not VITE_ — so the key would have silently never
reached the browser bundle.

No flags or experiments created yet; install-only per gb-check (all
checks passing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 17, 2026

Copy link
Copy Markdown

Deploying website with  Cloudflare Pages  Cloudflare Pages

Latest commit: cdc03ae
Status: ✅  Deploy successful!
Preview URL: https://589e3286.website-aun.pages.dev
Branch Preview URL: https://feat-growthbook-sdk-setup.website-aun.pages.dev

View logs

mohanadft and others added 5 commits September 17, 2026 15:19
Cites GrowthBook, Vercel Flags SDK, and LaunchDarkly guidance to
justify sticking with the already-installed client-only SDK for now
rather than investing in SSR/edge bootstrapping before there's a real
flicker problem to solve.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds an orphan /growthbook-test page with a banner that reads the
growthbook-test flag, to confirm the SDK connection actually goes
live. Excluded from the sitemap like other orphan test pages, and
allowlists cdn.growthbook.io in the CSP connect-src now that a real
client-side fetch happens.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Gives the SDK a per-load id attribute so an experiment rule can actually
split traffic, and logs each exposure so it's visible in devtools.
Demo-only randomization — a real experiment needs a stable per-visitor id.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mohanadft
mohanadft merged commit 3b1024f into main Sep 17, 2026
5 checks passed
@mohanadft
mohanadft deleted the feat/growthbook-sdk-setup branch September 17, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant