Skip to content

Add cursor pagination to the event listing endpoint in src/routes/events.ts #159

Description

@Jagadeeshftw

📌 Description

src/routes/events.ts lists indexed events without a pagination mechanism, so clients polling for new events have no efficient way to page through a large backlog.

🧩 Requirements and context

  • Add cursor-based pagination (e.g. by event id or block/timestamp) with a default and max page size.
  • Return a nextCursor in the response when more results are available.
  • Preserve stable ordering across pages even if new events are inserted mid-pagination.

🛠️ Suggested execution

  1. Add cursor query-param parsing and a stable ORDER BY to the query in src/routes/events.ts.
  2. Return nextCursor/hasMore in the response body.
  3. Extend src/routes/events.test.ts with multi-page pagination coverage.

✅ Acceptance criteria

  • Paginating through all pages returns every event exactly once, in stable order.
  • nextCursor is omitted/null on the last page.
  • Default page size is bounded and documented.

🔒 Security notes

Cursor values must not be guessable/incrementable in a way that lets a client infer internal row ids beyond what's already exposed.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issueStellar WaveIssues in the Stellar wave programapibackendBackend / API work

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions