AlgoInsight

Free lesson · Mobile System Design Interviews

Social Feed App - Summary & Variations

Medium9 min readmobilemobile-system-designinterview-prep

Step 5: Wrapping It All Up

You've completed your first case study! Let's take a step back and see everything you've designed.

What We Built: A Quick Recap

Over the past five sections, we designed a complete mobile social feed app. Here's the 30-second summary:

The Goal: A mobile app (iOS and Android) where users can scroll through an infinite feed of posts, like them, comment, create new posts, and use the app even when offline.

The Architecture: We used MVVM + Repository pattern. ViewModels handle UI logic. The Repository is the gatekeeper that decides whether to fetch from the local database (instant, cached) or the network (fresh, but slower). All data flows through the Repository, making the app testable and flexible.

The Feed Loading: We load posts in pages (20 at a time) using cursor-based pagination. We cache aggressively (memory → disk → network) and use "stale-while-revalidate" to show cached posts immediately while fetching fresh data in the background. The UI detects when the user scrolls near the bottom and prefetches the next page.

Offline & Interactions: When the user taps "like," the app updates the UI immediately (optimistically), then syncs to the server. If the network is down, pending actions are queued in a local database. When the network returns, the sync manager pushes all queued actions to the server. If the server rejects an action, the UI reverts.

Images: We cache images in memory (for current scroll) and on disk (survives app restart). We load thumbnails first, then full resolution.

Key Decisions & Trade-offs

Here are the major decisions we made and why:

Decision What We Chose Why Alternative Trade-off
Pagination Cursor-based Stable when data changes, efficient Offset-based (page 1, 2, 3) Requires server to maintain cursor tokens
Caching Strategy Memory → Disk → Network Progressive fallback, always has something to show Only memory or only disk Complexity of 3 layers
Offline Reads Show cached posts Better UX than blank screen Show error Might show stale data
Likes & Comments Optimistic updates Instant feedback, feels snappy Wait for server Risk of reverting if server rejects
Sync Queue Local database table Persists across app restarts In-memory queue Extra database table to manage
Image Upload Presigned URLs Fast, reduces server load Upload through API server Requires cloud storage setup
List Reuse RecyclerView/LazyColumn Smooth scrolling, low memory Create new Views for each item More complex code
Architecture Pattern MVVM + Repository Clear separation, testable, industry standard MVC or MVP Boilerplate code

What We'd Improve With More Time

In a real system, we'd add:

1. Push Notifications

Real social apps notify users when someone likes their post or comments. We'd add Firebase Cloud Messaging (FCM for Android) or APNS (Apple Push Notification service for iOS) to wake up the app with new posts when the user isn't looking.

2. Advanced Image Compression

Photos on phones are often 5-10 MB. We could compress images before upload (reduce to 1-2 MB) without losing visual quality, saving bandwidth and storage.

3. Video Support

Videos are different from images: larger files, need streaming instead of one-shot downloads, require different caching strategies. This adds significant complexity.

4. Analytics & Telemetry

Track what users do: How long do they spend in the app? Which posts get engagement? This data helps the backend optimize the feed algorithm. Privacy-sensitive but valuable.

5. Real-Time Updates

Using WebSockets, the app could update like counts in real-time as other users like a post. Currently, the user only sees updated counts on next refresh. Real-time would feel more alive but adds backend complexity.

6. Feed Algorithm / Ranking

We assumed chronological feed (newest first). Real apps rank posts algorithmically (show engaging posts higher). This requires ML models and different API design.

7. User Search & Discovery

Currently, the app only shows the feed. Full apps let users search for posts or people, discover new content. More API endpoints, more caching strategy decisions.

8. Comments Threading

Replies to comments (nested comments) require a different data structure. We simplified to flat comment lists.

Practice Variations: "What If?" Scenarios

System design is about trade-offs. Different requirements = different designs. Let's practice by changing the requirements:

Variation 1: "The interviewer asks: Support video posts in the feed."

What changes?

API Design:

Caching:

Architecture:

UI:

Network:

Variation 2: "The interviewer asks: Support algorithmic ranking instead of chronological."

What changes?

API Design:

Caching:

Architecture:

UI:

Offline:

Variation 3: "The interviewer asks: The app must work in very low-bandwidth countries (2G networks, high latency)."

What changes?

Image Handling:

Data Transfer:

Caching:

Architecture:

UI:

Variation 4: "The interviewer asks: How do you handle content moderation at the client level?"

What changes?

Client-Side Filtering:

Data Model:

UI:

Caching:

API:

Key Patterns You'll See Again

This case study taught you patterns that appear in almost every system design:

1. Pagination

Every API that returns lists of data uses pagination. Feeds, search results, comment threads—they all use some form of pagination (cursor-based or offset-based).

2. Caching Layers

Memory → Disk → Network is everywhere: social feeds, search results, maps, music streaming. The specifics change, but the pattern is universal.

3. Offline-First Design

Mobile apps must handle offline. Desktop apps connected to the internet still benefit from offline-first thinking (works even if network is slow).

4. Optimistic Updates

Users hate waiting. Anything interactive (like, heart, favorite) should update instantly. This pattern spreads beyond just likes to any user action.

5. Repository Pattern

Abstracting data sources (local vs. remote) is a fundamental design pattern. You'll use it everywhere: database, API, cache, file system.

6. MVVM & Separation of Concerns

UI logic separate from data logic. Test each independently. This applies to all platforms: mobile, web, desktop.

7. Progressive Enhancement

Start simple (chronological feed), then add complexity (ranking, recommendations, real-time). Build incrementally.

Congratulations!

You've completed your first mobile system design case study! You've learned:

✓ How to clarify requirements through questions ✓ How to design simple, clear APIs ✓ How to architect a mobile app with clear separation of concerns ✓ How to make feeds fast through intelligent caching ✓ How to make apps work offline with optimistic updates ✓ How to handle edge cases and errors

You now understand the fundamentals that every successful mobile app uses. From Instagram to Twitter to TikTok, they all use pagination, caching, and offline-first thinking. You've demystified the magic.

What's Next?

You've completed Case Study 1. In future case studies, you'll design:

Each case study will reuse patterns from this one (caching, offline, pagination) but introduce new challenges specific to that domain.

Interview Pro Tips

If you're using this case study to prepare for a system design interview:

Before the Interview

  1. Read this case study two or three times, not just once
  2. Code the examples in Kotlin or Swift. Don't just read; write.
  3. Practice explaining each section to a friend. If you can't explain it simply, you don't understand it.
  4. Draw the architecture diagram from memory (not looking at these notes)

During the Interview

  1. Ask clarifying questions first (just like the mock interview in Section 1)
  2. Start simple (chronological feed, basic caching)
  3. Then add complexity (push notifications, video, ranking)
  4. Be ready to pivot if the interviewer says "now make it support X" (like we did in Variations)
  5. Talk through your thinking out loud. The interviewer wants to hear your reasoning, not just your final answer.

Red Flags to Avoid

Green Flags (What Interviewers Love)

Further Reading

If you want to dig deeper:

Final Thoughts

Mobile system design isn't about memorizing the "right" answer. It's about thinking systematically about trade-offs and constraints.

Every design decision you make:

The best engineers aren't those who know the "perfect" architecture. They're those who understand the trade-offs and can explain their choices clearly.

You've now learned how to do that. You've got this!

Ready for More?

Great job completing this case study! You understand:

In the next case study, you'll apply these lessons to a real-time chat app, where new challenges (message ordering, read receipts, typing indicators) require different solutions.

You're building toward mastery. Keep going!

Back to Mobile System Design Interviews