06
How would you design an infinite scroll system for a social app?
Tap to write answer
0 words | 0 charsPress Enter ↵ to reveal
Your Attempt
0 wordsRefined Model Answer
ReferenceBefore designing it, I would clarify whether the feed is purely chronological or ranked, because that changes pagination and caching. At a high level, I would use cursor-based pagination instead of offset-based pagination so the user gets stable results as new content arrives. I would store feed items in a way that supports fast lookups by user and timestamp, and I would make sure the API returns a cursor for the next page. The trade-off is that cursor-based pagination is a little more complex than simple offsets, but it scales much better and avoids duplicate or missing items when the underlying data changes. I would also consider caching the first few pages because that is where most traffic usually lands.