Demo — synthetic data — not a payment service

Payments ledger · reconciliation console · Portfolio project

Money that is never lost or created, even when everything around it fails.

The ledger and the console a payments operations team closes its day with: payouts and collections over ISO 20022 to a bank that answers late, twice or not at all; a double-entry ledger the database itself keeps balanced; the bank statement matched by versioned rules; and every cent that differs explained, corrected by four eyes, and closed on a frozen report.

Demo — synthetic data — not a payment service.

Reconciliation of Thursday 19 November: opening and closing balances from the camt.053 statement, 10 of 13 lines matched by rule set RS-2026.11-a, eight breaks listed with their kind, age and amount; BRK-1013, a date mismatch of €910.00, opened with the bank's line against the ledger's posting, and the resolution panel offering a manual match, an adjustment entry, a suspense entry or to wait
01 · The need

Every evening, the bank and the ledger must agree to the cent.

A payments company holds its merchants' money at a bank and owes it back to them. Each day an operations team has to prove the two sides match — and explain, with evidence, every cent that does not.

01

Every payment accounted for

A payout or a collection is a balanced entry from the moment it is asked for, follows the bank's answers through its states, and is never sent twice — whatever the network retries.

02

The bank and the ledger, side by side

The day's statement matched line by line against the ledger by published rules; the money the bank holds set against the money the ledger owes, the difference explained by named breaks.

03

A day that can be closed

Every break resolved by a correction a second person approves, or carried over with its reason; then the day closed on a report frozen with its hash, and nothing posted into it again.

02 · The invariants

What the ledger holds to, at every instant.

Rules the domain checks and the database checks again at commit, whatever the code did — because money written wrongly is not a display bug.

01

Every entry balances

Σ debits = Σ credits, or nothing is written: the domain refuses it, and a deferred constraint trigger refuses it again at commit. The trial balance on every screen reads €0.00.

02

Nothing is ever edited

The journal and every history are append-only by trigger. A correction is a reversing entry and a new one, linked to the original, proposed by one person and approved by another.

03

Unknown is not rejected

A timeout says nothing about the bank: the payout goes to unknown, the money stays in transit, nothing is retried blindly, and a pacs.028 inquiry or the statement decides.

04

A demo, and it says so

Not a payment service, no licence claimed, synthetic data only: generated merchants and IBANs, a fictional Bank of Arden, zero external calls, and a banner on every screen.

03 · The console

Built and running.

Stills of the live console on its staged week: the day close, four-eyes approvals, the overview of ledger against bank, the payout whose outcome is unknown, fault injection, ISO 20022 explained field by field, and the engineering guide.

The day close of Friday 20 November, controller only: the checklist — statement received, breaks resolved or carried over with a reason, nothing waiting for a second person, trial balance at zero, running balances equal to their postings, suspense explained — the carry-over table with each break's reason, and the frozen reconciliation report of Thursday 19 November as an A4 sheet
The day close: a checklist, then a report frozen with its hash
Four-eyes approvals: proposals APR-0419, APR-0417 and APR-0414 waiting, the selected adjustment for an unexpected €12.50 bank fee with the entry the API worked out, the deterministic checks passed, and the proposer shown that they cannot approve their own
Four eyes: the API refuses an approval by the proposer
The overview of Friday 20 November at 15:30: the safeguarding position, the ledger's €7,269,437.69 against the bank's €7,274,368.89, the €4,931.20 gap explained by eight open breaks; the latest statement matched by rule, the payment lifecycle, the break queue and exactly-once counters
The ledger against the bank, the gap explained by its breaks
Payout PO-1120-04471 of €3,275.00 in state unknown: the bank did not answer in time, so the outcome is unknown, not rejected; the money stays in transit until a pacs.028 inquiry or the statement says; the state timeline from validated to submitted to unknown
A timeout is unknown, never rejected
Fault injection scoped to the visitor's sandbox: a duplicate bank message, out-of-order statuses, a timeout after the bank debited, a crash mid-transaction, a duplicate API request, a lost statement, a deducted fee and a late return — each one injectable, with Σ = €0.00 shown live beside them
Break something, and watch Σ stay at €0.00
The interop screen: the pain.001 of payout PO-1120-04471 as sent to the bank, its XML lines, each field explained on hover — message id, end-to-end id, amount, creditor and IBAN
ISO 20022, field by field
The engineering guide for senior engineers and CTOs: the five invariants of the ledger, and how each is enforced in the domain and again in PostgreSQL, with a PDF to download
The engineering guide, and its PDF
04 · Choices

Weighed, chosen, and why.

Each key decision, with the alternatives, the choice and its reason. Each one is written down as a decision record in the repository.

  1. 01

    Where the invariants live

    Weighed
    An ORM and checks in code · PostgreSQL with plain SQL and triggers
    Chosen
    PostgreSQL through plain SQL migrations: a deferred constraint trigger checks every entry balances at commit, row triggers refuse any update, delete or truncate of the journal and the histories.
    Because
    The rule holds whatever code reaches the table — and a test suite in plain SQL proves it with no application code at all.
  2. 02

    How money is held

    Weighed
    Floats · decimal objects · integers in minor units
    Chosen
    Integers in cents as bigint in the database and BigInt in TypeScript, parsed from and printed as decimal strings at the edges, one Money type shared by every part.
    Because
    No float ever sits between the database and the screen, so no cent appears or vanishes in a rounding.
  3. 03

    What the bank's messages post

    Weighed
    Post from the statement · post from intraday messages, reconcile with the statement
    Chosen
    The intraday messages — pacs.002, camt.054, pacs.004 — post; the end-of-day camt.053 statement never posts, it is only matched against the ledger.
    Because
    If the statement posted, the ledger would agree with the bank by construction and reconciliation would prove nothing.
  4. 04

    Exactly once over an at-least-once network

    Weighed
    Retries and hope · distributed transactions · idempotency, outbox and inbox
    Chosen
    An idempotency key on every request; the bank message written to an outbox in the entry's own transaction; every incoming message stored by its id before it is processed.
    Because
    A crash at any line leaves either nothing or something a relay finishes once — a property test plays random sequences of payouts, duplicates, crashes and bank kills to prove it.
  5. 05

    Who may change what

    Weighed
    Sign-in and roles · open personas with four eyes enforced by the API
    Chosen
    No login: three personas, switched in the header, each visitor in a PostgreSQL schema of their own with a demo clock; the API, not the screen, refuses an approval by the proposer.
    Because
    A reviewer can play both roles in a minute and see the rule refuse them, without anyone's actions reaching anyone else's sandbox.
05 · How it's built

From the payout request to the closed day.

A simulated bank speaking ISO 20022, a NestJS API in bounded contexts behind ports, PostgreSQL holding the invariants, and a console that only shows what the ledger says.

01

Bank of Arden

A separate service simulating a bank over ISO 20022: pain.001 in, pacs.002, camt.054, pacs.004 and camt.053 out, with late, duplicated, reordered, withheld and fee-deducted messages on demand.

02

Model

Plain TypeScript shared by every part: Money in minor units, the payment state machine, the account chart, the matching rules and their versions.

03

Ledger API

NestJS 12 in eight bounded contexts behind ports — ledger, payments, bank connectivity, reconciliation, approvals, chaos, audit, demo — on PostgreSQL in SERIALIZABLE transactions.

04

Console and server

Next 16 and React 19 on its own design system, live by server-sent events; PM2 and nginx on my own server, business gauges in Prometheus metrics, deploys reported to Zeus and watched by Iknos.

06 · Status

What is built, and what is next.

Live as a demo, built ticket by ticket, each decision written down as it is taken.

Built · ledger and payments

  • Double-entry ledgerAccounts, balanced append-only entries, running balances equal to their postings, business days, enforced in the database.
  • Payouts and collectionsIdempotent requests, the state machine, the outbox and inbox, unknown payouts and their pacs.028 inquiry.
  • Bank of ArdenThe ISO 20022 bank simulator, and fault injection on both sides of the wire.

Built · reconciliation

  • Matching and breaksVersioned rules, every break classified and aged, a staged week of breaks to work through.
  • Four eyes and closeCorrections proposed and approved by two people, the day closed on a frozen report with its hash.
  • Audit, guide and regulatoryThe append-only trail, an engineering guide with its PDF, and a page on PSD2, PSD3, safeguarding and ISO 20022.

Next

  • A break assistantA model proposing a resolution for a break, gated by the same checks and still approved by a second person.
  • More schemesSEPA Instant and card settlement files behind the same ledger and rules.
  • Multi-currencyFX legs and revaluation, with the trial balance still at zero per currency.

Close a day,
on your own sandbox of a payments week.

Open a break and propose a correction — then switch to the controller and see you cannot approve your own. Inject a duplicate bank message or a crash mid-transaction, and watch Σ stay at €0.00. Ask the bank about the unknown payout with a pacs.028.