Skip to main content

GrowthBook

The @archibald/growthbook package implements Archibald's universal personalization contract against GrowthBook. It connects the PersonalizationClient from @archibald/personalization to a GrowthBook instance for feature flags, A/B testing and personalized content — evaluated on the server during SSR (no UI flicker) and hydrated to the client, on Web and Mobile alike.

For the general personalization architecture — client, adapters, providers, hooks — see the Personalization guide.

Installation

pnpm add @archibald/growthbook

Usage

Client side

Configure the PersonalizationClient with the GrowthBook adapter:

import { PersonalizationClient } from '@archibald/personalization';
import { GrowthBookAdapter } from '@archibald/growthbook';

export default new PersonalizationClient({
adapter: GrowthBookAdapter,
ttl: '10m',
api
});

Server side

Register the PersonalizationModule with the GrowthBook provider:

import { GrowthBookProvider } from '@archibald/growthbook';

new PersonalizationModule({
provider: new GrowthBookProvider({
config: {
apiHost: 'https://...',
clientKey: '...',
streaming: true
}
})
});

Key concepts

  • Universal hooks: once configured, the same useFeatureFlag / useFeatureFlagActive hooks from @archibald/personalization work on every platform.
  • SSR evaluation: the provider evaluates flags on the server and hydrates the result, so the initial render is already personalized.
  • Real-time updates: supports GrowthBook's streaming mode for near-instant flag updates.

Further documentation