[API] Limit embedded events in GET /v1/streams/:streamId
Overview & Background
GET /v1/streams/:streamId embeds every event row with no limit: include: { ... events: { orderBy: { timestamp: "desc" } } } — no take. The dedicated events endpoint paginates at max 200 (MAX_EVENTS_PAGE_SIZE), but the single-stream response returns the entire event history. A long-lived stream with tens of thousands of events produces unbounded memory/serialization, and the endpoint is unauthenticated — a trivially abusable amplification.
Technical Specification & Architecture
- Add a small
take(e.g. latest 20) to the embeddedeventsrelation inbackend/src/controllers/stream.controller.ts:289-298. - Point clients at
GET /:streamId/events(already paginated) for full history. - Document the embedded-events limit in the OpenAPI spec generated by
codegen:openapi.
Target Files
backend/src/controllers/stream.controller.ts- OpenAPI codegen inputs
Acceptance Criteria
- [ ] Embedded events are capped at a documented count.
- [ ] Response size for a stream with 50k events is bounded.
- [ ] Full history remains reachable via the paginated events endpoint.
@Babanla0011 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
please assign, i will submit PR now
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Babanla0011 to this issue.
@edrizxabdulganiyu-blip has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
Hello Maintainer, I've reviewed the issue description and I'm confident I can work on it effectively. Please assign it to me.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @edrizxabdulganiyu-blip to this issue.
@simplex001 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
i can resolve
ℹ️ Repo Maintainers: To accept this application, review their application or assign @simplex001 to this issue.
Congratulations, @simplex001! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.
🧑💻 @simplex001: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
This issue has been completed by @simplex001 as part of the Stellar Wave Program's 11th Wave 🥳
😎 @simplex001: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.