How a High-Throughput Payment Gateway Stays Up — Timeouts, Circuit Breakers, Sagas, Idempotency, and RPO/RTO (2026)


The Saga and Outbox patterns are most often essential when combined. This article is the production recipe for combining them: the five invariants you must preserve, the schemas, the state machine, six failure modes the combination survives, common implementation mistakes, observability, and an incremental migration path from a synchronous chained-call implementation. With four Mermaid diagrams, full SQL schemas, and a 30-question FAQ.
Two-phase commit is the wrong default for distributed microservices: it blocks on coordinator failure, requires XA on every participant, holds locks across third-party-API latency, and breaks under network partitions. This article is a decision matrix for the five patterns that have replaced it — Saga, Try-Confirm-Cancel, Outbox, Reservation-Then-Commit, and Idempotency-with-Retry — including a deep treatment of TCC (the alternative most often misimplemented), the four-layer composition stack that production systems actually use, anti-patterns that recreate the 2PC problems, a multi-vendor travel-booking case study, and the trade-off summary that takes a workload description and points at the right combination.
Most teams that say they "do DDD" have a folder called domain/ and occasional meetings with a product manager. The genuine practice — bounded contexts that match the business, aggregates that protect invariants, ubiquitous language that survives the trip from whiteboard to code — is rare because it is harder than its surface description. NestJS is one of the few back-end frameworks whose primitives are well-suited to a serious DDD implementation. This guide covers bounded context mapping, aggregate sizing, the ideal layered folder structure, the repository pattern done correctly versus the DAO that pretends to be one, domain events through the in-process bus, and composition with the Saga, Outbox, and Event-Driven Architecture patterns.
Backend-for-Frontend in 2026: one BFF per client experience, GraphQL Federation vs tRPC vs REST per client-shape, Edge BFFs, and eight production anti-patterns.
Advertise and partner
Reach engineering leaders and CTOs reading about AI, mobile and cloud architecture.
Sponsored mentions and co-authored articles or technical deep-dives. Relevant products only, always disclosed.