Loading...
Loading...
RADIO framework, UI components, application architecture, and the patterns SDE-2 frontend interviews expect.
Module 8 · Frontend System Design
Design large-scale frontend systems: RADIO framework, UI components vs applications, rendering strategies, state management, performance, accessibility, i18n, and security.
Design large-scale frontend systems using the RADIO framework: Requirements, Architecture, Data model, Interface (API), and Optimizations — plus UI component vs application questions, rendering, state, performance, accessibility, i18n, and security.
Frontend System Design is about architecture — not just building UI. SDE-2 interviews ask you to design autocomplete, news feeds, chat apps, and explain trade-offs across performance, scalability, and accessibility.
This module covers the RADIO framework (Requirements, Architecture, Data, Interface, Optimizations), question types, rendering and caching patterns, WCAG accessibility, i18n, security, and the quick-fire answers interviewers expect.
You will practice structuring answers for autocomplete, infinite scroll feeds, real-time chat, and e-commerce flows — with explicit trade-off discussions for scalability, offline support, and API design.
The RADIO framework gives interview answers a clear shape: clarify requirements first, sketch architecture, define data models, specify API contracts, then layer optimizations for performance, accessibility, i18n, and security.
Frontend system design rounds appear at every major tech company for SDE-2 roles. You must structure answers with RADIO, pick the right rendering and caching strategy, and discuss accessibility, i18n, and security trade-offs — not just draw boxes. Strong candidates clarify requirements first and justify every architectural choice.
Architecture, components, performance, and scalability — not just UI.
Frontend System Design is designing the architecture, components, performance, and scalability of frontend applications. It's about how to build large-scale systems — not just implementing UI.
Structure every system design answer with this interview framework.
Requirements Exploration
Architecture / High-Level Design
Application Architecture ├─ Frontend Framework (React, Vue, Angular) ├─ State Management (Redux, Zustand, Context) ├─ Rendering Strategy (SSR, SSG, CSR, ISR) ├─ API Layer (REST, GraphQL, tRPC) ├─ Data Caching (Redis, React Query, SWR) └─ Deployment (CDN, Edge, Server)
Data Model
// Example: News Feed type User = { id: string; name: string; avatar: string; }; type Post = { id: string; userId: string; content: string; timestamp: Date; likes: number; }; type Feed = { posts: Post[]; hasNextPage: boolean; cursor: string; };
Interface Definition (API)
// News Feed API GET /api/posts?cursor={cursor} → { posts: Post[], cursor: string, hasNextPage: boolean } POST /api/posts → { id: string, content: string } PUT /api/posts/{id} → { id: string, content: string }
Optimizations and Deep Dive
Interview tip
UI components vs full applications — know both.
Type 1 — UI Components
| Component | Difficulty | Key Concepts |
|---|---|---|
| Autocomplete | Medium | Debouncing, caching, virtualization |
| Image Carousel | Medium | Accessibility, lazy loading, swipe |
| Dropdown Menu | Medium | Keyboard nav, focus management |
| Modal Dialog | Medium | ARIA, Esc key, focus trap |
| Rich Text Editor | Hard | Toolbar, undo/redo, formatting APIs |
| Data Table | Hard | Virtualization, pagination, sorting |
| Collaborative Editor | Hard | Real-time sync, conflict resolution |
Type 2 — Applications
| Application | Difficulty | Key Concepts |
|---|---|---|
| News Feed (Facebook) | Medium | Infinite scroll, pagination, caching |
| E-commerce (Amazon) | Hard | Search, filters, cart, checkout |
| Chat App (Messenger) | Hard | WebSockets, real-time, offline |
| Photo Sharing (Instagram) | Medium | Image upload, compression, CDN |
| Medium | Masonry layout, infinite scroll | |
| Video Streaming (Netflix) | Hard | Buffering, adaptive bitrate, CDN |
| Travel Booking (Airbnb) | Hard | Maps, search filters, booking flow |
| Video Conferencing (Zoom) | Hard | WebRTC, low latency, screenshare |
| Music Streaming (Spotify) | Hard | Persistent playback, queueing, offline |
| Collaborative Spreadsheet | Hard | Real-time sync, conflict resolution |
Pick the right strategy for content freshness vs performance.
| Strategy | When | Use Case | Performance |
|---|---|---|---|
| SSR | Per request | Dynamic, user-specific content | Medium |
| SSG | Build time | Docs, blogs, marketing pages | Fastest |
| CSR | Browser | Highly interactive apps | Slowest initial load |
| ISR | Build + rebuild | Product pages, news | Fast + fresh |
| Streaming | Progressive | Large pages, slow components | Progressive |
Match the tool to app complexity and data-fetching needs.
| Library | Type | Use Case | Pros | Cons |
|---|---|---|---|---|
| Redux | Centralized | Complex apps | Predictable, dev tools | Boilerplate |
| Zustand | Centralized | Simple global state | Minimal API | Less structured |
| Context | Local | Theme, auth | Built-in | Re-renders all consumers |
| React Query | API cache | Server data | Caching, deduping | External lib |
| Jotai | Atomic | Fine-grained state | Minimal, atomic | Less known |
Rendering, caching, lazy loading, and input throttling.
1. Virtualization
import { FixedSizeList } from "react-window"; <FixedSizeList height={600} itemCount={10000} itemSize={50} > {({ index }) => <Item index={index} />} </FixedSizeList>
Renders only visible items — O(visible) vs O(n). Essential for large lists and data tables.
2. API Caching (React Query)
const { data } = useQuery({ queryKey: ["posts"], queryFn: fetchPosts, staleTime: 5 * 60 * 1000, // 5 minutes gcTime: 30 * 60 * 1000, // 30 minutes });
Dedupes requests, background refetch, offline support.
3. Lazy Loading & Code Splitting
const HeavyComponent = lazy(() => import("./HeavyComponent")); const routes = [ { path: "/home", component: lazy(() => import("./Home")) }, ]; import(/* webpackChunkName: "admin" */ "./Admin");
Reduces initial bundle size by loading routes and components on demand.
4. Debouncing & Throttling
// Debounce — wait for user to stop typing const debouncedSearch = debounce((query: string) => { fetch(`/api/search?q=${query}`); }, 300); // Throttle — limit to once per interval const throttledScroll = throttle(() => { console.log("Scrolling"); }, 1000);
| Pattern | Behavior | Use Case |
|---|---|---|
| Debounce | Wait until action stops | Search input, resize |
| Throttle | Limit call frequency | Scroll, mousemove |
REST, GraphQL, WebSockets — pick by data shape and real-time needs.
| Pattern | Use Case | When to Use |
|---|---|---|
| REST | Simple CRUD APIs | Standard resource endpoints |
| GraphQL | Flexible queries | Reduce over-fetching, complex graphs |
| tRPC | TypeScript end-to-end | Type-safe full-stack TS apps |
| WebSockets | Real-time bidirectional | Chat, live updates, games |
| SSE (Server Push) | Server → client events | Notifications, progress |
Pagination
Perceivable, Operable, Understandable, Robust.
// ARIA labels <button aria-label="Close modal">✕</button> // Dialog semantics <div role="dialog" aria-modal="true" aria-labelledby="title"> <h2 id="title">Modal Title</h2> </div> // Focus trap in modals — Tab cycles within dialog // Return focus to trigger on close
Locale, pluralization, RTL, and formatting.
import { useTranslation } from "react-i18next"; const { t } = useTranslation(); t("welcome", { name: "John" }); // "Welcome, John"
XSS, CSRF, auth, and secure data handling.
| Threat | Prevention |
|---|---|
| XSS | Sanitize inputs, avoid dangerouslySetInnerHTML, CSP headers |
| CSRF | CSRF tokens, SameSite cookies, CORS |
| Auth | JWT, OAuth, secure session tokens, httpOnly cookies |
| Sensitive data | Encrypt, never store tokens in localStorage |
| Headers | HSTS, Content-Security-Policy, X-Frame-Options |
15 answers to memorize for rapid interview rounds.
| # | Question | Answer |
|---|---|---|
| 1 | Frontend System Design? | Architecture, components, performance, scalability |
| 2 | RADIO framework? | Requirements, Architecture, Data, Interface, Optimizations |
| 3 | Component vs Application? | Component = widget; App = full system |
| 4 | Virtualization purpose? | Render only visible items (O(visible) vs O(n)) |
| 5 | Debounce vs Throttle? | Debounce = wait for stop; Throttle = limit frequency |
| 6 | SSR vs SSG vs CSR? | SSR = per request; SSG = build; CSR = browser |
| 7 | React Query purpose? | API caching, deduping, background updates |
| 8 | WCAG? | Perceivable, Operable, Understandable, Robust |
| 9 | XSS prevention? | Sanitize inputs, avoid dangerouslySetInnerHTML |
| 10 | WebSockets? | Real-time bidirectional (chat, live updates) |
| 11 | GraphQL vs REST? | GraphQL = flexible queries; REST = simple CRUD |
| 12 | i18n concepts? | Locale, pluralization, RTL, currency |
| 13 | Lazy loading? | Reduce initial bundle size |
| 14 | Cursor vs Offset? | Cursor = efficient; Offset = slow at scale |
| 15 | CDN purpose? | Global distribution, faster static assets |
Ten points to structure any frontend system design answer.
Common interview questions about frontend system design.