---
type: "article"
title: "Pagination you won't regret in two years"
summary: "Offset pagination feels obvious and betrays you at scale. Here's the cursor pattern, minus the hand-waving."
newsletter: "API Bytes"
newsletter_handle: "api-bytes"
newsletter_url: "https://staging.in.usecommune.com/n/api-bytes"
author: "Fran Méndez (@fmvilas)"
published: "2026-08-13T08:30:00.000Z"
canonical_url: "https://staging.in.usecommune.com/n/api-bytes/a/pagination-you-wont-regret"
markdown_url: "https://staging.in.usecommune.com/n/api-bytes/a/pagination-you-wont-regret.md"
chat_url: "https://staging.in.usecommune.com/n/api-bytes/a/pagination-you-wont-regret/chat"
body_source: "native"
likes: 2
replies: 0
body_words: 71
---

# Pagination you won't regret in two years

Offset pagination is the tutorial answer. Cursor pagination is the production answer.

The moment your data mutates while someone paginates, offsets start skipping and duplicating rows. Cursors encode a stable position, so the page you get is the page you meant.

- Return an opaque cursor, never a raw row id you might change.
- Make the cursor encode the sort key + tiebreaker.
- Document that cursors are not forever.

***

## Discussion

No replies yet.
