Part 1 — Context Engineering: Domain-Driven Design for AI

Prerequisite: Familiarity with the concepts introduced in Executive Summary. Review it first if the terminology in this part is unfamiliar. Answer-first: Context Engineering structures, scopes, and injects software domain knowledge into Large Language Model prompts using Domain-Driven Design principles. By organizing codebases into explicit Bounded Contexts, Abstract Syntax Tree subgraphs, and JSON-Schema contracts, engineering teams eliminate hallucinations, enforce layer boundaries, and enable autonomous coding agents to implement production-grade enterprise features. ...

March 16, 2026 · 9 min · Lê Tuấn Anh

DDD Module Boundaries & Decoupling Modular Monoliths

Answer-first: A Modular Monolith prevents code degradation (“Big Ball of Mud”) by applying Domain-Driven Design (DDD) Bounded Contexts, isolating database schema namespaces (e.g. billing.payments, inventory.stock), enforcing compile-time import boundaries via Go internal packages and arch-go, and using an in-memory transactional outbox pattern for asynchronous event communication. Prerequisite: Before reading this part, please review Part 2: FinOps Cost Reality. What You’ll Learn: Go Package & Arch-Go Enforcement: How to use Go’s internal folder structure and arch-go static rules to block illegal cross-module imports at compile time. Aggregate Roots & Anti-Corruption Layers (ACL): How to encapsulate domain logic and translate external DTOs without leaking module internals. Database Schema Isolation (billing.payments, inventory.stock): How PostgreSQL schema permissions restrict SQL JOINs across modules within a shared database instance. In-Memory Transactional Outbox: How to achieve reliable event publishing without network overhead or Kafka infrastructure. The biggest reason engineering teams fear the Monolith architecture is due to past experiences with “Spaghetti Monoliths” or the “Big Ball of Mud” — where the code for the Billing function calls directly into the database of the Cart function, creating an inextricable web of cross-dependencies. ...

July 3, 2026 · 12 min · Lê Tuấn Anh

Architecting 21-Service E-commerce with Golang & DDD

Architecting 21-Service E-commerce with Golang & DDD The exact performance overhead of using Go’s structural subtyping versus manual dependency injection in high-throughput microservices. Why scoping database transactions to a single Aggregate root is critical, and how we resolved out-of-order event delivery using Kafka partition keys. Scaling an e-commerce platform past 10,000+ orders per day containing multiple SKUs across dynamic warehouses is where naive architecture breaks down. Hardware scaling ceases to be a magic bullet when distributed transactions, race conditions, and eventual consistency are involved. ...

April 12, 2026 · 10 min · Lê Tuấn Anh

Deconstructing the Ecosystem: Service Details by Domain

Deconstructing the Ecosystem: Service Details by Domain “Why 21 services? Isn’t that overkill?” This is the most common question I get when discussing the Golang microservice architecture we built to handle massive scale. The short answer is: No, because Conway’s Law is real. When you have multiple squads touching the same codebase, feature overlap creates friction. By rigidly enforcing Domain-Driven Design (DDD), we sliced our e-commerce monolith into 6 highly cohesive, loosely coupled Business Domains. Each domain is completely self-sufficient and owns its own Postgres databases. Below, we deconstruct the business capabilities, storage choices, and operational profiles of the 21 individual microservices that power this ecosystem. ...

April 12, 2026 · 11 min · Lê Tuấn Anh