Create Connection, Edge, and PageInfo ObjectTypes following the Relay spec. The query accepts first and after arguments. Fetch one extra record beyond the limit to determine hasNextPage. Encode cursors as base64 strings. Return edges with node and cursor fields alongside pageInfo with navigation metadata.
Fetch limit + 1 records to determine hasNextPage without a separate COUNT query.
Encode cursors as base64 opaque strings — clients should not parse or construct them.
The cursor typically encodes the last seen ID or a sort key for stable ordering.
Use after/before for forward/backward navigation; first/last for page size.
Return totalCount so clients can show pagination progress without knowing the full dataset.