Frontend School
DashboardProblemsLearnPracticeMock InterviewReportsStatsBuy Credits
DashboardProblemsLearnPracticeMock Interview
Frontend System Design Roadmap
  1. 1.HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)
  2. 2.TCP and TLS Handshakes: Connection Setup Costs
  3. 3.Browser Network Stack and Connection Pooling
  4. 4.GET vs POST and Idempotency in HTTP
  5. 5.The Critical Rendering Path (CRP)
  6. 6.DOM, CSSOM and the Render Tree
  7. 7.Layout, Paint and Compositing
  8. 8.Reflows and Repaints Explained
  9. 9.Event Loop: Call Stack, Task and Microtask Queues
  10. 10.Async JavaScript: Promises and async/await
  11. 11.Web Workers: Multi-threading in the Browser
  12. 12.Browser Storage: Cookies, Web Storage, IndexedDB
  13. 13.Client-Side Storage: Limits and Security Risks
  14. 14.Choosing the Right Client-Side Storage
  15. 15.HTTP Caching: Cache-Control, ETag, Last-Modified
  16. 16.Browser-Level Caching Mechanisms
  17. 17.Cache Invalidation for Frontend Apps
  18. 18.Structuring a Large Single-Page App
  19. 19.Component-Based Architecture Principles
  20. 20.Props, State and Component Lifecycle
  21. 21.Module Bundling Basics
  22. 22.Core Web Vitals: LCP, INP and CLS
  23. 23.FCP and Time to Interactive (TTI) Explained
  24. 24.Measuring Performance: Lighthouse and WebPageTest
  25. 25.Asset Compression and Minification Basics
  26. 26.What Is a CDN and How Does It Work?
  27. 27.CDN Benefits: Latency, Availability, Offload
  28. 28.CDN Cache Behavior and Invalidation
  29. 29.Global State vs Local Component State
  30. 30.State Patterns: Redux, Zustand and Context
  31. 31.Data Fetching: React Query and SWR
  32. 32.Immutable Data in Frontend State
  33. 33.SSR vs CSR: Rendering Trade-offs
  34. 34.Hydration and Time to First Byte (TTFB)
  35. 35.Static Site Generation (SSG) for Speed and SEO
  36. 36.Incremental Static Regeneration (ISR)
  37. 37.Micro-Frontends: Core Principles
  38. 38.Micro-Frontend Integration Strategies
  39. 39.Communication Between Micro-Frontends
  40. 40.Micro-Frontends: Pros and Cons for Large Teams
  41. 41.Real-Time: Polling, SSE and WebSockets
  42. 42.Real-Time Use Cases: Chat, Alerts, Live Data
  43. 43.Designing a Real-Time Data Flow
  44. 44.Scaling WebSocket Connections
  45. 45.Responsive Images: srcset, sizes and picture
  46. 46.Modern Image Formats: WebP, AVIF, JPEG XL
  47. 47.Lazy Loading Images and Videos
  48. 48.Video Streaming: HLS, DASH, Adaptive Bitrate
  49. 49.REST and GraphQL for Frontend Engineers
  50. 50.Batching, Throttling and Debouncing API Calls
  51. 51.Handling API Errors in the Frontend
  52. 52.Authentication Flows: OAuth and JWT
  53. 53.Global Error Boundaries in React
  54. 54.Error Reporting: Sentry and LogRocket
  55. 55.Graceful Degradation and Fallback UIs
  56. 56.Real User Monitoring (RUM)
  57. 57.CORS: Cross-Origin Resource Sharing
  58. 58.Preventing XSS (Cross-Site Scripting)
  59. 59.CSRF Protection for Frontend Apps
  60. 60.Content Security Policy (CSP)
  61. 61.Storing Auth Tokens: Cookies vs localStorage
  62. 62.PWA Manifest and Installability
  63. 63.Service Workers: Lifecycle and Caching Strategies
  64. 64.Offline Support and Background Sync
  65. 65.Push Notifications for Web Apps
  66. 66.Webpack vs Vite vs Parcel
  67. 67.Code Splitting, Tree Shaking, Asset Optimization
  68. 68.Module Resolution and Hot Module Replacement
  69. 69.Monorepo Tooling: Nx and Lerna
  70. 70.Atomic Design for Component Libraries
  71. 71.Theming and Customization in Design Systems
  72. 72.Accessibility in Component Libraries
  73. 73.Component Library Docs, Testing and Versioning
  74. 74.Publishing and Consuming a Component Library
  75. 75.Full-Text Search: Levenshtein and Fuzzy Matching
  76. 76.Indexing Large Datasets in the Browser
  77. 77.Search Performance: Debouncing and Web Workers
  78. 78.Integrating Backend Search Services
  79. 79.Choosing a Chart Library: D3, Chart.js, Recharts
  80. 80.Rendering Large Datasets: Canvas vs SVG
  81. 81.Interactive, Responsive Data Visualizations
  82. 82.Data Fetching and Aggregation for Dashboards
  83. 83.A/B Test Design and Rollout Strategies
  84. 84.Client-Side vs Server-Side A/B Testing
  85. 85.Feature Flags and Remote Configuration
  86. 86.Experiment Data Collection and Analytics
Frontend System Design Roadmap
85

Frontend System Design · Lesson 85 of 86 · 3 min

Feature Flags and Remote Configuration

This topic tests your ability to design for operational safety, gradual rollouts, and experimentation—core skills for a senior role.

After this lesson, you'll be able to explain how to separate code deployment from feature release. This is the core purpose of feature flags. It allows you to merge and deploy unfinished work, mitigate risk by rolling features out gradually, and run experiments.

A feature flag is a conditional that gates a code path. Remote configuration is the system that delivers the state of that flag (and other dynamic values) from a server. Flags are just one type of remote config; you can also ship strings, numbers, or JSON objects to tweak app behavior without a new build.

This capability is the foundation for canary releases, kill switches, and the A/B tests discussed in the previous lesson. It is a prerequisite for effective trunk-based development.

What a robust client-side implementation looks like

In an interview, you should be able to sketch out a client-side implementation. The most common pattern in a component-based framework is a provider that fetches flags and a hook that consumes them.

This approach centralizes the logic for fetching, caching, and providing defaults.

import React, { createContext, useContext, useEffect, useState, ReactNode } from 'react';

type FlagValues = Record<string, boolean | string | number>;
const FeatureFlagContext = createContext<FlagValues>({});

// Simulate fetching from a remote service
async function fetchRemoteConfig(): Promise<FlagValues> {
  await new Promise(resolve => setTimeout(resolve, 100)); // network delay
  return {
    'new-checkout-flow': true,
    'header-text': 'Special Offer!',
    'item-limit': 20,
  };
}

export function FeatureFlagProvider({ children }: { children: ReactNode }) {
  const [flags, setFlags] = useState<FlagValues>({});

  useEffect(() => {
    fetchRemoteConfig().then(setFlags);
  }, []);

  return (
    <FeatureFlagContext.Provider value={flags}>
      {children}
    </FeatureFlagContext.Provider>
  );
}

export function useFeatureFlag<T>(name: string, defaultValue: T): T {
  const flags = useContext(FeatureFlagContext);
  const value = flags[name];
  return value === undefined ? defaultValue : (value as T);
}

The trap: A naive implementation like this causes UI flicker. The component renders once with an empty flags object, using default values. After the network request completes, it re-renders with the correct flag values, causing a visible layout shift.

To prevent this, you must provide the initial flag values before the first render. The best way is to evaluate flags on the server and embed them in the initial HTML document your server sends. The client can then bootstrap the provider with these values, ensuring the first render is correct.

Designing the end-to-end system

Beyond the client, you need to describe the full system. This includes the tools for managing flags and the service that delivers them.

A complete system has four main parts: an admin dashboard, a configuration service, a database, and the client-side SDK that consumes the data.

The Config Service API is the core. It takes a context object from the client (containing user ID, location, device type, etc.) and evaluates a set of rules to return the correct flag payload for that specific user.

"How do you ensure the client gets updated flag values quickly?"

Your answer should cover a hybrid approach. The SDK fetches on initial load. For subsequent updates, you can use periodic polling, which is simple but introduces latency. For faster updates, a real-time connection like WebSockets or Server-Sent Events allows the server to push changes instantly. The service can also use ETag or Last-Modified headers so clients can efficiently check for updates without re-downloading the entire payload.

How to manage flag lifecycle and avoid "flag debt"

The trap: Treating all flags as permanent. This is a common mistake that leads to "flag debt"—a codebase cluttered with dead if statements that are hard to reason about and test. A senior engineer knows that most flags are temporary and plans for their removal.

A mature flag lifecycle has four stages:

  1. Creation: A flag is created for a new feature, experiment, or operational control, and is tied to a ticket.
  2. Rollout: The flag is used to expose the feature.
  3. Resolution: The feature is either rolled out to 100% or rolled back. The experiment concludes.
  4. Cleanup: The flag is removed from the codebase and the flagging system. This is the most forgotten step.

To enforce cleanup, you can use static analysis to find code referencing stale flags. Require a cleanup ticket to be linked when a flag is created. Categorizing flags by purpose (release-toggle, experiment, ops-toggle) also helps clarify their intended lifespan.

Try it

In a personal project, find a hardcoded value, like a UI message or an API endpoint. Refactor it to be retrieved from a simple useFeatureFlag hook like the one above, with a hardcoded default. This takes about 15 minutes and builds the muscle memory for this pattern.

Next: We'll cover how to process the results from these experiments in Experiment Data Collection and Analytics.

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Client-Side vs Server-Side A/B Testing

Next

Experiment Data Collection and Analytics