Backend microservice · PDF reports · Backend developer
Heartopsy
A Django and Celery microservice that generates tier-gated PDF reports asynchronously. It renders a four-page watermarked document end to end in 937 ms and delivers it through AES-256 encrypted, time-limited presigned S3 URLs.
- Four-page render
- 937 ms
- Subscription tiers
- 4
- Stack
- Django · Celery · Python · Jinja2 · wkhtmltopdf · AWS S3

How a report gets made
- 1 · ValidateJSON Schema contractEvery payload is checked before any work is queued
- 2 · QueueCelery workerRendering runs asynchronously, with retry and exponential backoff
- 3 · ComposeTier-gated templates11 Jinja2 partials; a paywall config decides which sections each tier sees
- 4 · RenderwkhtmltopdfPrint-quality pages with headers, footers, page numbers and watermarks
- 5 · DeliverEncrypted S3 linkAES-256 encrypted, time-limited presigned URL
The PDF engine is 97% of total latency, inside a sub-3-second render budget
What I built
A paywall that cannot leak
A config-driven map from four subscription tiers to report sections: free users get a teaser plus an upgrade CTA, paid tiers unlock measurements, profiles and growth plans. An automated leakage test scans rendered HTML so premium content never reaches free accounts.
Composable documents
11 Jinja2 partials driven by one design-token file: repeating headers and footers, "Page X of Y" numbering and configurable confidential watermarks.
Measured, not guessed
Per-stage timing and correlation-ID logging as structured JSON, enforcing a sub-3-second render budget and isolating the PDF engine as 97% of latency.
Failures with the right status code
Render failures are classified as transient, content or system and mapped to 503, 422 or 500, with automatic retry and exponential backoff.