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.

    Save and favourite prompts with a free account.

    Share this prompt