Design a frontend shopping cart and feature flags
DisneySoftware Engineer · OnsiteLast updated
This question evaluates frontend system-design skills including client-side state management, synchronization and conflict-resolution strategies, caching and offline resilience, performance for large carts, observability, and feature-flag/remote-config design for targeted rollouts and experiments.
Scenario
You are designing frontend-focused systems for a large e-commerce web app.
Part A — Shopping cart (frontend focus)
Design the shopping cart experience across web sessions and devices.
Cover:
- Requirements: anonymous vs. logged-in carts, multi-tab behavior, offline/poor network, real-time price/stock changes.
- Data model (cart item, quantity, variants, promotions).
- Client state management and caching strategy.
- Sync strategy with backend (optimistic UI, conflict resolution, idempotency).
- Performance (rendering large carts, minimizing API calls).
- Observability (metrics, logging) and failure handling.
Part B — Feature flag system (frontend focus)
Design a feature flag / remote config system used to gate UI features.
Cover:
- Targeting (user/segment/percentage rollout), environments, and kill switch.
- Delivery to clients (SDK, bootstrap, caching, polling vs. push).
- Consistency guarantees (what users see across refreshes/devices).
- Safety (flag dependencies, defaults, failure modes).
- Experimentation/A-B testing hooks and metrics.
Assume you can propose APIs and backend components as needed, but focus on frontend architecture and end-to-end behavior.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.