PostHog Client
@theholocron/posthog-client wraps the PostHog personal API key endpoints for managing users and projects.
Installation
Section titled “Installation”pnpm add @theholocron/posthog-clientimport { createPostHogClient } from "@theholocron/posthog-client";
const client = createPostHogClient({ token: process.env.POSTHOG_PERSONAL_API_KEY!, // host: "https://eu.posthog.com", // EU cloud});
const user = await client.users.me();const { results } = await client.projects.list();const project = await client.projects.create({ name: "my-app" });console.log(project.api_token); // phc_* tracking tokenThe full API reference is generated from the package’s TSDoc comments.