Design cursor pagination, filtering and sorting for a list endpoint
Tap any variable to replace it with your own value:
AI prompt
Act as a backend architect designing a list endpoint that has to stay fast at millions of rows. Design pagination, filtering and sorting for the endpoint below. Endpoint: [e.g. GET /orders] Resource fields: [list the fields and types] Expected volume: [rows now and in 2 years] Typical client use: [e.g. infinite scroll in a mobile app, nightly export, admin search] Database: [Postgres / MySQL / DynamoDB / other] Return: 1. A decision between cursor and offset pagination for this use, with the tradeoff stated in 2 sentences. 2. The exact query parameters and response envelope, including how the cursor is encoded and what the client sends to fetch the next page. 3. Which fields are filterable and sortable, the parameter syntax for each, and which combinations need a database index. 4. Edge cases: rows inserted mid-scroll, deleted rows, sort ties, a client asking for page size 10,000. 5. Three example requests with their responses. Be concrete. Every parameter needs a name, a type and a default.
Related prompts
- Turn a feature request into an OpenAPI 3.1 endpoint spec
Turn your endpoint design into a complete OpenAPI spec.
- API endpoint documentation writer
Write clear endpoint docs once the parameters and envelope are settled.
- Write a consistent error response spec for your REST API
Define failure responses that match your list endpoint contract.
- Get a senior-engineer critique of your REST or GraphQL API design
Stress-test your pagination and filtering choices before implementation.
- Database schema designer with migrations and indexing
Design indexes and migrations that support your list queries at scale.
- Draft a proper architecture decision record for a tech choice
Record why you chose cursor pagination and its tradeoffs.