← System Design

Component APIs That Age Well

mediumCore Concept
Asked at
Adobe
Atlassian
GitHub
Salesforce
Shopify
Stripe
Adobe, Atlassian, GitHub, Salesforce, Shopify, Stripe

Problem statement

Design React public APIs that survive the next three call sites: composition over boolean soup, discriminated variants, additive changes, and honest deprecations.

Asked In

ShopifyAdobeGitHubAtlassianSalesforceStripe

Key Challenges

  • ·Evolving props without breaking callers
  • ·Avoiding boolean prop explosion
  • ·Composition over configuration flags
  • ·Versioning design-system components safely
★

2-Minute Answer — High-Level TL;DR

Read this before your interview

HLD Interview Focus

I future-proof components by designing a small public API: composition for variation, discriminated props for modes, and additive changes only. I avoid boolean soup like isCompact+isInverted+hasIcon. When I must break, I version or provide a codemod — I never silently change the meaning of an existing prop.

→

My Approach: Building the Solution

How to think about this problem

A Button that starts as <Button primary /> becomes a graveyard of flags in six months. Future-proofing is API design for React components.

Why This Approach?

Weak answers add another boolean. Strong answers make variants compositional and make impossible states unrepresentable.

A power strip with clear sockets beats a single plug with twelve mystery switches. Composition is sockets. Boolean props are mystery switches.

R

Requirements: What Makes a Great Solution?

Clarify scope before designing anything

Requirements Exploration Questions

Ask your interviewer these questions to refine requirements

Who owns the component?

  • ·App-local
  • ·Design system
  • ·Multiple products

What will change next quarter?

  • ·Sizes
  • ·Modes
  • ·Async loading
  • ·Permissions

Functional Requirements

Must Have — MVP

  • ✓Small public prop surface
  • ✓Composition escape hatches
  • ✓Documented variants
  • ✓Deprecation path

Advanced (If Time Permits)

  • +Codemods
  • +RFC process for breaking changes
  • +Package versioning

Non-Functional Requirements

Interview bar

  • ·Name the invariant in one sentence
  • ·Give one concrete failure of the naive approach
  • ·State when the pattern is the wrong tool
Premium

The full solution is part of HelloFrontend Pro

The question above is free to read in full. Upgrade to unlock the interactive workspace and the senior-level walkthrough that go with it.

  • Full RADIO-framework walkthrough with architecture diagrams
  • Data model, API design, and rendering strategy trade-offs
  • Performance, accessibility, and offline sections plus a model answer
Unlock the full solution →

Already a member? Log in to open the workspace.

More System Design questions

View all System Design →