Search

Lessons (40)

  • D — Dependency Inversion Principle

    … invert the dependency js // ✅ OrderService depends only on "shapes" it receives class OrderService { constructor({ orderRepository, mailer }) { this.orderRepository …

  • Behavioral Patterns I: Observer, Strategy, Command, State

    … same signature, different algorithm const shippingStrategies = { standard: (order) = 5, express: (order) = 15, free: (order) = 0, weight: (order) = order …

  • Domain-Driven Design: Tactical Patterns

    … EventPublisher) {} async handle(cmd: { orderId: string }) { const order = await this.orders.get(cmd.orderId); order.place(); // the rules …

  • Topics, Partitions & Offsets

    … JSON.stringify({ type: "OrderPlaced" }) }, { key: "order-42", value: JSON.stringify({ type: "OrderPaid" }) }, // same partition, after Placed { key: "order …

  • Clean Architecture in Depth

    … Promise<PlaceOrderResponse { const order = Order.create(this.ids.next(), request.customerId, request.lines); await this.payments.charge(order …

  • Data in Microservices: Sagas & the Outbox Pattern

    … mark order CANCELLED Step Action Compensation --- --- --- 1 Create order (PENDING) Mark order CANCELLED 2 Reserve stock Release stock …

  • Normalization & Denormalization

    Learn 1NF, 2NF, 3NF and BCNF with one concrete order example, then decide when a controlled denormalized read …

  • Finding Service Boundaries with DDD

    … Ordering stores the product ID, name and price at the time of ordering , not the full catalogue entry …

  • O — Open/Closed Principle

    … the growing if/else js // ❌ Every new payment method = edit this function again function processPayment(order, method) { if …

  • Event-Driven Architecture

    … Orders knows nobody"] O2[Orders] -- OrderPlaced B{{Event broker}} B -- I2[Inventory] B -- P2[Payments] B -- E2[Email …

  • Layered (N-Tier) Architecture

    … save(order) R- DB: INSERT INTO orders DB-- R: ok R-- S: order with id S-- C: order …

  • Vertical Slice Architecture & the Modular Monolith

    … uses a rich domain model export async function placeOrder(deps: { orders: OrderRepository; events: EventBus }, cmd: PlaceOrderCommand) { const order …

  • Service Communication: Sync vs Async

    … POST /orders O- O: save order (status: PENDING) O- B: publish OrderPlaced O-- C: 202 Accepted ⚡ B-- I …

  • API Gateway, BFF & Service Discovery

    … 100 }] - path: /api/orders service: http://orders-svc:8080 plugins: [jwt-auth] - path: /api/products service: http://catalog …

  • Database Relations & Foreign Keys

    … an order belongs to one customer; an order contains many items; a student may take many courses. Good …

  • I — Interface Segregation Principle

    … Promise<Order ; list(filter: Filter): Promise<Order[] ; } interface OrderWriter { save(order: Order): Promise<void ; delete(id: string): Promise …

  • CQRS & Event Sourcing

    … rules and state changes async function changeShippingAddress({ orderId, address }) { const order = await orderRepository.load(orderId); order.changeAddress(address …

  • Kafka Producers

    … order.id, // keeps all events for this order in order value: JSON.stringify({ orderId: order.id, customerId: order …

  • REST vs GraphQL vs gRPC

    … Simple and predictable, but you might get extra sides you didn't want or need to order several …

  • Indexes, EXPLAIN & Query Plans

    … The database and exact query decide the final answer. Query pattern Index idea --- --- Join orders to customer orders …

  • Kafka vs RabbitMQ & the Kafka Ecosystem

    … every document is stored in order and kept. Anyone can come and read from any point, as many …

  • SQL vs NoSQL Databases

    … places ORDER -- { ORDER ITEM : contains PRODUCT --o{ ORDER ITEM : "appears in" CUSTOMER { bigint id PK text email text …

  • N+1 Queries, Loading & Pagination

    … Cursor pagination says “continue after this stable row.” WHERE (created at, id) < (:last created at, :last id) ORDER …

  • What Is Apache Kafka?

    … async ({ partition, message }) = { const order = JSON.parse(message.value.toString()); console.log( partition ${partition} offset ${message.offset}: , order …

  • REST API Design

    … Once you've ordered one thing, you can guess how to order anything. REST (Representational State Transfer) organises …

  • Authentication, Authorization & API Security

    … GET /orders (Cookie: sid=abc) S- R: who is abc? → user 42 S-- B: orders of user 42 …

  • Design an E-Commerce Checkout

    … inventory reservation, idempotent payment, order creation and durable events. ![Checkout: catalog/search are read paths while inventory, payment …

  • Trees & Binary Search Trees

    … pre-, in-, post-order (DFS) and level-order (BFS with a queue). - In-order traversal of a BST …

  • Domain-Driven Design: Strategic Design

    … translate CUST NO,<br/ ORD HDR into clean models" Billing["💰 Billing"] Stripe["💳 Stripe<br/ (upstream)"] -- Conformist Billing Ordering …

  • Time, Consistency and Distributed Transactions

    Reason about clocks, ordering, split brain, locks, CRDTs and transactions without promising impossible global certainty. ![Distributed correctness: clocks …

  • Services & Ingress

    … PathPrefix, value: /orders } }] backendRefs: - { name: orders-api-v1, port: 80, weight: 90 } - { name: orders-api-v2, port: 80 …

  • Monolith vs Microservices

    … one deployable"] direction LR U[Users module] --- O[Orders module] --- P[Payments module] --- I[Inventory module] DB1[(One …

  • Meaningful Names

    … taxStuff() Class noun (thing) PaymentProcessor , Order ProcessPayment , Manager Collection plural users , orderItems userList2 , arr Constant UPPER SNAKE MAX …

  • Message Queues & RabbitMQ

    … They pin the order ticket on a rail and go back to serving customers. Cooks take tickets from …

  • Graphs: BFS & DFS

    … dependency order "In which order should I install packages / take courses / build services?" Only works on a directed …

  • Batch vs Stream and Data Modeling

    … Results arrive later Stream Fraud alerts, live dashboards Ordering/replay/deduplication Normalized tables Integrity and flexible writes Reads …

  • Comments & Formatting

    … Comments that replace a good name js // ❌ // check if the user can get a discount if (user.orders …

  • What Is Software Architecture?

    … Use PostgreSQL for the orders service Status Accepted (2026-09-28) Context Orders need multi-row transactions (order …

  • Serverless Architecture

    … process.env.ORDERS TABLE, Item: order })); return { statusCode: 201, body: JSON.stringify({ id: order.id }) }; }; ts // Triggered by …

  • 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.