Free, fast, schema-checked PDF rendering.
Publish a template with a JSON Schema. Every request is validated against it before a single glyph is typeset — then rendered in a supervised Typst worker, with no headless browser and no per-page fees.
How it works
From template to PDF in three steps.
PostgreSQL and S3 hold every published version. Renderers stay stateless, so any replica can restart, read-through a miss, and serve the same bytes.
Publish your Typst source, fonts, static assets, and a JSON Schema as one version. Objects are content-addressed, so a published version stays exactly as you shipped it.
Validate. Each request's data is checked against the version's schema before anything compiles. Invalid input fails early, with a clear error instead of a broken PDF.
Render. A supervised worker compiles Typst and returns PDF bytes — no host CLI, shell, or headless browser in the path.
Versioned by content hash
Objects are content-addressed and checked against their manifest SHA-256. A published version renders identical bytes on every replica — indefinitely.
No headless browser
Typst runs in a fixed pool of supervised workers with a hard deadline and SIGKILL. No Chromium, no host Typst CLI — that is where the throughput comes from.
Your infrastructure, no per-page fees
Runs on the PostgreSQL and S3 you already operate. Free and open source, with templates and data that never leave your network.
Architecture
How the pieces fit together.
Quickstart
Clone it and run the whole stack.
The quickstart Compose file pulls the prebuilt image and starts Katagami, PostgreSQL, and MinIO with local credentials — no cloud account needed. The production Compose file runs against object storage you already operate.
Publish a template and render a PDF$ git clone https://github.com/BRO3886/katagami.git
$ cd katagami
$ docker compose up -d
$ curl http://127.0.0.1:8080/v1/templates
{"templates":[]}
Benchmark
No browser in the path, so renders stay cheap.
100 requests at concurrency 4, 2 CPU / 2 GiB per renderer on an 8-CPU ARM64 host, zero failures on both services. This compares a pre-published Typst template against browser-based HTML conversion for the same document — not a universal renderer claim. See the methodology for the full setup.
FAQ
Frequently asked questions
What is Katagami?
Katagami is a self-hosted Typst PDF rendering API. You publish a Typst template, fonts, static assets, and a JSON Schema as one immutable version, then POST JSON data to render a PDF.
How does Katagami render a PDF?
Each render request's data is validated against the published JSON Schema before anything compiles. A supervised worker then compiles Typst and returns PDF bytes, with no host CLI, shell, headless browser, or render working directory in the path.
Can a published version be changed?
No. A published version is a fixed unit of schema, source, fonts, static assets, and the hashes of every object it references. Its content cannot change; changing a template means publishing a new version. Callers pinned to an older version keep receiving exactly the same document.
What happens if I publish a version name that already exists?
Publishing over an existing version returns 409; you publish a new version name instead. A version may later be retired, which keeps it durable but stops rendering it.
How is request data validated?
Every render request's data is checked against the version's published JSON Schema before Typst is invoked. Data that does not match the schema is rejected with a 422, so the caller gets a clear error instead of a confusing compile failure or a subtly wrong document.
Can a render request supply arbitrary files?
No. Request assets must be declared in the published manifest's request_assets allowlist; any other name is rejected with 400, so a caller cannot introduce arbitrary Typst file names.
What infrastructure do I need to self-host Katagami?
Katagami runs on PostgreSQL and an S3-compatible object store that you operate. The production Compose file starts only PostgreSQL and Katagami and points at a bucket you control, so templates and data stay on your own infrastructure.
What does Katagami log or expose about my data?
Logs and traces exclude render JSON, request assets, admin tokens, credentials, source files, fonts, and PDF bytes. Metric labels are closed operational classifications and never include template IDs, versions, request data, or asset names.
How much does Katagami cost?
Katagami is free and self-hosted with no per-page fees. You run it on the PostgreSQL and object storage you already operate; there is nothing charged per rendered page or per document.
How fast is Katagami?
In a steady-state invoice workload on an ARM64 host with both renderers capped at 2 CPU and 2 GiB, Katagami measured 1,440-2,151 requests per second over 100 requests at concurrency 4, with zero failures. This is a stored-template API comparison, not a renderer-only claim.
Why does Katagami render so quickly?
Typst runs in a fixed pool of supervised worker processes with a hard deadline and crash isolation, and there is no headless browser or host Typst CLI in the path. Each worker handles one compile at a time, which is where the throughput comes from.