One command
Add PostHog to any Ashlr Stack project with a single command. Stack runs the auth flow, verifies the credential, and writes every secret slot into Phantom.
stack add posthog
Or describe what you're building and let Claude pick it up via stack recommend:
stack recommend "product analytics and feature flags" Auth flow
Paste a long-lived API key once. Stack verifies it against the provider's API before writing to Phantom.
How-to: Create a personal API key at https://app.posthog.com/me/settings (scope: all).
Secret slots
stack add posthog writes these 1 secret
slot into your Phantom vault:
POSTHOG_PERSONAL_API_KEY
The values never leave Phantom in plaintext. Your .env file references slot
names, and stack exec -- <cmd> swaps them in at process-spawn time via
Phantom's local proxy.
MCP wiring
PostHog ships an MCP server.
stack add posthog auto-wires it into .mcp.json so your Claude Code / Cursor / Windsurf session can use it immediately.
SSE MCP at mcp.posthog.com/sse, with the personal key piped through Phantom at call time.
Starter templates that include PostHog
Apply a pre-wired stack with one command:
-
stack init --template nextjs-supabase-posthog -
stack init --template supabase-posthog-sentry-resend
Related providers in Analytics
- Mixpanel — Product analytics. Project token + optional API secret stored in Phantom.
- Plausible — Privacy-friendly web analytics. API key verified against the stats API.
FAQ
Do I need a PostHog account to use it with Stack?
Yes — Stack provisions PostHog on your behalf, but it authenticates as you. Paste a long-lived API key once. Stack verifies it against the provider's API before writing to Phantom. If you don't have a credential yet, create one at https://app.posthog.com and paste it once.
Where does Stack store my PostHog credentials?
In Phantom Secrets, an E2E-encrypted local vault. Stack writes the secret slot names (POSTHOG_PERSONAL_API_KEY) into .stack.toml — the actual values live only in Phantom and never touch disk in plaintext.
Can I rotate or revoke this integration later?
Yes. Run `stack remove posthog` to pull the PostHog service back out (Phantom secrets deleted, MCP entry removed, .stack.toml cleaned up). Rotate the underlying PostHog credentials in their dashboard — https://app.posthog.com — and Stack's next `doctor --fix` will pick up the new values.