0
Challenge · 73Architecture & State

Pagination

Coreused in ~60% of apps

Your feed has 40,000 posts. Ship them all in one request and you blow the payload budget, freeze the browser, and hammer the database. Pagination is how you hand users one slice at a time — and the two ways to slice (offset vs cursor) decide whether deep pages stay fast and whether a post can show up twice.

Core idea. Pagination splits a large result set into pages the client requests one at a time. Offset/page pagination skips N rows and takes a window (simple, jumpable, but slow and unstable at depth); cursor/keyset pagination asks for rows after a stable marker (fast and consistent, but no random page jumps). Whichever you pick, keep the current page in the URL so it survives reload and sharing.
Playground, this isn't a screenshot
PAGINATION MODE
SHAREABLE URL
pulse.app/feed?page=1
jumpable + bookmarkable
SELECT * FROM posts ORDER BY id DESC LIMIT 4 OFFSET 0
Post 16#16
Post 15#15
Post 14#14
Post 13#13

Try the race: go to page 2, click "New post arrives", then Next. Watch what offset does that cursor does not.

The page lives in the URL (?page=1) — reload or share it and the same view returns. Offset gives jumpable page numbers; cursor gives stable, scalable next/prev.

↑ play a little first, then dig in