Double-Entry Ledger: Immutable Schema & Concurrency

Prerequisite: This is the starting part of the series — no prior part is required. Later parts assume the concepts introduced here. Answer-first: A production-grade double-entry ledger enforces immutable, append-only transaction logs decoupled from balance state updates. By using fixed-size C-aligned memory structs or PostgreSQL check constraints and triggers, the schema guarantees strict debit-credit mathematical invariants, prevents hot-row lock contention, and eliminates double-spend risks in high-concurrency core banking architectures. ...

June 18, 2026 · 15 min · Lê Tuấn Anh

Double-Entry Bookkeeping: Core Banking Ledger Guide

Answer-first: Double-entry bookkeeping in core banking guarantees that every transaction records equal Debit and Credit entries across sub-ledgers. Enforcing $\sum \text{Debits} = \sum \text{Credits}$ at the database schema level via atomic PostgreSQL transactions and Go ledger validation engines prevents financial imbalance, race conditions, and audit compliance failures. Prerequisite: Read the Executive Summary for the high-level roadmap of core banking evolution. Why does a developer need to learn accounting? Answer-first: Developers must understand accounting principles to design software ledgers that correctly enforce balance invariants and immutable journal logs. ...

May 6, 2026 · 11 min · Lê Tuấn Anh

Event Sourcing & CQRS: Immutable Ledger for Microservices

Prerequisite: Familiarity with the concepts introduced in Part 2 — Distributed Sql Acid Latency. Review it first if the terminology in this part is unfamiliar. Answer-first: Event sourcing and CQRS replace mutable database updates with an immutable append-only event log. Core banking systems record financial state changes as domain events, projecting read models asynchronously while guaranteeing auditability and zero data loss. Series (Part 3 of 8): This article builds upon the ACID transactions foundation from Part 2. We will design a ledger using Event Sourcing — the exact solution that Monzo, Starling Bank, and many large neo-banks use to scale. ...

June 18, 2026 · 15 min · Lê Tuấn Anh

ACID Transactions & Isolation Levels in Core Banking

Answer-first: Enforcing ACID isolation levels in core banking prevents lost updates and dirty reads during high-concurrency transfers. Using PostgreSQL REPEATABLE READ or pessimistic row locking (SELECT FOR UPDATE) combined with Go connection pooling guarantees transactional integrity. Spanner and CockroachDB provide linearizable distributed ACID transactions across microservices using Paxos consensus and Hybrid Logical Clocks. Prerequisite: Part 2: CASA & Lending Domain Logic on transaction parameters. The Core Problem: Concurrency Answer-first: High-concurrency banking transfers risking race conditions and lost updates require strict database lock isolation to protect ledger state. ...

May 6, 2026 · 14 min · Lê Tuấn Anh

Magento EAV Schema Migration & UUID Identity Mapping

Prerequisite: Familiarity with the concepts introduced in Part 4 — Grpc Rest Gateway. Review it first if the terminology in this part is unfamiliar. The EAV schema is why most Magento migrations fail. It looks manageable from the outside: products stored across catalog_product_entity, catalog_product_entity_varchar, catalog_product_entity_int, catalog_product_entity_decimal, catalog_product_entity_datetime, and catalog_product_entity_text. Six tables, straightforward ETL job, done in a weekend. Then you discover that attribute_id = 75 means “product name” in your Magento instance and “color” in your staging instance. Every attribute ID is generated at install time and differs between environments. Any ETL script that hardcodes attribute IDs will produce corrupted data in production. ...

May 6, 2026 · 12 min · Lê Tuấn Anh

Build a Mini Core Banking System in Golang Engine Guide

Part 7: Build a Mini Core Banking System in Go Answer-first: Building a production-grade mini core banking system in Go requires implementing an immutable double-entry ledger schema, deterministic row locking to prevent deadlocks, idempotent API handlers, and automated balance invariant reconciliation. This hands-on project validates transaction atomicity, sub-10ms transfer latency, zero-balance corruption, and at-least-once outbox event streaming under high concurrent load. Prerequisite: Part 6: Security, Compliance, and Audit Trails on audit ledger logs. ...

May 6, 2026 · 12 min · Lê Tuấn Anh

Database Sharding in Go: TiDB, Postgres & Pools | Go Product

Answer-first: Horizontal database sharding with Vitess and TiDB distributes high-volume write traffic across database clusters using consistent hashing and range partitioning. Prerequisite: Part 4 of the System Design Masterclass. Read Part 3: Caching Strategies first. Database Sharding in Go — TiDB, PostgreSQL & Connection Pools Answer-first: Horizontal database sharding partitions SQL tables across independent database nodes using hash or range shard keys. In Go services, combining application-level shard routing with tuned database/sql connection pools (SetMaxOpenConns, SetMaxIdleConns) prevents RAM exhaustion and write bottlenecks. ...

June 18, 2026 · 9 min · Lê Tuấn Anh

Real-Time Inventory: Kafka, CDC & Redis for E-Commerce

Real-Time Inventory Topology: CDC, Kafka, and Redis Real-time inventory synchronization is the process of propagating stock count changes from the system of record (database) to all sales channels — web storefront, mobile app, WMS, ERP — in sub-second time. Instead of batch ETL jobs that run every hour, a CDC + Kafka pipeline streams every committed stock change as an event, eliminating overselling and stale stock displays. Handling this during a flash sale — where thousands of users attempt to purchase a highly contested SKU simultaneously — is a pinnacle architectural challenge. Traditional synchronous database updates collapse under lock contention. ...

June 8, 2026 · 10 min · Lê Tuấn Anh

Microfinance Core Banking: Architecture & Engineering Guide

Microfinance Core Banking: Architecture & Engineering Guide Building a Core Banking System (CBS) for a Microfinance Institution (MFI) presents a radically different set of engineering challenges compared to traditional retail banking. While commercial banks focus heavily on individual credit scores and card networks, microfinance operates on high-frequency, low-value transactions, group-based lending, and offline field collections. If you are an engineer or Business Analyst transitioning into fintech, understanding the architectural nuances of platforms like Apache Fineract (Mifos X) or Musoni is critical. This guide we will break down the 5 must-have modules of a Microfinance CBS, providing the database schemas, mathematical formulas, double-entry mappings, and the actual Product Requirements Document (PRD) snippets you need to build them. ...

May 28, 2026 · 11 min · Lê Tuấn Anh

How Databases Shaped Go, PHP, Node.js, and Rust

How Databases Shaped Go, PHP, Node.js, and Rust Databases are the most critical I/O bottleneck in backend systems. Over the past 20 years, network latency, connection limits, and transaction safety have forced programming languages to rethink their concurrency models, evolve new syntaxes, and invent smarter ORMs. Here is a deep architectural breakdown of how database constraints drove the evolution of PHP, Node.js, Rust, and Go. 1. Connection Models & Concurrency Process-per-request models exhaust physical database connections under heavy load; languages with embedded multiplexed connection pools avoid saturating downstream database clusters. ...

May 25, 2026 · 9 min · Lê Tuấn Anh

LeaseInVietnam: AI-Powered Expat Rental & B2B Lead Engine

LeaseInVietnam: AI-Powered Expat Rental & B2B Lead Engine Most AI content projects are built around one question: how do I publish more? LeaseInVietnam is built around a different question: how do I make every published piece convert? The system is an autonomous relocation hub targeting expats and digital nomads renting in Southern Vietnam — Ho Chi Minh City, Nha Trang, Phú Quốc. It produces content in American English, publishes daily via GitOps, and routes every reader interaction toward a B2B lead funnel that pays commission on moving services, cleaning bookings, furniture rentals, and legal consultations. ...

April 24, 2026 · 14 min · Lê Tuấn Anh