System Design Atlas

Account posting and bank transfers

06 / 10Worked example

The overall architecture

What condition is maintained in the event of a crash before or after the ledger commit?

This runtime topology follows from the data contract: Account interface → Posting API → relational journal storage; Posting API stores Journal and Outbox together. Settlement worker reads Outbox → External settlement; their result → Authenticated Inbox in Journal Store → Posting API. Customer service reads the status via the same API. Internal modules are domain code boundaries; on the other hand, a separate process has its own operational lifecycle.

Starting point Create a referenced reversal posting with its own uniqueness guarantee.

Assumptions for the example case

Our own fictitious example draft: transfer in EUR with positive whole cent amounts; a debited customer account and an internal settlement account; external settlement with status query; reversal posting after proven rejection. Figures and quality goals are illustrative test assumptions. Outside are foreign exchange, interest, fees, regulatory approval check and a complete bank ledger.

Runtime architecture

Runtime topology · a local commit before the external effect

Accounts interfaceRelease and status
Customer serviceReads status through the same API

Intra-bank accounting system

Posting APILocal Commit and Status
Journal storeJournal + Outbox + Inbox
Settlement workerRead the committed outbox
External settlementFinal outcome
Accounts interface → Posting APIRelease / Status
Customer service → Posting APIReading status
Posting API → Journal storeJournal + Outbox atomic
Journal store → Settlement workerOpen instruction
Settlement worker → External settlementSubmit / query A-41
External settlement → Posting APIauthenticated feedback
Posting API → Journal storeInbox commit, then confirm

API and Worker share the relational journal store. The external settlement remains outside the system boundary.

Journal and transmission have different failure points. Posting API and Worker share a transactional journal and outbox store. A crash to commit leaves A-41 detectable, before commit the balance remains unchanged.

Domain modules within the application

Inside the posting API · five modules in one process

Process framework · Booking API

Authorisation checkBinds account, amount and recipient
Balance and JournalLocks accounts and writes balanced
Settlement orderTracks external reference and outcome
Reversal postingCreates the single reversal record
ReconciliationAssigns open instructions
Freigabeprüfung → Saldo und JournalVerified Command
Saldo und Journal → AbwicklungsauftragCommitted Outbox
Abwicklungsauftrag → GegenbuchungDefinitive rejection
Abwicklungsauftrag → AbgleichUnclear result

The modules are local responsibility limits; Journal and Outbox remain a common transaction.

Authorisation check binds the account, amount and payee to authorisation evidence. Balances and ledger locks affected accounts in a fixed order and writes balanced entries. Settlement instruction tracks the external reference and outcome. Reversal posting creates the single reversal record after definitive rejection. Reconciliation assigns open instructions to payment operations.

Operational boundaries

Runtime
Account interface → Posting API → relational journal storage; Posting API stores Journal and Outbox together. Settlement worker reads Outbox → External settlement; their result → Authenticated Inbox in Journal Store → Posting API. Customer service reads the status via the same API.
Persistence
Transactional store for transfer U-41, customer account K-41, settlement account V-41. Leading changes and their repetition result are stored together; external side effects require their own evidence.

Preserve local atomicity

Preserve local atomicity

The posting API and worker share a transactional ledger and outbox store.

Journal and transmission have different failure points.

A crash after commit leaves A-41 discoverable; before commit, the balance remains unchanged.

Alternative considered
Two independently-writing account services require a distributed posting contract.
Trade-off
Schema changes will be rolled out together.
Reassess
Independent ledger teams or measured capacity limits justify reconsidering the boundary.

Terms in this step

Preserve local atomicity
A crash after commit leaves A-41 discoverable; before commit, the balance remains unchanged.

Try it yourself

Draw a crash immediately before and immediately after the shared ledger and outbox commit. State the data recovered in each case.

A hint for your attempt

Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.

Compare with a possible solution
First part of the solution
Before commit, neither debit nor A-41 are visible; K-41 remains at 10,000 cents.
Second part of the solution
After commit, 3,000 cents, both journal lines and A-41 are permanently available. The worker continues exactly this task, even without an original API response.

Apply to your project

Which corresponding assumption in your project would you check first? Use as an occasion: Independent journal teams or measured capacity limits establish a new limit.

Step 7: Preserve an uncertain outcome.