Files
vercel__flags/packages/adapter-posthog
github-actions[bot] b6f52d9f10 Version Packages (#214)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-06 17:18:43 +02:00
..
2025-11-06 17:18:43 +02:00
2025-11-06 17:18:43 +02: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.