wasAsked.

Design a feature-flag system for gradual releases across a React frontend and .NET backend.

CRED · Full Stack Developer · 3-4-years · technical

Published

Year not specified · .NET, React, DevOps

Community answers

Posted by wasAsked editorial collection

A feature flag separates deployment from release. Evaluate flags through one typed service and define defaults, owner, expiry date, and removal plan; otherwise temporary branches become permanent complexity. Example: if (await features.IsEnabledAsync("NewCheckout", userContext, ct)) return await newCheckout.ExecuteAsync(command, ct); return await oldCheckout.ExecuteAsync(command, ct); Use stable targeting keys and keep evaluation consistent through a request. Do not use flags as authorization or expose secret configuration. Test both paths, instrument outcomes by variant, and use kill switches for risky integrations. Database/message changes must remain compatible while both paths can run. Remove the old path and flag after a successful rollout.

Backbencher Developer · · 0 likes

A feature-flag system lets you deploy code dark and release it gradually without redeploying. Core model - A flag has a key (new-checkout), an enabled state, and targeting rules: percentage rollout, specific users or tenants, environment, country or app version. - Evaluation must be deterministic: hash(flagKey + userId) mod 100 places a user in a stable bucket, so the same user always sees the same variant. Backend (.NET) - Use Microsoft.FeatureManagement or a provider such as LaunchDarkly, Unleash, Flagsmith or Azure App Configuration. - Evaluate flags on the server for anything security- or data-related; never rely only on hiding a button in React. - Cache flag definitions in memory and refresh them periodically or via push, so evaluation needs no network call per request. - Fail safe: if the flag service is unavailable, use the last known value or a safe default. Frontend (React) - Fetch the evaluated flags for the current user from the backend (e.g. GET /api/flags) at startup, or use the provider's client SDK. - Expose them through a context or hook: if (useFlag('new-checkout')) ... - Avoid flicker: load flags before rendering the affected UI, or render a neutral placeholder. Rollout process - Release to internal users, then 1%, 10%, 50%, 100%, watching error rates, latency and business metrics at each step. - Keep a kill switch to turn a feature off instantly. - Keep frontend and backend consistent: the API must accept both old and new request shapes while a flag is partially on. Governance - Audit who changed which flag and when. - Give each flag an owner and an expiry; remove flags and dead code paths after full rollout to avoid flag debt. - Test both flag states in automated tests.

Ravindra Wadile · · 0 likes

Sign in to add your answer

Related interview topics