Composable E-Commerce Migration: Overcoming Tech Debt

Composable E-Commerce Migration: Overcoming Tech Debt Answer-First: Migrating a monolithic e-commerce application (such as Magento) to composable architecture requires decomposing domains into 21 bounded contexts using Strangler Fig proxy routing with Envoy, real-time Debezium CDC for zero-drift database sync, and Go microservices built on Kratos v2 and Protobuf gRPC. See the 21-service e-commerce architecture blueprint for the domain boundaries this migration targets. Why replacing a legacy PHP monolith (Magento) requires 21 DDD bounded contexts rather than naive 4–6 microservices. Strangler Fig routing configurations for Envoy that migrate traffic path-by-path from Magento to Go microservices without dropping active sessions. How to implement a double-write database sync listener in Go to prevent data drift during the multi-month migration window. Production Go microservice architecture using Kratos v2, Wire compile-time DI, and Protobuf Money types. In theory, MACH (Microservices, API-first, Cloud-native, Headless) and Composable Commerce are the “holy grail” of the e-commerce industry. However, when systems scale to process millions of transactions, issues regarding data consistency, domain decomposition, and observability costs surface. This guide details the lessons and architectural patterns from migrating a monolithic Magento application into a production-grade 21-service Go microservices platform. ...

July 6, 2026 · 10 min · Lê Tuấn Anh

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

Real-Time Inventory Topology: CDC, Kafka, and Redis Answer-First: Building high-throughput real-time inventory systems requires a hybrid Speed & Truth architecture. Change Data Capture (Debezium) streams database stock updates into Apache Kafka, while atomic Redis Lua scripts handle instant sub-millisecond stock reservations with zero overselling during high-concurrency flash sales. Write-through caches configuration in Redis to prevent inventory drift. Lua scripting implementations in Redis that prevent double-reservations under peak load. 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. ...

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

Cloudflare D1 & Durable Objects: Build Real-Time Cart

Cloudflare D1 + Durable Objects: Building a Real-Time Cart Answer-First: Building a real-time e-commerce cart on Cloudflare combines Durable Objects for strongly consistent, single-threaded in-memory session state across active browser tabs with Cloudflare D1 (edge SQLite) for long-term order persistence. This edge-native architecture eliminates Redis clusters and centralized database bottlenecks, enabling sub-50ms worldwide cart synchronization with zero cold starts. How to design cart locking mechanisms in Durable Objects without deadlocks. Tuning sub-request allocations to stay within Cloudflare’s free-tier runtime boundaries. The traditional shopping cart architecture is a familiar set of tradeoffs: Redis for session storage, PostgreSQL for order data, and a backend API tier that coordinates between them. It works, but it introduces latency proportional to the distance between the user and your datacenter, requires operational overhead for Redis cluster management, and struggles with globally concurrent cart edits from the same user across multiple devices. ...

June 1, 2026 · 17 min · Lê Tuấn Anh

Flash Sale Architecture: Rate Limiting & Redis

Flash Sale Architecture: Rate Limiting & Redis Answer-First: High-concurrency flash sale architectures handle millions of concurrent requests (C10M scale) by using kernel bypass networking (DPDK/eBPF), edge rate limiting via atomic Redis Lua token buckets, pre-warmed in-memory inventory decrementing, and asynchronous Kafka queue leveling before persisting to distributed TiDB/MySQL database clusters. Executive Summary & System Design Foundations High-concurrency systems handling millions of concurrent requests (C10M scale) must push load shedding and admission control as close to the network edge as possible. Four design baselines drive the rest of this architecture: ...

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

Order Fulfillment Algorithm: Warehouse to Last-Mile

Order Fulfillment Algorithm: Warehouse to Last-Mile Answer-First: An e-commerce order fulfillment algorithm selects warehouses and routes last-mile delivery using a 5-step pipeline: Available-to-Promise (ATP) stock checks, cost/proximity scoring, split vs. consolidation trade-offs, anticipatory inventory positioning (e.g. Amazon CONDOR), and Vehicle Routing Problem (VRP) solving with tools like OR-Tools or GraphHopper. Executive Summary & Fulfillment Fundamentals When an order is confirmed, the fulfillment system executes a multi-step decision pipeline to optimize inventory allocation and transit SLA: ...

June 1, 2026 · 7 min · Lê Tuấn Anh

Alipay Double 11 Scale Evolution Timeline: 2009-2026

← Series hub ← Prev • Next → Executive Summary & Quick Answer: Alipay’s Double 11 engineering journey evolved over a decade from a centralized monolithic database (2009) to a planet-scale multi-active cloud-native architecture capable of processing over 544,000 TPS at peak. Prerequisite: Executive Summary Overview Answer-First: The Double 11 evolution tracks Alipay journey from monolithic database crashes in 2009 to multi-region active-active unitized architectures. Double 11 (Singles’ Day), initiated in 2009 as a minor promotional event on Taobao Mall, evolved over a decade into the world’s largest online shopping festival. For Alipay’s engineering teams, it served as an annual crucible: a predictable yet extreme spike in transaction volume that forced the continuous redesign of payment infrastructure. This timeline tracks the evolution of Alipay’s technical scaling from a centralized database model to a modern, elastic cloud-native architecture. ...

May 2, 2026 · 10 min · Lê Tuấn Anh