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 …
- Cross-Service Data: How to Join Without a Database JOIN
When Order Service and User Service own separate databases, learn how to compose APIs, replicate data and build …
- Clean Architecture in Depth
… Promise<PlaceOrderResponse { const order = Order.create(this.ids.next(), request.customerId, request.lines); await this.payments.charge(order …
- Topics, Partitions & Offsets
… JSON.stringify({ type: "OrderPlaced" }) }, { key: "order-42", value: JSON.stringify({ type: "OrderPaid" }) }, // same partition, after Placed { key: "order …
- Advanced TypeScript for Frontend
… string } { status: "ready"; order: Order }; function OrderPanel({ screen }: { screen: OrderScreen }) { switch (screen.status) { case "loading": return <Spinner / ; case …
- NestJS Core Concepts
… true }), OrdersModule, UsersModule] }) export class AppModule {} mermaid flowchart TB App[AppModule] -- Orders[OrdersModule] & Users[UsersModule] & Config["ConfigModule (global …
- 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 …
- Message Delivery: Queues, Kafka, Ordering and DLQs
Pick the right kind of message system, and plan up front for duplicate messages, ordering, broken messages and …
- 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 …
- React Internals & Concurrent Rendering
… preserves each item's identity when order changes. {orders.map((order) = <OrderRow key={order.id} order={order} / )} // Risky …
- 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 …
- Vertical Slice Architecture & the Modular Monolith
… uses a rich domain model export async function placeOrder(deps: { orders: OrderRepository; events: EventBus }, cmd: PlaceOrderCommand) { const order …
- Layered (N-Tier) Architecture
… save(order) R- DB: INSERT INTO orders DB-- R: ok R-- S: order with id S-- C: order …
- Kafka for Backend Services
… Use the entity ID: orderId , customerId , accountId . Key Result --- --- orderId All events of one order in order ✅ null …
- C4 Architecture Diagrams: Context, Container, Component and Code
… string) PaymentResult } class OrderRepository { <<interface +save(order: Order) void } class PostgresOrderRepository { +save(order: Order) void } class OrderEventPublisher { +publishPaid …
- AWS Data Pipelines in Plain Language
… raise ValueError("Order total cannot be negative") if row["status"] == "paid": writer.writerow(row) Expected result: paid-orders …
- Real-Time, Pub/Sub, Webhooks and CDC
… Now order 55's history stays in order. - Don't promise one global order across all orders. That …
- AWS Databases: Choose the Right One
… You design from the access pattern first: “get order by order ID” or “list a customer’s orders …
- Design an E-Commerce Checkout
… Confirm, then announce When the order is confirmed, save the order and an outbox event ("order 812 confirmed …
- Code Profiling
… every order scans all customers again. const rows = orders.map((order) = ({ id: order.id, customerName: customers.find((customer …
- 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 …
- AWS Messaging: Queues, Topics and Events
… Still design safe retries. An EventBridge event json { "source": "academy.shop", "detail-type": "OrderPlaced", "detail": { "order id": "1001 …
- Scalable Frontend Architecture
… Promise<Order { const response = await http.get( /orders/${id} ); return orderSchema.parse(response); // validate untrusted data at the …
- OOP Mistakes and Interview Questions
… Order) { / … / } } class PriceCalculator { total(order: Order) { / … / } } class PaymentService { charge(order: Order) { / … / } } class OrderNotifier { confirm(order: Order) { / … / } } Mistake 2 …
- Multi-Region and Disaster Recovery
… B doesn't know about those last orders, so the retries create new orders and maybe new charges …
- Database Relations & Foreign Keys
… an order belongs to one customer; an order contains many items; a student may take many courses. Good …
- CQRS & Event Sourcing
… rules and state changes async function changeShippingAddress({ orderId, address }) { const order = await orderRepository.load(orderId); order.changeAddress(address …
- Async JavaScript: Promises, async/await and Node's Event Loop
… a flat chain, one error handler readUser(id) .then((user) = readOrders(user.id)) .then((orders) = console.log(orders …
- Kafka Producers
… order.id, // keeps all events for this order in order value: JSON.stringify({ orderId: order.id, customerId: order …
- I — Interface Segregation Principle
… Promise<Order ; list(filter: Filter): Promise<Order[] ; } interface OrderWriter { save(order: Order): Promise<void ; delete(id: string): Promise …
- 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 …
- Batch vs Stream and Data Modeling
… the order database (normalized). Tables like orders , order items and payments . Each fact lives in one place. Constraints …
- Payment Retries: Prevent Duplicate Charges
… You need a rule on the order itself, in the database: - Move the order from AWAITING PAYMENT to …
- SQL vs NoSQL Databases
… places ORDER -- { ORDER ITEM : contains PRODUCT --o{ ORDER ITEM : "appears in" CUSTOMER { bigint id PK text email text …