Engineering brief

Document generation as code: from days of debugging to sub-2ms PDFs

InfoQ2 min read · saves 37 min

At a glance

Relevance
Practical value
Warnings
None

A side project using Rust, Typst, and content-addressable storage achieves sub-2ms PDF rendering, turning document workflows into a versioned, reproducible software asset. It solves days-long debugging and compliance nightmares, though Typst's DSL is new and tooling early.

Document generation bottlenecks become a competitive and compliance risk. This approach reduces operational pain and unlocks reproducibility for audits.

Summary

Banks waiting days for trade confirmations and manufacturers debugging print failures over VPNs share a root cause: treating PDF generation as a GUI task, not a software problem. Crystal Reports and heavy runtimes like headless Chrome or LaTeX create fragile, slow, and unrepeatable pipelines.

A real-world side project swaps those out for a Rust library, the lean Typst typesetter, and serverless architecture. With template caching, render times fall below 2 ms. More importantly, content-addressable storage and manifest-based versioning make the whole document bundle auditable and reproducible—a game-changer for compliance.

The approach treats templates like packages: immutable, hashed, and referenceable. The trade-off: Typst's DSL is new and not WYSIWYG, and the 2 ms speed relies on incremental changes. Still, a million PDFs cost less than 50 cents, and debugging shrinks from hours to minutes because both template and data are versioned.

Engineering leaders should see this as a blueprint for turning document workflows into a proper software discipline. The lesson isn't just about speed—it's that applying modern build, cache, and versioning patterns to neglected subsystems can eliminate operational firefighting and deliver regulatory confidence.

Watch the video

This video is blocked due to your privacy settings. To watch this video, please accept YouTube marketing cookies.

Related breakdowns

Get TL;DW

Too Long; Didn't Watch.

A concise breakdowns of the AI and devtools videos that actually matter for engineering leaders.

Free. Weekly. No hype.

Video and thumbnails remain the property of their respective creators. tldw.news provides editorial analysis, commentary, and discovery links to original content.