feat: install GrowthBook SDK for feature flags - #546
Merged
Merged
Conversation
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>
Deploying website with
|
| 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 |
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>
…experiment" This reverts commit c2c0032.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@growthbook/growthbook-reactand creates a client instance (src/growthbook.ts) connected to a GrowthBook Cloud SDK connection (dev environment)GrowthBookProviderwrapper (src/components/GrowthBookProvider.tsx) forclient:only="react"islands, since this app has no single React entry point to mount a provider onceVITE_GROWTHBOOK_CLIENT_KEY, but Astro's client-exposed env prefix defaults toPUBLIC_, notVITE_— the key would have silently never reached the browser. Renamed toPUBLIC_GROWTHBOOK_CLIENT_KEY.docs/GROWTHBOOK.md(research notes: SDK options, CSP implications, secrets handling) andGROWTHBOOK_SETUP.md(setup log/status)gb-check(all 7 checks passing) andpnpm tsc --noEmitTest plan
pnpm tsc --noEmitpassesgb-check --language reactreports all checks passingGrowthBookProvider(nothing does yet — install-only)