Skip to content
infra-ts is early and moving fast.npm
infra-ts
Esc
navigateopen⌘Jpreview
On this page

PostHog

Provision PostHog projects (ingestion key + host) and feature flags as typed infra-ts entities.

PostHog projects (ingestion key + host) and feature flags.

  • Import: import { PosthogProject, PosthogFeatureFlag } from "infra-ts/posthog";
  • Credentials: POSTHOG_API_KEY (a personal API key). Optional POSTHOG_API_HOST (default https://us.posthog.com).

Entities

Entity Provisions Key options Env outputs
PosthogProject A project org · clientHost? POSTHOG_KEY, POSTHOG_HOST
PosthogFeatureFlag A feature flag projectId · key? · active?

Example

import { defineInfra } from "infra-ts";
import { PosthogFeatureFlag, PosthogProject } from "infra-ts/posthog";

const analytics = new PosthogProject({ name: "analytics", org: "acme" });
const flag = new PosthogFeatureFlag({
	name: "new-checkout",
	projectId: analytics.id,
	active: true,
});

export default defineInfra({ entities: [analytics, flag] });

Was this page helpful?