Digital Banking and Core Ledger Platform

A modern digital bank with an immutable double-entry ledger, accounts, transfers, statements and regulatory reporting, plus how to modernize a legacy core with CQRS and the strangler pattern.

[!ASSUMPTION] Scope "NovaBank", a hypothetical regulated retail bank launching a digital-first proposition while its legacy core banking system (COBOL on mainframe) keeps running existing products. Figures are design assumptions.

1. Business problem and objectives

NovaBank's mainframe core processes nightly batches, so balances in the app lag, product launches take 12–18 months, and the cost per account is high. Objectives:

  • Real-time balances and transaction feeds for all digital products.
  • Launch new deposit and card products in < 3 months via configuration.
  • A ledger that is provably correct: every movement balanced, immutable and auditable.
  • Coexist with the legacy core during a multi-year migration.
  • Meet regulatory requirements: capital/liquidity reporting, AML, strong customer authentication, operational resilience.

2. Business model and revenue generation

Stream Architecture implication
Net interest margin on deposits and loans Accurate interest accrual engine, daily/real-time
Card interchange Card processor integration, authorization holds in the ledger
Fees (FX, premium accounts, overdraft) Product configuration engine, fee postings
Lending products Credit decisioning, repayment schedules
Partner banking-as-a-service Multi-tenant APIs, sub-ledgers per partner

3. Functional requirements

  1. Customer onboarding with KYC/AML checks.
  2. Current and savings accounts, multi-currency pockets.
  3. Internal transfers, domestic payments (instant and batch), standing orders.
  4. Card authorizations (holds), clearing and settlement postings.
  5. Real-time balances (ledger balance and available balance).
  6. Interest accrual and capitalization; fees.
  7. Statements and transaction search.
  8. Overdraft limits and product rules.
  9. General-ledger feed to finance; regulatory reporting.
  10. Corrections via reversals, never by editing history.

4. Non-functional requirements

Attribute Target
Correctness Every journal entry balanced (Σ debits = Σ credits), no lost or duplicated postings
Availability 99.99% for posting and balance APIs
Latency Posting p99 < 50 ms; balance read p99 < 20 ms
Throughput 5,000 postings/s sustained, 20,000/s peak (card clearing, salary runs)
Durability RPO 0 within region; RPO ≤ 1 min cross-region
RTO 15 min (regulatory operational resilience impact tolerance)
Audit Full history retained ≥ 10 years; tamper evidence
Security Encryption, privileged access controls, segregation of duties

5. Expected user base and traffic assumptions

  • 8 M customers, 12 M accounts; 3 M daily active app users.
  • 40 M postings/day average (~460/s), peaks of 10–20K/s during batch clearing windows and salary days.
  • Balance reads ~10× postings; statement queries spike at month start.
  • Journal growth ~15 B entries/year; ~3 TB/year raw.

6. High-level architecture

  • Channels: mobile and web apps, open-banking APIs, branch/agent tools.
  • Customer domain: onboarding, KYC, customer profile, consent.
  • Product domain: product catalog and configuration (interest rules, fees, limits).
  • Ledger core: posting engine (double-entry), account service, balance projections, holds.
  • Payments: payment orchestration, scheme connectors (instant payments, card processor, SWIFT).
  • Read side (CQRS): transaction feed, statements, search, analytics.
  • Finance and risk: general ledger feed, regulatory reporting, AML monitoring, fraud.
  • Legacy integration: anti-corruption layer and CDC from mainframe.

7. Detailed component architecture

Component Responsibility Design choice
Posting engine Validates and records balanced journal entries atomically Single entry point for money movement; idempotency key per instruction
Account service Account lifecycle, status (open, frozen, closed), limits Relational; references product version
Balance projector Maintains current balances per account from journal Synchronous in the posting transaction for available balance; async for analytics
Holds service Card authorization holds reduce available balance Holds as ledger entries in a "pending" layer with expiry
Product engine Versioned product definitions (rates, fees, rules) Effective-dated configuration; products as data
Interest engine Daily accrual postings Batch per partition at end of day; idempotent per account+date
Payment orchestrator Executes payments via schemes Saga with posting + scheme submission + confirmation
Statement/feed service Customer-facing history and search Read model in OpenSearch/PostgreSQL replicas
GL bridge Aggregates postings to general ledger accounts Event-driven, daily reconciliation

8. Architecture diagram

flowchart TB
  subgraph Channels
    MOB[Mobile app] --> GW[API gateway + BFF]
    OB[Open banking TPPs] --> GW
  end
  GW --> CUS[Customer & KYC]
  GW --> ACC[Account service]
  GW --> PAYO[Payment orchestrator]
  GW --> FEED[Transaction feed / statements]
  PAYO --> POST[Posting engine]
  CARD[Card processor] --> HOLD[Holds service] --> POST
  INT[Interest & fee engine] --> POST
  POST --> J[(Journal: append-only<br/>distributed SQL)]
  POST --> BAL[(Balances)]
  J -- CDC --> K[[Event stream]]
  K --> FEED
  K --> AML[AML / fraud monitoring]
  K --> GLB[GL bridge] --> FIN[(Finance GL / ERP)]
  K --> LAKE[(Lakehouse: regulatory reporting)]
  PAYO --> SCH[Scheme connectors<br/>instant, batch, SWIFT]
  MF[(Legacy mainframe core)] -- CDC --> ACL[Anti-corruption layer] --> K
  PROD[Product engine] --> ACC
  PROD --> INT

9. Frontend architecture

  • Native apps with secure enclave-backed keys, biometric login, device binding.
  • Transaction feed with pending (holds) vs booked entries clearly separated.
  • Strong customer authentication for payments: app-based approval with dynamic linking (amount and payee bound to the signature).
  • Accessibility and vulnerable-customer features (spending controls, gambling blocks).
  • Server-driven UI for product offers to avoid app releases.

10. Backend architecture

  • Ledger core in Java 21/25 or Kotlin, minimal dependencies, exhaustive tests including property-based tests (invariants: balances never negative beyond limits, entries always balanced).
  • Hexagonal architecture: posting domain independent of persistence.
  • Commands (post, reverse, hold, release) flow through the posting engine only; no other service writes balances.
  • CQRS: write model optimized for correctness; multiple read models for feeds, statements, analytics.

11. API design with sample endpoints

POST /v1/postings
Idempotency-Key: pay_8c21...
{
  "instructionId": "pay_8c21",
  "description": "Transfer to savings",
  "entries": [
    { "account": "CUR-001-7781", "direction": "DEBIT",  "amount": { "minor": 50000, "currency": "EUR" } },
    { "account": "SAV-001-1290", "direction": "CREDIT", "amount": { "minor": 50000, "currency": "EUR" } }
  ],
  "valueDate": "2026-11-21"
}
-> 201 { "journalId": "jr_01JD...", "status": "POSTED" }

POST /v1/postings/{journalId}/reversals    { "reason": "duplicate payment" }
GET  /v1/accounts/{accountId}/balances     -> { "ledger": {...}, "available": {...}, "asOf": "..." }
GET  /v1/accounts/{accountId}/transactions?from=2026-11-01&cursor=...
POST /v1/holds    { "account": "...", "amount": {...}, "reference": "card-auth-123", "expiresAt": "..." }

12. Database schema and data model

CREATE TABLE account (
  account_id   text PRIMARY KEY,
  product_id   text NOT NULL,
  product_version int NOT NULL,
  currency     char(3) NOT NULL,
  status       text NOT NULL,
  overdraft_limit_minor bigint NOT NULL DEFAULT 0
);

CREATE TABLE journal (
  journal_id     text PRIMARY KEY,
  instruction_id text NOT NULL UNIQUE,         -- idempotency
  type           text NOT NULL,                -- TRANSFER, CARD_CLEARING, INTEREST, REVERSAL
  reverses       text REFERENCES journal(journal_id),
  value_date     date NOT NULL,
  created_at     timestamptz NOT NULL DEFAULT now()
);

CREATE TABLE entry (
  journal_id   text REFERENCES journal(journal_id),
  line         smallint,
  account_id   text NOT NULL REFERENCES account(account_id),
  amount_minor bigint NOT NULL,                -- positive = credit, negative = debit
  currency     char(3) NOT NULL,
  PRIMARY KEY (journal_id, line)
);

CREATE TABLE balance (
  account_id  text PRIMARY KEY,
  ledger_minor bigint NOT NULL,
  held_minor   bigint NOT NULL DEFAULT 0,
  version      bigint NOT NULL
);
-- Invariant enforced in the posting transaction: SUM(amount_minor) per journal and currency = 0

Entries are never updated or deleted. A mistake is fixed by a reversal journal referencing the original, then a correct posting.

13. Database technology selection and reasoning

Need Choice Why
Journal + balances Distributed SQL (Spanner, CockroachDB, YugabyteDB) or PostgreSQL with synchronous replication per shard ACID multi-row transactions, strong consistency, horizontal scale for peak postings
Feeds and search PostgreSQL read replicas or OpenSearch Flexible queries without touching the write path
Events Kafka with CDC from the journal Reliable downstream propagation
Reporting Lakehouse with immutable snapshots Regulators need reproducible reports as of a date

Why not NoSQL for the ledger? Multi-entry atomic postings across accounts and strong invariants are natural in SQL transactions; key-value stores make cross-account atomicity harder (DynamoDB transactions exist but have item limits and higher cost per write).

14. Authentication and authorization

  • Customers: OIDC with strong customer authentication (possession: device key; inherence: biometric).
  • Open banking third parties: OAuth 2.0 with FAPI security profile (mTLS or private-key JWT, PAR, signed requests), consent records.
  • Staff: SSO + MFA; RBAC with segregation of duties (who can create a product vs approve it); four-eyes approval for manual postings.
  • Services: mTLS and workload identity; only the posting engine has write permissions to ledger tables.

15. Security architecture

  • Encryption at rest with HSM-backed keys; tokenization of card PANs at the card processor.
  • Database activity monitoring; immutable audit of every privileged action.
  • Network segmentation for the ledger core; no direct human SQL access to production (break-glass only).
  • AML transaction monitoring (rules + ML), sanctions screening on payments.
  • Operational resilience mapping of important business services and impact tolerances (as required by regulators such as the UK PRA/FCA and the EU DORA regulation).

16. Caching strategy

  • Never cache balances used for authorization decisions outside the ledger transaction.
  • Customer-facing balance display may use a read replica with "as of" timestamp; show pending items.
  • Product definitions cached by version (immutable once published).

17. Messaging and event-driven architecture

Events published via CDC from the journal: JournalPosted, HoldPlaced, HoldReleased, AccountOpened, AccountFrozen. Consumers: feed projector, notifications, AML, fraud, GL bridge, analytics. Ordering keyed by account ID; consumers idempotent by journal ID.

sequenceDiagram
  participant App
  participant PO as Payment orchestrator
  participant PE as Posting engine
  participant DB as Journal DB
  participant SC as Scheme connector
  App->>PO: pay €500 to IBAN X (SCA approved)
  PO->>PE: post debit customer / credit outbound-clearing (idempotency key)
  PE->>DB: BEGIN, insert journal + entries, update balance with limit check, COMMIT
  PE-->>PO: POSTED
  PO->>SC: submit instant payment
  alt accepted
    SC-->>PO: accepted
  else rejected
    SC-->>PO: rejected
    PO->>PE: reversal journal (refund customer)
  end

18. Cloud deployment architecture

  • Regulated-cloud landing zone (or hybrid with on-prem for the mainframe): dedicated accounts/projects for ledger core, payments, analytics, security tooling.
  • Primary region with 3 AZs; distributed SQL across zones (RPO 0) and asynchronous replica or multi-region config for DR.
  • Private connectivity to schemes, card processor and the mainframe (Direct Connect/ExpressRoute/Interconnect).
  • Exit strategy documented (regulators require concentration risk and exit planning for critical outsourcing).

19. CI/CD and DevOps

  • Property-based and invariant tests on every commit; replay of anonymized production postings against new versions in shadow mode.
  • Database migrations backward-compatible (expand/contract).
  • Change approval automation with evidence collection for auditors (who changed what, tests passed).
  • Canary releases to internal staff accounts first.

20. Monitoring and observability

  • Continuous ledger invariant checks: trial balance per currency equals zero; balance projection equals sum of entries (sampled continuously, full daily).
  • Reconciliation dashboards: ledger vs scheme settlement vs card processor vs GL.
  • SLOs on posting latency and success; alerts on reversal spikes, hold expiry anomalies.

21. Scalability and performance optimization

  • Partition by account ID; postings touching two accounts in different partitions use the distributed SQL transaction.
  • Hot accounts (bank's own clearing/suspense accounts touched by every card transaction): split into N sub-accounts and aggregate, or use deferred balance updates for system accounts with periodic sweeps.
  • Batch postings for clearing files (one journal with many entries, or chunked).
  • Read traffic offloaded to read models.

22. High availability and disaster recovery

  • Zonal failure: distributed SQL keeps quorum; no data loss.
  • Regional failure: promote DR region; replay any events not yet propagated; verify trial balance before reopening.
  • Severe-but-plausible scenarios tested yearly (cyber event, cloud region loss, key supplier failure).
  • Immutable, offline-capable backups for ransomware recovery.

23. Cost optimization

  • Right-size distributed SQL nodes to sustained load, scale for known peaks (month end).
  • Archive old journal partitions to cheaper storage while keeping query access for audits.
  • Retire legacy mainframe MIPS progressively as products migrate, which is often the largest saving.

24. Architecture trade-offs and alternatives

Decision Chosen Alternative When the alternative fits
Ledger Build on distributed SQL Buy a cloud-native core (Thought Machine, Mambu, 10x, Temenos SaaS) When speed to market outweighs differentiation; many banks buy
Balance storage Maintained balance row updated in the same txn Compute from entries on read Very low volume ledgers
Event sourcing Journal is the source of truth; balances are projections CRUD balances + audit table Simpler domains without audit needs
Migration Strangler with new products on new core Big-bang migration Rarely; very high risk

25. Technology stack recommendations

Java/Kotlin services, Spring Boot; Spanner/CockroachDB/YugabyteDB or PostgreSQL; Kafka + Debezium; OpenSearch; Temporal for payment orchestration; Kubernetes; HSM/KMS; Flink for AML features; Iceberg lakehouse; OpenTelemetry.

26. Common architecture mistakes

  1. Storing a mutable balance without an immutable journal.
  2. Allowing several services to update balances directly.
  3. Using floating point for money.
  4. Editing or deleting entries to fix errors.
  5. Ignoring hot system accounts until card clearing day.
  6. Treating the legacy core migration as a data copy instead of a behavioural migration (interest rules, edge cases).

27. Senior architect interview questions and answers

How do you guarantee a transfer is never half-applied?

Both entries are written in one ACID transaction in the posting engine, with an invariant check that debits equal credits. The instruction ID is unique, so retries return the existing journal. External effects (scheme submission) happen after commit through a saga, with a compensating reversal if the scheme rejects.

How do you handle a card authorization followed days later by a different clearing amount?

Authorization creates a hold reducing available balance. Clearing posts the actual amount and releases the hold (matched by reference). If clearing differs (tips, currency conversion), the posting uses the clearing amount; unmatched holds expire after a defined period.

How do you scale postings for salary day?

Batch the employer's bulk file into chunked journals, partition by account, pre-scale the database, and treat the employer's source account as a hot account split into sub-accounts.

28. Enterprise architect interview questions and answers

How would you modernize the mainframe core?

Strangler approach: new products launch on the new ledger; an anti-corruption layer exposes a unified customer view; CDC streams mainframe postings into the new read models; migrate product by product with parallel runs and reconciliation before switching the system of record; decommission mainframe modules when empty.

What architecture principles would you set for the bank?

Money moves only through the ledger; immutable history; every interface idempotent; data classified and residency-aware; resilience mapped to important business services; buy for commodity, build for differentiation.

29. CTO-level business and technology questions

Build or buy the core?

Most banks buy a modern core and differentiate in customer experience, data and partnerships. Build only if the ledger itself is a strategic capability (BaaS provider, unique product velocity) and you can sustain a strong engineering team. Evaluate vendor lock-in, regulatory acceptance, and exit cost.

How do you report modernization progress to the board?

Share of accounts and products on the new core, mainframe cost reduction, incident and resilience metrics, time-to-launch new products, regulatory findings closed.

30. Real-world implementation roadmap

Phase Duration Outcomes
0. Foundations 0–6 months Regulated landing zone, ledger core MVP, product engine, security controls
1. Digital current account 6–12 months New customers on new ledger; card holds/clearing; instant payments
2. Read side unification 9–15 months CDC from mainframe, unified feed and statements for all customers
3. Product migration 12–36 months Migrate savings, then current accounts, with parallel runs
4. Decommission 30–48 months Mainframe modules retired; full operational resilience testing