← Lessons

quiz vs the machine

Gold1350

System Design

The Transaction Journal

Grouping related postings into a single balanced unit of work with shared metadata.

4 min read · core · beat Gold to climb

What a journal is

A journal entry groups the postings that belong to one business event. A single payment may touch several accounts, but they share one journal so they commit or fail together and carry common metadata like a timestamp and a reference.

Why group postings

  • The group enforces the balanced rule, the postings inside a journal must sum to zero.
  • Shared metadata such as the originating transfer id ties the legs together.
  • Atomic commit of the whole journal prevents a half recorded event.

Anatomy

A journal has a header with the event details and a list of lines, each line being one posting against one account. The system validates the lines balance before persisting.

Practical notes

  • Reject any journal whose lines do not sum to zero before writing.
  • Store the journal reference so reversals can point back to the original.
  • Keep journals immutable and reverse with a new balanced journal.

Key idea

A journal is one atomic balanced unit of work that bundles all postings for a single business event.

Check yourself

Answer to earn rating on the learn ladder.

1. What must the lines of a journal satisfy before persisting?

2. Why bundle postings into one journal?