System Designhard

Architect a scalable React frontend for an enterprise SaaS platform

Design the frontend architecture for a complex React-based cybersecurity SaaS product. Cover routing, feature boundaries, shared components, state management, API clients, multi-tenant concerns, performance, and testing.

Asked at PlainID

#React#frontend architecture#SaaS#multi-tenant#testing

Answer

Interview framing: For a senior role, show that architecture is about boundaries, change tolerance, and observability, not only folder structure.

Architecture approach:

  1. Feature boundaries:
  • Organize by product domain: policies, identities, resources, decisions, audit, admin.
  • Keep feature-specific components, hooks, and API calls close together.
  • Put only truly reusable primitives in a shared layer.
  1. Routing and layout:
  • Use route-level loading/error states.
  • Keep tenant, workspace, and environment selection explicit in the URL or app shell.
  • Protect routes in the frontend for UX, but enforce permissions on the backend.
  1. State management:
  • Server data should live in a query/cache layer.
  • Local UI state belongs near the component.
  • Complex form/workflow state can use reducers or state machines.
  1. API boundary:
  • Centralize auth headers, error normalization, retries, cancellation, and tracing IDs.
  • Validate important response shapes at runtime when data is security-sensitive.
  1. Performance:
  • Code-split large routes.
  • Virtualize large tables.
  • Memoize expensive policy/resource transformations.
  • Measure slow interactions with real production-like data.
  1. Testing:
  • Unit-test pure logic and permission helpers.
  • Component-test forms, tables, and policy builders.
  • Add focused E2E tests for critical tenant and policy workflows.

Strong closing: "I would optimize the architecture for product teams to ship independently while keeping auth, audit, error handling, and design-system behavior consistent across the platform."

Source: PlainID senior frontend job description

Practise more System Design questions →