Design a News Feed UI
Problem statement
Design an infinite-scroll news feed with virtual scrolling, real-time updates, optimistic interactions, and accessibility — covering the core frontend architecture decisions.
Asked In
Key Challenges
- ·Media-heavy infinite feed with smooth 60fps scrolling
- ·Cursor pagination stability under live inserts/deletes
- ·Optimistic like/comment interactions with safe rollback
- ·Realtime updates without disrupting scroll position
- ·Mobile-first performance on degraded networks
2-Minute Answer — High-Level TL;DR
Read this before your interview
HLD Interview Focus
I would design the feed as an experience, not a list. Cursor-paginated pages keep inserts stable; a virtualized window keeps DOM tiny so scrolling stays at 60fps; likes paint immediately with a rollback snapshot; and realtime updates bump counts in place while new posts wait behind a banner so the user's place in the feed never jumps. Media loads lazily with blur-up placeholders. The hard part is not rendering PostCard — it is preserving scroll context while the world keeps changing underneath.
My Approach: Building the Solution
How to think about this problem
I'll start from what the user feels while scrolling — instant likes, no jump when new posts arrive, smooth media — then design the data pipeline (cursor pages, cache, optimistic writes) and only then the component tree with a hard split between server state and UI state.
Why This Approach?
Most candidates draw a list of PostCards and stop. That answer collapses the moment the interviewer says "what if a like fails on a flaky network?" or "10,000 posts land in the feed." Strong answers treat the feed as a system that bets on success, pays back failures, and bounds work to what is on screen.
A like is not like toggling dark mode. Dark mode only changes your screen. A like is shared, survives refresh, and must show on the user's phone — so it is only real after the server saves it. Waiting for that round trip makes every tap feel broken; painting first and rolling back on failure is the bet worth taking.
Requirements: What Makes a Great Solution?
Clarify scope before designing anything
Requirements Exploration Questions
Ask your interviewer these questions to refine requirements
What type of content should the feed support?
- ·Images only vs images + videos
- ·Image formats (JPEG, WebP, AVIF)
- ·Video formats (MP4, WebM)
- ·Maximum file sizes
What devices and network conditions?
- ·Mobile (3G, 4G, 5G) vs desktop (WiFi)
- ·Offline support requirements
- ·Progressive loading expectations
What interactions should be supported?
- ·Like, comment, share, save, report
- ·Double-tap to like
- ·Long-press actions
- ·Swipe gestures (mobile)
What is the expected feed size?
- ·Average posts per user
- ·Maximum posts to keep in memory
- ·When to unload posts (performance)
What real-time features are needed?
- ·Live like counts
- ·New post notifications
- ·Story updates
- ·Live video streams
Functional Requirements
Must Have — MVP
- ✓Infinite scrolling feed (10–20 posts per page)
- ✓Images with progressive loading (videos optional)
- ✓Like/comment interactions with optimistic updates
- ✓Skeleton loading + error states
- ✓Cursor pagination
- ✓Basic caching + retry logic
- ✓Accessibility basics (semantic HTML, ARIA labels)
Advanced (If Time Permits)
- +Real-time updates (WS/SSE) with "new posts" banner
- +Offline queue + IndexedDB
- +Video autoplay policies + data saver mode
Non-Functional Requirements
Performance Targets
- ·Initial load: < 3s (Time to Interactive)
- ·Scroll performance: Maintain 60fps
- ·Interaction feedback: < 100ms (optimistic updates)
- ·Memory usage: < 200MB for 100 posts
Scalability Goals
- ·Support 1M+ concurrent users
- ·Handle 10K+ posts in feed
- ·Efficient memory management (virtual scrolling)
Reliability & UX
- ·Graceful error handling with retries
- ·Skeleton loading and clear empty/error states
- ·New-post banner without interrupting scroll position
Accessibility & Security
- ·WCAG 2.1 AA baseline (keyboard + screen reader support)
- ·Proper semantic HTML and ARIA labels
- ·XSS/CSRF protection and strict API auth
Network Resilience
- ·Works on slow connections (3G/4G)
- ·Compressed responses (gzip/brotli)
- ·CDN-backed media delivery
Observability
- ·Error tracking and monitoring
- ·Core Web Vitals tracking (LCP, FID, CLS)
- ·API latency/error dashboards
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
Already a member? Log in to open the workspace.