Back to Projects

Distributed Backend Systems2026

Casestudy 02

Solidius

Double-Entry Ledger & Wallet Engine

NestJSPostgreSQL 18PrismaTypeScriptOutbox Workers

The Vision & Architecture

Money that can never be silently lost or double-spent.

Solidius (LedgerCore) is a high-throughput, production-grade ledger and wallet engine built on immutable double-entry accounting. Balances are derived strictly from INSERT-only journal entries, transfers acquire row locks in deterministic order to eliminate deadlocks under concurrency, and mutating endpoints are protected with cryptographic distributed idempotency.

13Normalised Tables
Insert-OnlyJournal Entries
6Reconciliation Checks
4RBAC Roles

Core Capabilities

  • Immutable Double-Entry Core

    Balances are never updated in place. Every monetary movement writes paired debit and credit entries, enforcing sum(debits) == sum(credits) per currency in the same atomic transaction.

  • Deadlock-Free Concurrency

    Transfers sort target account rows by UUID before SELECT ... FOR UPDATE, guaranteeing all concurrent workers acquire locks in identical order to eliminate deadlock cycles.

  • Distributed Idempotency

    Every write requires an idempotency key bound to a SHA-256 fingerprint of the request payload, safely returning cached responses on retry and rejecting mismatched duplicates.

  • Transactional Outbox & Signed Webhooks

    Domain events commit atomically with ledger writes and are dispatched by FOR UPDATE SKIP LOCKED background workers with HMAC-SHA256 signatures and 5-minute replay windows.

  • Continuous Reconciliation Auditing

    A scheduled worker runs 6 mathematical invariant checks across the ledger and records findings by severity to guarantee long-term data integrity.

Technology Stack

NestJSModular Enterprise API
PostgreSQL 18Ledger of Record
PrismaTyped Data Access
Argon2idCredential Security
Outbox WorkersReliable Event Sourcing
HMAC-SHA256Signed Webhook Delivery

Architectural Decisions

  • Pessimistic locks over optimistic retries

    Transfers are short, contended, and must not fail spuriously. Sorted SELECT ... FOR UPDATE gives a bounded wait under load instead of a retry storm that degrades as traffic grows.

  • Derived balances over mutable totals

    A mutable balance column is faster to read and impossible to audit. Projecting balances from entries keeps the journal as the single source of truth.