Build a Feature Flag Service
Build a feature flag management service with percentage rollouts, targeting, and a JavaScript SDK.
Requirements
Create flags with: key, description, default value (on/off)Percentage rollout: flag is on for X% of users (consistent per user ID)User targeting rules: enable for specific user IDs, emails, or attributesEnvironment support: dev, staging, productionAudit log: who changed what flag and whenDashboard: list all flags, toggle, edit rules, view usageJavaScript SDK for easy flag evaluationTechnical Notes
Use consistent hashing for percentage rollouts (hash userId + flagKey for deterministic bucket). Store flags in database with caching.
Bonus Points
A/B testing mode (multiple variants, not just on/off)Flag dependencies (flag B only on if flag A is on)SDK with real-time updates via SSE