Koepe do Brasil, 2026
Reports that brought the API down
The problem
XLSX and PDF reports were generated inside the API itself. Large exports loaded everything into memory and took the service down for everyone.
Result
Exports stopped bringing the API down, and one client generating a large report no longer takes the system offline for everyone else. Users request the file, keep working, and download it straight from S3 through a presigned URL.
What I did
- Moved exports out of the API into an event-driven microservice on RabbitMQ.
- Made the worker stream from MongoDB and stream the file to S3, never holding the whole report in memory.
- Added retries and a dead letter queue so no export fails silently.
- Wired it into the React front end with a real-time notice when the file is ready, isolated per tenant.
Request
the API answers at once and publishes an event
RabbitMQ
queue with retries; failures go to the DLQ
Worker
streams from MongoDB, builds XLSX or PDF
AWS S3
streamed upload, flat memory use
Download
presigned URL and a real-time notice