Skip to content

Universal Report

A general-purpose report template suitable for most document types.

Template

templates/universal-template.typ

typst
#let data = json.decode(sys.inputs.at("data"))
#set page(margin: 2.5cm)
#set text(font: "Inter", size: 11pt)

= #data.title

#v(0.5cm)

#text(size: 9pt, fill: gray)[
  Generated: #data.date \
  Author: #data.author
]

#v(1cm)

#for section in data.sections {
  == #section.heading
  #section.content
  #v(0.5cm)
}

#v(2cm)

#align(center)[
  #text(size: 8pt, fill: gray)[
    Confidential — #data.company
  ]
]

Metadata

templates/universal-template.json

json
{
  "title": "Universal Report",
  "description": "A general-purpose report template",
  "exampleData": {
    "title": "Q1 2024 Performance Review",
    "date": "March 15, 2024",
    "author": "David Lam",
    "company": "Acme Corp",
    "sections": [
      {
        "heading": "Executive Summary",
        "content": "This quarter showed strong growth across all metrics."
      },
      {
        "heading": "Key Metrics",
        "content": "Revenue increased by 23% compared to Q4 2023."
      }
    ]
  }
}

Usage

bash
curl -X POST http://localhost:3000/api/report \
  -H "Content-Type: application/json" \
  -d '{
    "template": "universal-template",
    "data": {
      "title": "Q1 2024 Performance Review",
      "date": "March 15, 2024",
      "author": "David Lam",
      "company": "Acme Corp",
      "sections": [
        { "heading": "Executive Summary", "content": "Strong growth across all metrics." },
        { "heading": "Key Metrics", "content": "Revenue up 23%." }
      ]
    }
  }' \
  -o report.pdf

Design and Dev by David Lam