Files
github-actions[bot] 0976e8f760 Version Packages (#154)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-28 08:52:03 -04:00
..
2025-07-28 08:52:03 -04:00
2025-07-28 08:52:03 -04:00

Flags SDK — PostHog Adapter

The PostHog adapter for Flags SDK supports dynamic server side feature flags powered by PostHog.

Setup

Install the adapter

pnpm i @flags-sdk/posthog

Example Usage

import { flag } from 'flags/next';
import { postHogAdapter } from '@flags-sdk/posthog';

export const marketingGate = flag<boolean>({
  // The key in PostHog
  key: 'my_posthog_flag_key_here',
  // The PostHog feature to use (isFeatureEnabled, featureFlagValue, featureFlagPayload)
  adapter: postHogAdapter.featureFlagValue(),
});

Runtimes

Runtime Supported
Node
Edge Runtime

Note: posthog-node does not support the Edge Runtime.

To use with middleware and precompute, read more: Middleware now supports Node.js

Documentation

View more PostHog documentation at posthog.com.