Feature flags decouple deploying code from releasing features. Flag model - Key (new-checkout-flow), type (boolean or multivariate), default value, and targeting rules: internal users, specific tenants, percentage rollout, region, app version. - Deterministic bucketing: hash(flagKey + userId) mod 100 so a user consistently stays in the same group across requests and devices. Platform choice - Managed services: LaunchDarkly, Unleash, Flagsmith, ConfigCat; or open standards with OpenFeature SDKs (Java and JavaScript) to avoid vendor lock-in. - A simple in-house option: flags in a database table, cached in memory and refreshed periodically (or via pub/sub), exposed through an admin UI with audit logging. Java backend - Evaluate flags through a FlagService abstraction (or OpenFeature's client), with in-memory caching so evaluation never needs a network call per request. - Always enforce flags server-side for business behaviour and security — the API must reject calls to a disabled feature, not just hide the button. - Safe defaults: if the flag service is unreachable, fall back to the last known values or a conservative default (usually off). React frontend - Fetch evaluated flags for the current user from the backend (or via the provider's client SDK) at startup. - Provide them through context and a hook: const enabled = useFlag('new-checkout-flow'); - Avoid flicker by loading flags before rendering affected screens. Rollout process - Internal users, then 1%, 10%, 50%, 100%, while monitoring error rates, latency and business KPIs (conversion), with a kill switch for instant rollback. - Keep APIs backward compatible while a flag is partially enabled — both the old and new frontend variants call the same backend. - For experiments (A/B testing), record which variant each user saw for analysis. Governance and hygiene - Each flag has an owner, purpose and expiry date; remove the flag and dead code once fully released (stale flags become technical debt). - Test both flag states in automated tests. - Audit every flag change (who, when, old and new value), and restrict who can change production flags.
Ravindra Wadile · · 0 likes