Search
Lessons (40)
- Exactly-Once Payment Processing
Safe payment retries need a durable idempotency record, atomic state transition and provider-side deduplication. The invariant For …
- Design an E-Commerce Checkout
… inventory reservation, idempotent payment, order creation and durable events. ![Checkout: catalog/search are read paths while inventory, payment …
- Data in Microservices: Sagas & the Outbox Pattern
… No central coordinator. mermaid flowchart LR O[Orders] -- OrderCreated I[Inventory] I -- StockReserved P[Payments] P -- PaymentFailed I2 …
- O — Open/Closed Principle
… Then Klarna → edit again… throw new Error("Unknown payment method"); } After: plug-in strategies js // ✅ Each payment method …
- REST API Design
… A client sends POST /payments , the connection drops, and the client doesn't know if the payment happened …
- Monolith vs Microservices
… one deployable"] direction LR U[Users module] --- O[Orders module] --- P[Payments module] --- I[Inventory module] DB1[(One …
- Clean Architecture in Depth
… Promise<void ; } export interface PaymentGateway { charge(customerId: string, amountCents: number): Promise<{ paymentId: string } ; } export interface IdGenerator { next(): string …
- Observability: Logs, Metrics & Traces
… hard to search, no context console.log("Payment failed for user 42"); // ✅ Structured (pino): every field is searchable …
- Structural Patterns: How to Connect Objects
… inventory, payment, shipping, email… class CheckoutFacade { constructor({ inventory, payments, shipping, mailer }) { Object.assign(this, { inventory, payments, shipping, mailer …
- Flash Sale: 10 Million Buyers, No Oversell
… Give every purchase an idempotency key, reconcile reservations/orders/payments, and isolate sale traffic from browsing and recommendations.
- Resilience Patterns
… JSON.stringify(payment), signal: AbortSignal.timeout(2000), // give up after 2 s }); 💡 Base timeouts on the dependency's …
- Service Communication: Sync vs Async
… dancers react to each other"] ORD[Orders] -- OrderPlaced INV2[Inventory] INV2 -- StockReserved PAY2[Payments] PAY2 -- PaymentCompleted SHIP2[Shipping …
- Finding Service Boundaries with DDD
… auth, email, payments"] -- GenHow["Buy / use SaaS"] Put your best engineers and cleanest design into the core ; buy …
- Event-Driven Architecture
… Orders knows everyone"] O1[Orders] -- reserve I1[Inventory] O1 -- charge P1[Payments] O1 -- email E1[Email] O1 -- track …
- Delivery Guarantees: At-Most, At-Least & Exactly Once
… either both happen or neither does. mermaid sequenceDiagram participant Src as payments topic participant App as Transactional processor …
- Services & Ingress
… payments-db-only-from-payments spec: podSelector: { matchLabels: { app: payments-db } } policyTypes: [Ingress] ingress: - from: - podSelector: { matchLabels: { app …
- Domain-Driven Design: Strategic Design
… already Buy or use SaaS/open source Auth, payments, email, accounting mermaid quadrantChart title Where to invest effort …
- Capacity, Availability, Latency and CAP
… read and a successful answer to every request. Payments/inventory normally reject uncertain writes; feeds/counters can serve …
- Timeouts, Retries & Backpressure
… downstream work. Inventory 250 ms Controlled temporary failure. Payment 450 ms Reconcile with idempotency key. Safety margin 150 …
- Which Pattern Do I Need?
… 🗺️ Strategy — pluggable algorithms (payments, pricing, auth) 7. 🚦 State — order and payment workflows 8. 📞 Chain of Responsibility — request …
- Comments & Formatting
… const PAYMENT MAX RETRIES = 3; That second comment is gold: no amount of good naming could tell you …
- Hexagonal Architecture (Ports & Adapters)
… Driven (secondary) side Things the application calls Database, payment provider, email, event bus, clock mermaid flowchart LR subgraph …
- Kubernetes Cluster Architecture
… team-payments"] b1[payments-api] end subgraph NS3["namespace: kube-system"] c1[CoreDNS] --- c2[kube-proxy] end end …
- Kafka vs RabbitMQ & the Kafka Ecosystem
… T1 -- Inv[Inventory svc] T1 -- Pay[Payments svc] Pay -- T2[(payments.completed)] T2 -- Ship[Shipping svc] T2 -- Email …
- ConfigMaps, Secrets & Storage
… LOG LEVEL: "info" FEATURE NEW CHECKOUT: "true" PAYMENTS URL: "http://payments-api" app-settings.json: { "currency": "EUR", "pageSize …
- Topics, Partitions & Offsets
… is a named stream of related events: orders , payments , page-views , user-signups . bash kafka-topics.sh --create …
- ACID, Transactions & Locks
… last item. Durability Crash after success A committed payment record is recovered from WAL/replication. Consistency is not …
- API Gateway, BFF & Service Discovery
… Payments"] PB[🛡️ sidecar proxy] <-- B[Payments app] end PA <-- "mTLS, retries, timeouts,<br/ metrics, traces" PB CP …
- What Are Design Patterns?
… 4. Name it in code. PaymentStrategy or OrderEventEmitter tells readers what's going on. mermaid flowchart LR A …
- S — Single Responsibility Principle
… cooks, the waiter serves and the cashier handles payments. If the chef also did the accounting, then a …
- Meaningful Names
… noun sendEmail() , calculateTax() email() , taxStuff() Class noun (thing) PaymentProcessor , Order ProcessPayment , Manager Collection plural users , orderItems userList2 , arr …
- Deployments, ReplicaSets & Rollouts
… shop-api ✅"] D -.-x P3["pod<br/ app=payments ❌"] S["Service<br/ selector: app=shop-api"] -.routes to …
- REST vs GraphQL vs gRPC
… Orders svc] REST -- gRPC Orders Orders -- gRPC Pay[Payments svc] Key takeaways - REST: simple, cacheable, great for public …
- Behavioral Patterns I: Observer, Strategy, Command, State
… XState state machines, TCP connection states, order and payment workflows. 💡 State vs Strategy: they look the same in …
- SQL vs NoSQL Databases
… committed, it survives a crash Power cut after "Payment successful" sql BEGIN; UPDATE accounts SET balance = balance - 100 …
- Kafka Producers
… post office + backup sign"] For important data (orders, payments): acks=all , replication.factor=3 , min.insync.replicas=2 …
- Deploying & Operating Microservices
… traceId=abc"] -- O["Orders<br/ traceId=abc"] -- P["Payments<br/ traceId=abc"] O -- I["Inventory<br/ traceId=abc …
- What Is Software Architecture?
… uptime Maintainability Is it easy to change? New payment method in under a week Testability Can we verify …
- Frontend Testing Strategy
… sign up, log in, checkout, payment. ts // e2e/checkout.spec.ts import { test, expect } from "@playwright/test"; test …
- Caching & Redis
… perfectly fresh (account balance at the moment of payment), data that is rarely re-read, highly personalised data …