
I built the dotenv of feature flags for TypeScript - here's how deterministic rollouts work
Every team eventually needs feature flags. Roll out to 10% of users first. Toggle something off without a redeploy. Show a feature only to beta testers. Your options today: LaunchDarkly ($500+/month), Unleash (Docker, PostgreSQL, maintenance), Flagsmith (same story), or hardcoded if-statements. None of these work for a small team shipping fast. So I built featurekit — the dotenv of feature flags. Define flags in a JSON file, get typed evaluation anywhere in your TypeScript codebase. Zero infrastructure, zero dependencies. The problem with percentage rollouts The trickiest part of feature flags isn't the on/off toggle — it's percentage rollouts. You want 20% of users to see a new feature. But which 20%? The naive approach uses Math.random() : if ( Math . random () < 0.2 ) showNewFeature () This is wrong. The same user might see the feature on one request and not on the next. The experience flickers. Worse, if you refresh the percentage to 30%, you can't guarantee the original 20% still
Continue reading on Dev.to Webdev
Opens in a new tab

