Cursor Pagination
ELI5 — The Vibe Check
Cursor pagination uses a 'you are here' bookmark instead of page numbers. After getting results, you get a cursor (pointer) to the last item. To get the next batch, you say 'give me everything after THIS item.' It's more reliable than page numbers because it doesn't break when data changes.
Real Talk
Cursor-based pagination uses a pointer (cursor) to mark the position in the dataset, returning items before or after that cursor. It's more stable than offset pagination for real-time data because inserts/deletes don't cause items to shift pages. Used by Twitter, Instagram, and most modern APIs.
Show Me The Code
// First request
GET /api/posts?limit=20
// Response includes: { data: [...], nextCursor: 'post_abc123' }
// Next page
GET /api/posts?limit=20&cursor=post_abc123
When You'll Hear This
"Use cursor pagination for the infinite scroll feed." / "Cursor pagination handles live data better than offset."
Related Terms
GET
GET is the HTTP method for reading data. You're just asking 'can I see that?' — no changes, no side effects.
Offset Pagination
Offset pagination is the classic 'skip X rows and give me the next Y rows' approach. Page 3 of 20 results means skip 40 rows and give me 20.
Pagination
Pagination is splitting a huge list of results into pages.