Mock Cursor-Based Pagination Response

Generate a cursor-based paginated JSON response with nextCursor and hasMore fields. Ideal for infinite scroll and real-time feed implementations.

Pagination

Detailed Explanation

Cursor-Based Pagination

Cursor-based pagination uses an opaque pointer (cursor) to mark the position in the dataset, rather than page numbers. It is the preferred pagination strategy for real-time feeds, infinite scroll, and large datasets.

Response Structure

{
  "data": [
    { "id": "uuid", "title": "string", "createdAt": "date" }
  ],
  "pagination": {
    "nextCursor": "eyJpZCI6IjEyMzQifQ==",
    "hasMore": true,
    "limit": 20
  }
}

Cursor vs Offset Pagination

Aspect Offset Cursor
Jump to page N Yes No
Consistent with inserts No Yes
Performance at scale Degrades Constant
Implementation complexity Simple Moderate

How Cursors Work

The cursor is typically a Base64-encoded representation of the last item's sort key (e.g., { "id": "1234" } or { "createdAt": "2026-01-15T..." }). The server decodes the cursor and uses it in a WHERE id > :cursor ORDER BY id LIMIT :limit query pattern.

Why Cursors Are Better for Feeds

When new items are added to the beginning of a list (like a social feed), offset-based pagination causes items to shift. A user on "page 2" might see duplicates or miss items. Cursors avoid this because they reference a fixed point in the data.

Frontend Integration

For infinite scroll, the client stores the nextCursor value and passes it as a query parameter in the next request: GET /api/feed?cursor=eyJpZ...&limit=20. When hasMore is false, no more requests are needed.

Use Case

Frontend developers building infinite scroll feeds, chat applications, or activity streams can use this mock to implement and test cursor-based pagination logic without a backend.

Try It — API Response Mocker

Open full tool