System Design
10. API Design and ManagementAnimated
Cursor-Based Pagination
Page using a pointer to the last item seen.
The idea
The cursor encodes the position, giving stable and fast pages for large datasets.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
One client call, several backends.
- step:
- 1/4
- at:
- Client
1/11
The green dot is a request moving through the system.
Step by step
- 1Return items and a cursor
- 2Client sends the cursor back
- 3Query items after that position
- 4Repeat
Where it is used
Feeds and infinite scroll.
Watch out for
Cannot jump to page N.