Skip to content

Architecture

Web app, REST API, CLI, MCP and SDKs over one command layer

Every capability is a Command (a change) or a query (a read) in one registry. The web app, the REST API, the CLI, the MCP server and the SDKs are surfaces of that registry: they are generated from it or call it, and none of them can do what the others cannot. Every Command passes the same checks (payload, rights, Freigabeklasse and Freigaberichtlinie, second factor where needed), runs in one database transaction, and is written to the Command-Log with its actor and Begründung; its Events leave through the outbox (webhooks, event.poll, consumers of a build).

An installation is one binary, decuma, with the web app and the rule data embedded, one PostgreSQL database with row-level security per Mandant, and one Belegablage (a directory or an S3-compatible bucket).

Path Holds
crates/ The Rust workspace: decuma-core (money, ids, clock), decuma-commands (the command layer), decuma-store (PostgreSQL, migrations, isolation suite), one crate per domain, decuma-api, decuma-cli and decuma-mcp (the surfaces), decuma-server (the decuma binary)
app/ The web app (Svelte), embedded in the binary
openapi/, sdk/ The OpenAPI document and the SDKs (Python, TypeScript, Rust), Apache-2.0
regelwerk/ Rule data (Kontenrahmen, Steuerschlüssel, form definitions, Fristen), each entry with its primary source
docs/ These docs and the decisions (ADRs)

What the open layer leaves out on purpose, and how to add it yourself: Ports and hooks. How results are checked: Verification.

Every Mandant has one chain of Command-Log entries; every Account has one chain of the same format for the Commands without a Mandant (registration, sign-in, creating a Mandant). A third party can verify an exported chain with scripts/verify_chain.py, which does not use the product code.

Each entry is hashed as this JSON object:

Key Value
v 1, the format version
mandant_id or account_id the UUID of the chain’s owner, lower-case with hyphens
seq sequence number, integer, starting at 1 without gaps
at instance time of the Command, RFC 3339 in UTC with exactly six fractional digits and Z (2026-01-10T09:00:00.000000Z)
actor object with kind (human, api_schluessel, regel, agent, system) and the id (account_id for a human, name for the installation itself, id otherwise)
command the stable name of the Command
payload the payload as JSON, every secret field replaced by the string [secret]
result the result as JSON, secret fields replaced the same way
freigabeklasse ledger_write, filing, money, external_communication, bulk_correction, submission, administration, or null (exports and Commands of persons)
begruendung string or null
prev the hash of the previous entry in lower-case hex; 64 zeros for the first entry
origin only when the caller set one: {kind, id, display_name} (strings), who or what the call came from beyond its Actor (an automation, an integration); an entry without an origin has no origin key, so its hash is the same as before the key existed
batch_id only for an item of a batch (command.batch, ADR 0056) and what it ran inside: the UUID all items of that batch share; without one there is no key, as for origin

Amounts are strings ("100.00"), never JSON numbers with a fraction. The idempotency key is stored next to the entry and is not hashed, with payload_hash: SHA-256 over the key, a zero byte and the canonical JSON of the unredacted payload, which a repeat of the key is compared with (another secret field under the same key is a conflict).

hash = SHA-256(JCS(entry)), where JCS is the JSON Canonicalization Scheme of RFC 8785 (keys sorted, no whitespace, UTF-8). The stored hash and prev_hash are the raw 32 bytes; exports give them in hex.

Walk the entries in order of seq. The first entry whose seq is not the previous plus one is a gap; whose prev is not the hash of the previous entry is a previous fault; whose recomputed hash differs from the stored one is a content fault. The query history.check (and account.history.check for an Account) reports the first fault with its sequence number.

A Freigabe binds a person to one Meldungsstand: everything that would be transmitted, and nothing else. Its hash is what the Freigabe stores and what every Übermittlung compares (ADR 0009, ADR 0025). A third party can recompute it with scripts/verify_meldungsstand.py, which does not use the product code.

Key Value
v 1, the format version
meldungsart umsatzsteuer_voranmeldung
formular {kennung, gueltig_ab}: the Formulardefinition version, gueltig_ab as YYYY-MM-DD
steuernummer the Steuernummer of the Mandant as entered, or null
zeitraum 2026-12 for a month, 2026-Q4 for a quarter
version integer, 1 for the first Meldung of the period, then one more per transmitted version
werte object from the field key of the Formulardefinition (81, z13.steuer, 83) to the reported value as a string: the fields with a value and 83 always; in a Berichtigung also a Kennzahl of the corrected version that is now zero, with 0
declarant only where the installation has an electronic way: {name, street, postal_code, city, steuernummer (13 digits), recipient: {number, name}}, each a string or null; a change voids the Freigabe

Values: full euros without decimals for a Bemessungsgrundlage ("20700"), two decimals for every other amount ("3933.00", "-76.00"), "1" for Kennzahl 10 of a Berichtigung. Only fields with a value are present, and the required ones always (Kennzahl 83, "0.00" when nothing is owed). A Korrektur in the Journal that leaves every value unchanged leaves the object, and so the hash, unchanged.

hash = SHA-256(JCS(object)), where JCS is the JSON Canonicalization Scheme of RFC 8785 (keys sorted, no whitespace, UTF-8), as for the Command-Log (above). The stored hash is the raw 32 bytes; queries and exports give it in lower-case hex (stand_hash, hash).

python3 scripts/verify_meldungsstand.py < stand.json prints the hex hash of the object on standard input; with --hash <hex> it exits 1 when they differ. The export contains every Freigabe (tabellen/meldung_freigabe.json, columns stand and hash) and every Übermittlung (tabellen/uebermittlung.json).

The same object and hash with meldungsart einkommensteuer, formular {kennung: "est", gueltig_ab: "2025-01-01"}, zeitraum the Veranlagungsjahr ("2025"), version 1, and one key more: personen, ["a"] for one Person or one spouse under Einzelveranlagung (["b"] for the second), ["a", "b"] for a Zusammenveranlagung. werte maps the key of a form value (<anlage>[.<a|b>][.<objekt>].<z<zeile> or name>, for example n.a.z5, v.1.z85, g.a.z51.messbetrag, kind.kinderbetreuung) to the value as entered in Mein ELSTER: a decimal with a point and no trailing zeros ("60000", "16.5"), a date YYYY-MM-DD, or a text. The computed tax is not part of the object.

The same object and hash with meldungsart lohnsteuer_anmeldung, formular {kennung: "lsta", gueltig_ab: "2026-01-01"}, zeitraum the Anmeldungszeitraum ("2026-01", "2026-Q2", "2026"), and one key more: betrieb, the id of the Betrieb. werte maps every Kennzahl the product fills (86, 42, 48, 49, 61, 62, 83) to its value, always present: two decimals for an amount ("2083.91", "0.00"), a whole number for Kennzahl 86 ("2"); a Berichtigung (version 2 or more) adds "10": "1".