Technical
Feature Flags Without a Vendor
Feature flag vendors pitch a pricing tier for every team size. For most projects that is money better spent elsewhere. A homegrown feature flag system is a few hours of work and covers the common cases perfectly. Here is what I build and why it holds up.
What I Actually Need
Real feature flags answer three questions: is this feature on, for whom, and can I change my answer without a deploy? Vendors pile on experimentation, segmentation, and analytics. Most projects use none of that. A DIY system that answers the three core questions covers 95 percent of actual usage.
The Minimal Implementation
A DynamoDB table with flag names, targeting rules, and default values. A tiny client that reads the table with caching. An admin page to toggle flags. That is the whole system.
import boto3, time
_cache = {}
_cache_ttl = 60
flags_table = boto3.resource('dynamodb').Table('flags')
def is_enabled(flag_name: str, user_id: str = None) -> bool:
now = time.time()
cached = _cache.get(flag_name)
if cached and cached['expires'] > now:
flag = cached['flag']
else:
resp = flags_table.get_item(Key={'name': flag_name})
flag = resp.get('Item', {'default': False})
_cache[flag_name] = {'flag': flag, 'expires': now + _cache_ttl}
if user_id and user_id in flag.get('enabled_users', []):
return True
if user_id and user_id in flag.get('disabled_users', []):
return False
return flag.get('default', False)Reads are cheap because of the cache. Changes propagate within 60 seconds. Targeting rules cover the cases that actually come up: allow-list for internal users, deny-list for problem users, default for everyone else.
When to Buy Instead
Move to a vendor when you need percentage rollouts at high traffic, proper A/B experiment statistics, or audit trails for compliance. Launchdarkly and Statsig earn their price at that point. Until then, roll your own.
The Bigger Principle
Every SaaS solves a subset of problems that any team could solve in a day of code. The question is whether the team's time is better spent on that solution or elsewhere. For feature flags specifically, the DIY cost is low and the ongoing cost is zero. That ratio rarely beats the vendor equation for small projects.
See Martin Fowler's feature toggle article for the conceptual foundation. The implementation above is a concrete instance of the release toggle category, which covers most day-to-day needs.
RELATED READING
The Consulting Shift I Am Making In Year Two
After a year of writing and building, my consulting practice is changing shape. Shorter engagements. Sharper outcomes.
ReadThe Frontend Shift: Shipping Less JavaScript In Year Two
A year ago I reached for Next.js for everything. This year I often reach for nothing.
ReadThe Serverless Lesson I Would Write On A Sticky Note
After a year of shipping serverless projects, one rule explains most of the wins and all of the losses.
Read