{"id":50716973,"url":"https://github.com/ashwamegh/growthbook2posthog","last_synced_at":"2026-06-09T19:02:03.434Z","repository":{"id":349323585,"uuid":"1188604517","full_name":"ashwamegh/growthbook2posthog","owner":"ashwamegh","description":"Migrate feature flags from GrowthBook to PostHog with an interactive CLI wizard.","archived":false,"fork":false,"pushed_at":"2026-03-22T10:40:24.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T14:36:47.231Z","etag":null,"topics":["feature-flags","growthbook","posthog"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashwamegh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-22T10:23:10.000Z","updated_at":"2026-03-22T10:41:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ashwamegh/growthbook2posthog","commit_stats":null,"previous_names":["ashwamegh/growthbook2posthog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ashwamegh/growthbook2posthog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwamegh%2Fgrowthbook2posthog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwamegh%2Fgrowthbook2posthog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwamegh%2Fgrowthbook2posthog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwamegh%2Fgrowthbook2posthog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashwamegh","download_url":"https://codeload.github.com/ashwamegh/growthbook2posthog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashwamegh%2Fgrowthbook2posthog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34121022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["feature-flags","growthbook","posthog"],"created_at":"2026-06-09T19:02:02.382Z","updated_at":"2026-06-09T19:02:03.427Z","avatar_url":"https://github.com/ashwamegh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# growthbook2posthog\n\nMigrate feature flags from [GrowthBook](https://www.growthbook.io/) to [PostHog](https://posthog.com/) with an interactive CLI wizard.\n\n[![npm version](https://img.shields.io/npm/v/growthbook2posthog.svg)](https://www.npmjs.com/package/growthbook2posthog)\n[![license](https://img.shields.io/npm/l/growthbook2posthog.svg)](https://github.com/ashwamegh/growthbook2posthog/blob/main/LICENSE)\n\n## Why?\n\nSwitching feature flag providers shouldn't mean manually recreating hundreds of flags. `growthbook2posthog` reads your GrowthBook features, maps them to PostHog's flag format, and creates them in PostHog - handling all the edge cases along the way.\n\n## Features\n\n- **Interactive TUI** - Step-by-step wizard guides you through the entire migration\n- **Works everywhere** - GrowthBook Cloud, PostHog Cloud (US/EU), and self-hosted instances\n- **Smart key handling** - Automatically detects and replaces invalid characters (GrowthBook allows dots, PostHog doesn't) with your choice of separator\n- **Environment-aware** - Optionally append environment names to flag keys for per-environment separation in PostHog\n- **Safe by default** - Preview migration plan before executing, skip existing flags, per-flag error isolation\n- **Incremental** - Re-run migrations safely; existing flags are detected and can be skipped or updated\n- **Complete mapping** - Translates targeting conditions, rollout percentages, force rules, experiments, variants, and payloads\n\n## Quick Start\n\n```bash\n# Install globally\nnpm install -g growthbook2posthog\n\n# Run the wizard\ngb2ph\n```\n\nOr run without installing:\n\n```bash\nnpx growthbook2posthog\n```\n\n## How It Works\n\nThe wizard walks you through 7 steps:\n\n```\n Step 1  Configure GrowthBook    Connect to Cloud or self-hosted instance\n Step 2  Configure PostHog       Connect to US/EU Cloud or self-hosted instance\n Step 3  Select Source            Pick GrowthBook project(s) and environment(s)\n Step 4  Select Destination       Pick PostHog project, map environments, choose key format\n Step 5  Preview Migration        Review the plan before making any changes\n Step 6  Execute Migration        Migrate flags with live progress\n Step 7  Summary Report           See results - created, skipped, failed\n```\n\n## What Gets Migrated\n\n| GrowthBook | PostHog | Notes |\n|------------|---------|-------|\n| Feature key | Flag key | Invalid characters replaced with `_` or `-` |\n| Description | Flag name | Direct mapping |\n| Boolean features | Boolean flags | Direct mapping |\n| String/JSON features | Multivariate flags | Mapped to variants with payloads |\n| Force rules | Groups (100% rollout) | Conditions translated to property filters |\n| Rollout rules | Groups (% rollout) | Percentage preserved |\n| Experiment rules | Multivariate variants | Weights and payloads preserved |\n| Tags | Tags | Direct mapping |\n| Archived status | Active: false | Archived flags can be optionally skipped |\n| Disabled environments | Active: false, 0% rollout | Flag exists but doesn't serve |\n\n### Targeting Conditions\n\nMongoDB-style conditions are translated to PostHog property filters:\n\n| GrowthBook | PostHog |\n|------------|---------|\n| `$eq` | `exact` |\n| `$ne` | `is_not` |\n| `$in` / `$nin` | `exact` (array) / `is_not` (array) |\n| `$regex` | `regex` |\n| `$gt` / `$gte` / `$lt` / `$lte` | `gt` / `gte` / `lt` / `lte` |\n| `$exists` | `is_set` / `is_not_set` |\n| `$and` | Single group (AND) |\n| `$or` | Multiple groups (OR) |\n\n## Environment Strategies\n\nGrowthBook has built-in environments. PostHog does not. The tool supports two approaches:\n\n### Option A: Environment-Suffixed Keys\n\nAppend the environment name to each flag key. Best for single-project setups (including self-hosted free tier).\n\n```\nmy_feature  --\u003e  my_feature_production\nmy_feature  --\u003e  my_feature_development\nmy_feature  --\u003e  my_feature_sandbox\n```\n\nRun the migration once per environment. The wizard asks if you want to append environments.\n\n### Option B: Separate PostHog Projects\n\nMigrate each environment into a separate PostHog project. Cleanest separation, but requires PostHog Cloud or a paid plan (self-hosted free tier is limited to 1 project).\n\n## Key Formatting\n\nPostHog only allows **letters, numbers, hyphens (`-`) and underscores (`_`)** in flag keys.\n\nIf your GrowthBook keys use dots or other characters, the wizard detects this and lets you pick a separator:\n\n```\nais.v1.account.get  --\u003e  ais_v1_account_get   (underscore)\nais.v1.account.get  --\u003e  ais-v1-account-get   (hyphen)\n```\n\nKeys that are already valid pass through unchanged.\n\n## Configuration\n\nConnection settings are saved locally after first use. On subsequent runs, the wizard offers to reuse them:\n\n```\nUse saved GrowthBook config? (http://localhost:3100)  Yes\nUse saved PostHog config? (https://us.posthog.com)    Yes\n```\n\nConfig is stored via [conf](https://github.com/sindresorhus/conf) in your OS config directory.\n\n## API Keys\n\n### GrowthBook\nGo to **Settings \u003e API Keys** and create a Secret API Key with read access to features, projects, and environments.\n\n### PostHog\nGo to **Settings \u003e Personal API Keys** and create a key with scopes:\n- **Feature Flags**: Read + Write\n- **Projects**: Read\n- **Organizations**: Read (+ Write if you want to create projects)\n\n## Requirements\n\n- Node.js \u003e= 18\n- GrowthBook API access (Secret API Key)\n- PostHog API access (Personal API Key)\n\n## Known Limitations\n\n- **Experiment-ref** and **safe-rollout** rules in GrowthBook have no PostHog equivalent. These are flagged as warnings during migration.\n- PostHog's self-hosted free tier is limited to **1 project**. Use environment-suffixed keys or upgrade for multi-project support.\n- Complex nested MongoDB conditions may need manual review post-migration.\n\n## Development\n\n```bash\n# Clone and install\ngit clone https://github.com/ashwamegh/growthbook2posthog.git\ncd growthbook2posthog\nnpm install\n\n# Build\nnpm run build\n\n# Run locally\nnode dist/bin/gb2ph.js\n\n# Watch mode\nnpm run dev\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashwamegh%2Fgrowthbook2posthog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashwamegh%2Fgrowthbook2posthog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashwamegh%2Fgrowthbook2posthog/lists"}