Front-End System Design Interview Coaching: Architecting a Real-Time News Feed
The front-end system design round (common for mid-level and senior roles, 2–5 years of experience) evaluates how you translate ambiguous product requirements into a scalable client-side architecture. Unlike back-end system design, interviewers focus on UI component boundaries, normalized client caching, rendering performance, network resilience, accessibility, and clear trade-off reasoning.
This coaching guide walks through a complete 45-minute simulation for a classic prompt: "Design a real-time social news feed with infinite scroll and optimistic interactions."
Question Index
| Phase | System Design Area | Target Timing | Difficulty |
|---|---|---|---|
| 1 | Minute-by-Minute Pacing Plan | 0–45 min | Foundational |
| 2 | Functional & Non-Functional Requirements | 0–5 min | Foundational |
| 3 | High-Level Architecture (Mermaid Diagram) | 5–12 min | Medium |
| 4 | Component Tree & Data Model | 12–20 min | Medium |
| 5 | APIs, Pagination & Real-Time Updates | 20–27 min | Medium-Hard |
| 6 | State Management, Caching & Optimistic UI | 27–34 min | Hard |
| 7 | Performance & Accessibility Deep Dive | 34–41 min | Hard |
| 8 | Key Trade-offs & Common Mistakes | 41–45 min | Senior |
1. Minute-by-Minute Plan (45-Minute Interview)
| Window | Objective | What the Interviewer Looks For |
|---|---|---|
| 0–5 min | Clarify scope & requirements | Asking targeted questions before jumping into solutions |
| 5–12 min | High-level architecture | Clean separation of shell, feed store, network layer, and UI |
| 12–20 min | Component tree & data model | Normalized entities, clean props, TypeScript contracts |
| 20–27 min | APIs & pagination | Cursor pagination, real-time transport choice |
| 27–34 min | State & caching | Deduplication, stale-while-revalidate, optimistic rollbacks |
| 34–41 min | Performance & accessibility | Virtualization, Core Web Vitals (LCP/INP/CLS), ARIA feed/live regions |
| 41–45 min | Trade-offs & wrap-up | Articulating pros/cons and identifying bottlenecks |
2. Requirements
Functional Requirements
- Render an initial feed of posts (text, images, author metadata, engagement counts) with server-side rendering (SSR) for fast first paint.
- Support infinite scroll to load older posts seamlessly.
- Surface new incoming posts via a non-intrusive "New posts available" banner instead of shifting the user's scroll position.
- Support optimistic likes and bookmarks with automatic rollback on failure.
Non-Functional Requirements
- Performance: Target good Core Web Vitals (LCP <= 2.5s, INP <= 200ms, CLS <= 0.1). Maintain 60 fps scrolling even with 500+ loaded posts.
- Accessibility: Full keyboard navigation, semantic landmarks, and polite screen-reader announcements for dynamic updates.
- Resilience: Graceful offline/error states, retryable requests, and image lazy loading.
3. High-Level Architecture
flowchart TD
UI[Feed Shell & Virtualized List] --> Store[Normalized Client Cache]
UI --> Composer[Post Composer & Optimistic Queue]
Store --> Fetcher[Cursor Pagination & SWR Fetcher]
Store --> Stream[SSE Real-Time Listener]
Fetcher --> API[(REST / GraphQL API)]
Stream --> API
Composer --> API
The architecture decouples rendering (virtualized list + cards) from data orchestration (normalized store + cursor fetcher + SSE listener).
4. Component Tree
FeedPage
├── AppHeader (Search, Notifications)
├── PostComposer (Modal / Inline Form)
├── NewPostsBanner (Triggered by SSE queue, aria-live="polite")
└── FeedList (Virtualized container, role="feed")
├── FeedPostCard (Memoized)
│ ├── AuthorHeader (Avatar, Name, Timestamp)
│ ├── PostBody (Text, LazyMedia via IntersectionObserver)
│ └── ActionBar (LikeButton with optimistic state, BookmarkButton, Share)
└── ScrollSentinel (Triggers next cursor fetch)
5. Data Model
Normalizing entities by ID prevents duplicate data and makes optimistic updates $O(1)$ instead of scanning arrays.
export interface Author {
id: string;
name: string;
handle: string;
avatarUrl: string;
}
export interface Post {
id: string;
authorId: string;
body: string;
mediaUrl?: string;
mediaAspectRatio?: number;
createdAt: string;
likeCount: number;
likedByMe: boolean;
}
export interface NormalizedFeedStore {
postsById: Record<string, Post>;
authorsById: Record<string, Author>;
orderedPostIds: string[];
pendingPostIds: string[]; // Buffered from SSE until user clicks banner
nextCursor: string | null;
hasMore: boolean;
}
6. APIs & Pagination Contract
Cursor-Based Feed Endpoint
GET /api/feed?cursor=eyJpZCI6InBvc3RfOTkifQ==&limit=20
{
"posts": [
{
"id": "post_98",
"authorId": "user_12",
"body": "Shipping accessible virtualized lists today.",
"mediaUrl": "https://cdn.example.com/img.webp",
"mediaAspectRatio": 1.77,
"createdAt": "2026-11-20T10:15:00Z",
"likeCount": 42,
"likedByMe": false
}
],
"authors": {
"user_12": { "id": "user_12", "name": "Asha Rao", "handle": "@asharao", "avatarUrl": "..." }
},
"nextCursor": "eyJpZCI6InBvc3RfNzkifQ==",
"hasMore": true
}
Real-Time Updates via Server-Sent Events (SSE)
Connect new EventSource('/api/feed/stream') to receive lightweight new_post events. Buffer incoming IDs in pendingPostIds and display the "3 new posts" pill so scrolling is never interrupted.
Optimistic Mutation Endpoint
POST /api/posts/:id/like with an idempotency key header (Idempotency-Key: <uuid>) so retries never double-toggle state.
7. State Management & Caching Strategy
- Normalized Cache: Store
postsByIdandauthorsByIdin maps;orderedPostIdsholds the timeline order. Updating a user's avatar or a post's like count updates every view referencing that ID. - Deduplication: When appending a new page or flushing
pendingPostIds, filter against aSetof existing IDs to avoid duplicate React keys. - Optimistic UI: React's
useOptimistic(or a snapshot-and-rollback handler) immediately flipslikedByMeand incrementslikeCount, reverting cleanly if thePOSTrequest rejects. - Stale-While-Revalidate: Render cached feed entries immediately on back-navigation while revalidating the top page in the background.
8. Performance Optimizations
- List Virtualization (Windowing): Render only the visible viewport items plus a 3–5 item overscan buffer using dynamic height estimation so DOM node count stays bounded (~25 nodes instead of 1,000+).
- Preventing CLS: Reserve image space upfront using
mediaAspectRatio(aspect-ratioCSS property) before images finish downloading. - Media Lazy Loading: Use
IntersectionObserverwith arootMargin(e.g.,300px) anddecoding="async"on images below the fold. - Prefetching: Trigger the next cursor fetch when the scroll sentinel enters within
400pxof the viewport bottom, and cancel in-flight requests withAbortControlleron filter changes or unmount.
9. Accessibility
- Semantic Feed & Landmarks: Wrap the timeline in
<main>and userole="feed"witharia-busyduring page loads, or clean<article>cards with clear heading hierarchy. - Live Announcements: Apply
aria-live="polite"on theNewPostsBannerso screen readers announce new posts without interrupting the user's current reading flow. - Keyboard & Focus Management: Ensure every action button has a visible focus ring, an accessible label (e.g.,
aria-pressed={post.likedByMe}on the Like button), and that flushing new posts moves focus to the first newly revealed post if requested.
10. Key Trade-offs
| Decision | Chosen Option | Alternative | Why Chosen |
|---|---|---|---|
| Pagination | Cursor-based | Offset (?page=2) | Offset shifts and duplicates items when new posts arrive at the top |
| Real-Time | Server-Sent Events (SSE) | WebSockets / Polling | Feed updates are server-to-client unidirectional; SSE works over standard HTTP with built-in auto-reconnect |
| Rendering | SSR initial batch + CSR scroll | Pure CSR | SSR delivers fast LCP and SEO; CSR handles infinite scroll and optimistic interactions |
11. Common Mistakes to Avoid
- Prepending live posts automatically: Injecting new posts at the top while the user is reading causes severe layout shift (CLS) and disorientation. Always buffer and let the user opt in.
- Using offset pagination: Leads to duplicate or skipped posts in an active feed.
- Skipping virtualization: Rendering thousands of rich media cards degrades INP and memory on mobile devices.
- Forgetting rollback on optimistic updates: Leaving a "liked" state active after a network 500 error silently misleads the user.
Preparation Checklist
- Practice the 5-minute scoping phase: Rehearse clarifying functional vs. non-functional constraints before drawing boxes.
- Sketch normalized schemas: Be ready to write TypeScript interfaces for
byIdmaps and cursor responses. - Know real-time transport trade-offs: Contrast short polling, long polling, SSE, and WebSockets in two sentences each.
- Tie UI choices to Core Web Vitals: Explain how
aspect-ratioprevents CLS and virtualization protects INP. - Build accessibility in early: Mention
aria-live="polite",aria-pressed, and keyboard navigation without waiting to be prompted.
Conclusion
Succeeding in a front-end system design interview requires balancing user experience, network efficiency, and maintainable client state. By structuring your 45 minutes around clear requirements, normalized data models, cursor pagination, virtualization, and explicit trade-offs, you demonstrate senior-level architectural judgment.