Getting started

Your first document

Write a small invoice template, give it data, and render it to a PDF.

On this page

This page builds the invoice from the home page. You need three files in one folder.

1. Write the data

The data is plain JSON. Money stays a number; brevier formats it later.

rechnung.json
{
  "firma": { "name": "Muster Versicherung AG", "anschrift": "Hauptstraße 1, 10115 Berlin" },
  "kunde": { "name": "Erika Mustermann", "strasse": "Beispielweg 7", "ort": "50667 Köln" },
  "rechnung": {
    "nummer": "R-2026-0142",
    "datum": "2026-09-25",
    "positionen": [
      { "pos": 1, "text": "Berufsunfähigkeitsversicherung", "betrag": 84.2 },
      { "pos": 2, "text": "Haftpflichtversicherung", "betrag": 7.9 }
    ],
    "summe": 92.1
  }
}

2. Write the template

The template is Markdown with {{ }} tags. Each tag names a field in the data. {{#each}} repeats a table row for every item in a list.

rechnung.md
---
style: rechnung.css
---

{{ firma.name }}, {{ firma.anschrift }}

An: {{ kunde.name }}, {{ kunde.strasse }}, {{ kunde.ort }}

# Beitragsrechnung {{ rechnung.nummer }}

Datum: {{ rechnung.datum | date }}

| Pos. | Leistung | Betrag |
| --- | --- | ---: |
{{#each rechnung.positionen}}
| {{ pos }} | {{ text }} | {{ betrag | money }} |
{{/each}}

**Summe {{ rechnung.summe | money }}**

| date prints 25.09.2026. | money prints 84,20 €.

3. Style the page

The stylesheet sets the paper size, the margins and a page counter.

rechnung.css
@page {
  size: A4;
  margin: 25mm 20mm 25mm 25mm;
  @bottom-right {
    content: "Seite " counter(page) " von " counter(pages);
  }
}
body { font: 10pt/1.4 sans-serif; }
table { width: 100%; border-collapse: collapse; }
td:last-child, th:last-child { text-align: right; }

4. Render

brevier render rechnung.md --data rechnung.json -o rechnung.pdf

Open rechnung.pdf. It has your data, German number formats and a page counter at the bottom.

Change a value in rechnung.json and render again. The template does not change. This is how your application uses brevier: one template, new data for each document.