Local feature-flag evaluation

Architected an Amplitude-based local evaluator that collapsed 10 network calls into 1 and brought sub-millisecond decisions to the request path. Shipped at 100% coverage with zero breaking changes.

10 → 1
API calls / request
< 1 ms
decision latency
100%
test coverage
0
breaking changes
Role
Architect & lead engineer
Timeline
Aug 2024 - Mar 2025
Stack
TypeScript, Amplitude SDK, Node, Jest
Tags
Architecture, JS SDK

§Context

Every meaningful decision in our platform (pricing experiments, gated features, region rollouts) passes through a feature flag. We were evaluating each one remotely, which meant ten flags on a single request became ten round-trips. The cost was hidden inside p99 graphs until someone went looking.

§What I did

  • Replaced the remote-evaluation pattern with a local evaluator backed by a periodically refreshed rule set.
  • Built a drift detector that compares local vs. remote decisions on a sampled slice of live traffic, with Slack alerts on disagreement.
  • Wrote a flag-by-flag migration path so the change rolled out behind its own flag. Yes, feature-flagged feature flags.
  • Got the change to 100% test coverage and shipped with no API breaks for consumers.

§Outcome

The hot path got measurably quicker, the on-call story got simpler, and the pattern became the default for new flag work across two more teams.