Feature Flag Service System Design: A Step-by-Step Interview Answer
3 views
"Design a feature flag system like LaunchDarkly" is a compact system design interview question that rewards candidates who think about latency, consistency, and safety rather than just storage.
Clarify what the product does
Engineers create flags (boolean or multi-variant), define targeting rules ("enable for 10 percent of users in Canada" or "enable for accounts on the enterprise plan"), and change them without deploying code. Application servers and mobile clients evaluate flags thousands of times per second. Requirements worth stating: flag evaluation must be extremely fast (sub-millisecond), changes should propagate within a few seconds, and the system must keep working even if the flag service itself is down.
Core insight: evaluate locally
The single most important point to make is that applications should not call a remote API for every flag check. Instead, an SDK inside each service downloads the full rule set for its environment, keeps it in memory, and evaluates flags locally. That turns a network call into a hash map lookup and removes the flag service from the critical path.
Data model
Flags: key, type, variations, default value, environment, version. Rules: ordered list of conditions (attribute, operator, values) and the variation to serve. Percentage rollouts use deterministic hashing: hash(flag_key + user_id) mod 100 decides the bucket, so a user consistently sees the same variation and rolling from 10 to 20 percent only adds users rather than reshuffling them.
Propagating changes
When someone edits a flag in the dashboard, the write goes to a primary database, a change event is published, and a streaming layer (server-sent events or WebSockets) pushes the new version to connected SDKs. SDKs also poll occasionally as a fallback. Each flag carries a version number so clients ignore stale or out-of-order updates.
Resilience
- SDKs persist the last known rule set to disk or a local cache so a restart during an outage still has flags.
- Every flag has a safe default in code.
- A relay proxy inside the customer's network can fan out updates to many servers and reduce outbound connections.
Client-side and mobile flags
Browsers and phones should not receive every rule, since rules can leak business information. Instead, a server evaluates flags for that user and sends only the results, cached by a CDN keyed on a user context hash.
Safety and governance
Interviewers often ask about operational risk. Mention audit logs for every change, approval workflows for production, scheduled rollouts, automatic kill switches tied to error-rate alerts, and cleanup reminders for stale flags that have been at 100 percent for months.
Analytics
SDKs batch evaluation events and send them asynchronously to an event pipeline, which powers experiment results and "who saw what" debugging.
How to present it
Spend the first few minutes on requirements, then lead with local evaluation, because that one decision explains the rest of the design. Practicing that narrative aloud helps a lot. Some candidates also use Linkjob AI (https://linkjob.ai), which gives real-time help during job interviews and technical interviews, to keep their structure clear when interviewers dig into edge cases like deterministic bucketing.