Menu

PDF Generation in a Distroless Go Monolith with Typst
📰

PDF Generation in a Distroless Go Monolith with Typst

DEV Community: go·David Main·8 days ago
#fogPi2Jv
#devtogo#devto#dev#read#let
Long article (1379 words) — no AI summary yet.
Reading 0:00
15s threshold

Our backend was a lightweight Go monolith running in a distroless container. Then we needed server-side PDF generation for healthcare documents.

We tried WeasyPrint and could not get it working within our deployment constraints. Another service was an option, but in our experience each additional service brought more cost, deployment work, and failure points.

We bundled Typst with the Go backend and invoked it as a local child process. AI-assisted coding made writing and iterating on its templates much more approachable.

Why the deployment mattered

Jinja2 and WeasyPrint fit naturally in Python applications. Our Go deployment would also need Python and native text-layout dependencies such as Pango, as described in the installation documentation .

Playwright with Chromium can reuse existing web layouts, but adds a browser runtime and system dependencies.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.