Developer builds lean HTML-to-PDF API using Postgres, Chromium, and no extra services
A solo developer built DocPenny, an HTML-to-PDF generation service, over twelve weeks using SvelteKit, Hono, PostgreSQL, pg-boss, Chromium, and S3-compatible storage — deliberately avoiding Redis, Kafka, or Kubernetes. The system uses pg-boss, a job queue built on top of Postgres, to handle traffic bursts, allowing the API to accept around 5,900 documents per second while workers render at roughly 63 PDFs per second. To manage memory efficiently, PDFs are streamed in 1 MB chunks directly from Chrome to S3 via multipart upload, keeping per-document memory usage at a fixed ~20 MB regardless of file size. Sensitive template data is encrypted with AES-256-GCM using HKDF-derived keys at render time and never persisted, while signed webhooks and short-lived artifacts further reduce security exposure. The developer notes that businesses for whom PDFs are a byproduct rather than a core product may be better served by managed APIs, but shares the full architecture as a blueprint for those who choose to build.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in