Skip to content
Prelum

Independent HTTP service for Typst

Run Typst behind a production-ready API.

Prelum is an open-source service by GISGRO Oy. Send Typst source, assets and data; receive PDF, SVG or PNG through one versioned HTTP API.

POST /v1/render
{
  "source": "= Hello from Prelum",
  "output": {
    "format": "pdf"
  }
}

How Prelum fits with Typst

Typst is the open-source markup language and compiler developed by Typst GmbH. It owns the document syntax, layout engine and output formats. Prelum is an independent GISGRO Oy project that runs the compiler and adds a versioned HTTP API, authentication, resource limits and a container-ready operational boundary.

In this documentation, a Typst project means the input to one compilation: the required Typst source plus any request-provided files and data. Prelum does not store these projects or resolve templates by name; every render request is self-contained.

Why Typst for document generation?

A browser can also generate a PDF and is often the right choice when the document is already a web page. Typst starts from a different premise: the page—not the viewport—is the primary output.

  • Precise, repeatable pages

    Typst lays out content in physical page coordinates. With a pinned Prelum image and controlled fonts and packages, the same source and data produce the same pagination and page geometry within that runtime, without depending on browser navigation or page-load timing.

    Explore Typst's page model →

  • Document logic in one language

    Lightweight markup, reusable styles and scripting work together. Data-driven reports do not need a separate DOM, print stylesheet and client-side JavaScript layer.

    Read about syntax and scripting →

  • PDF requirements are first-class

    Typst generates tagged PDFs by default and supports selectable PDF versions, archival PDF/A profiles and PDF/UA-1 checks. Vector PDF preserves page geometry at any zoom; when fixed raster dimensions are required, Prelum provides explicit PNG PPI.

    See Typst's PDF support →

When HTML-to-PDF is the better fit

Choose browser-based generation when the source of truth is already HTML, the PDF must closely match an existing web view, or the template depends on browser-specific CSS or JavaScript. Choose Typst when the document itself is the product: reports, invoices, certificates, forms and other repeatable page-based output.

What you get

  • one strict, versioned POST /v1/render API;
  • PDF versions, PDF/A and PDF/UA conformance options;
  • direct PNG and SVG output or bounded multi-page ZIP archives;
  • request-local images, fonts and modules;
  • read-only operator-mounted fonts and local packages;
  • bounded request, render, queue and output resources;
  • a non-root, multi-platform container image with SBOM, provenance and a Cosign signature.

Try it locally

After cloning the repository, build the container and start it with the public development token:

docker build -t prelum:latest .
docker run --rm -p 9870:9870 \
  -e PRELUM_ENVIRONMENT=development \
  prelum:latest

Render the checked-in example:

curl --silent --show-error --fail-with-body \
  http://localhost:9870/v1/render \
  -H "Content-Type: application/json" \
  -H "X-Prelum-Api-Token: dev-only-insecure-token" \
  -d @examples/render-request.json \
  --output hello.pdf

Continue with Getting started, then see the render request and output formats.

Caller-supplied programs

A render request contains Typst source that reaches the compiler. Read the security model before exposing Prelum outside a trusted network.