Skip to main content
The mobile package provides built-in pagination helpers that work great with mobile clients, supporting both traditional page-based and cursor-based pagination.

Quick Start

Page-Based Pagination

Request: GET /api/users?page=2&per_page=20 Response:

Cursor-Based Pagination

Request: GET /api/feed?cursor=eyJpZCI6MTAwfQ&limit=20 Response:

Page Request

The PageRequest type holds pagination parameters:

Parsing Page Requests

Default Values

  • Page: 1
  • PerPage: 20
  • Limit: 20
  • Maximum: 100 (capped automatically)

Page Request Methods

Page-Based Pagination

Traditional pagination with page numbers and totals.

Response Format

Creating Page Responses

With Filtering

With Sorting

Cursor-Based Pagination

Efficient pagination for infinite scroll and real-time feeds.

Response Format

Creating Cursor Responses

Bidirectional Cursors

Timestamp-Based Cursors

Cursor Encoding

Simple ID Cursors

Composite Cursors

When to Use Each

Page-Based Pagination

Use when:
  • Displaying page numbers (1, 2, 3…)
  • Users need to jump to specific pages
  • Total count is needed
  • Data is relatively stable
Avoid when:
  • Real-time feeds with frequent insertions
  • Large datasets (counting is expensive)
  • Infinite scroll UX

Cursor-Based Pagination

Use when:
  • Infinite scroll UI
  • Real-time feeds
  • Large datasets
  • Data changes frequently
Avoid when:
  • Need to show page numbers
  • Need to jump to specific pages
  • Total count is required

Client Implementation

iOS (Swift)

Android (Kotlin)

Flutter (Dart)

Next Steps

Offline Sync

Delta synchronization for offline-first apps

Structured Errors

Consistent error responses

API Reference

Complete API documentation