posthog-multi-env-setup

Featured

Configure PostHog across development, staging, and production environments. Separate PostHog projects per environment, environment-specific SDK config, feature flag rollout per env, and session recording controls. Trigger: "posthog environments", "posthog staging", "posthog dev prod", "posthog environment setup", "posthog project per env".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# PostHog Multi-Environment Setup ## Overview Use separate PostHog projects for each environment (dev, staging, production). This prevents dev/test events from polluting production analytics, allows different feature flag rollout percentages per environment, and lets you disable session recordings in non-production. ## Prerequisites - PostHog Cloud account or self-hosted instance - Admin access to create multiple projects - Deployment platform with environment variable support ## Environment Strategy | Environment | PostHog Project | Session Recording | Autocapture | Feature Flags | |-------------|----------------|-------------------|-------------|---------------| | Development | `myapp-dev` | Disabled | Enabled | 100% rollout (test all) | | Staging | `myapp-staging` | Disabled | Enabled | 100% rollout (QA all) | | Production | `myapp-prod` | 10% sampled | Tuned | Gradual rollout | ## Instructions ### Step 1: Create Separate PostHog Projects In PostHog Cloud (app.posthog.com), create three projects: 1. `myapp-development` — copy the `phc_...` project API key 2. `myapp-staging` — copy the `phc_...` project API key 3. `myapp-production` — copy the `phc_...` project API key ### Step 2: Environment Variables ```bash # .env.local (development — git-ignored) NEXT_PUBLIC_POSTHOG_KEY=phc_dev_key_here NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com POSTHOG_PERSONAL_API_KEY=phx_your_key POSTHOG_PROJECT_ID=11111 # .env.staging (CI/CD secrets or secret manager) NEXT_PUBLIC_...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category