“Design a scalable frontend for a large web application (e.g. dashboard, e-commerce, chat app)”
“Before jumping into the design, I’d like to clarify the requirements.”
“The app is a SPA served via CDN. It communicates with backend services through APIs, and we cache data on the client to reduce unnecessary requests.”
“I prefer feature-based architecture because it scales better and reduces coupling.”
Feature-based structure
/features/auth/dashboard/settings/shared/components/hooks
“I separate server state from UI state to avoid overusing global stores.”
| Type | Solution |
|---|---|
| UI state | Local state |
| Global state | Redux / Zustand |
| Server data | React Query / SWR |
| Auth | Context + storage |
“Initial load is optimized using code splitting and lazy loading, while frequently used data is cached.”
“Sensitive tokens are stored securely and never exposed directly to JavaScript.”
“Even when APIs fail, the UI should fail gracefully and guide the user.”