System Design: Event Sourcing and CQRS — Append-Only Events, Projections, and Read Models
6 min read What is Event Sourcing? In traditional systems, the database stores the current state: the orders table has one row per […] Read article
6 min read What is Event Sourcing? In traditional systems, the database stores the current state: the orders table has one row per […] Read article
6 min read What is Multi-Tenancy A multi-tenant SaaS serves multiple customers (tenants) from the same shared infrastructure. Each tenant’s data must be Read article
6 min read Problem and Naive DP LIS: find the length of the longest strictly increasing subsequence of an array. Elements of the Read article
7 min read Core Entities Plan: plan_id, name, billing_cycle (MONTHLY, ANNUAL, WEEKLY), price_cents, currency, trial_days, features (JSON). Subscription: subscription_id, customer_id, plan_id, status (TRIALING, Read article
7 min read Core Entities Flight: flight_id, airline, flight_number, origin_airport, destination_airport, departure_time, arrival_time, aircraft_type, status (SCHEDULED, BOARDING, DEPARTED, ARRIVED, CANCELLED, DELAYED). Seat: seat_id, Read article
6 min read Tree DP Pattern Many tree problems require computing an answer that depends on both subtrees. The key pattern: define a Read article
7 min read Problem Scope Given a prefix typed by the user, return the top-K (typically 5-10) suggestions ranked by relevance. Used in Read article
6 min read What Makes an Algorithm Greedy A greedy algorithm makes the locally optimal choice at each step, hoping this leads to Read article
6 min read The Three Pillars of Observability Observability lets engineers understand the internal state of a system from its external outputs. Three Read article
6 min read Palindrome Check A palindrome reads the same forward and backward. Brute force check: O(n). Two-pointer: left=0, right=n-1; while left < Read article
7 min read Core Entities JobDefinition: job_id, name, type (CRON, INTERVAL, ONE_TIME), schedule (cron expression or interval_seconds), handler (class name or function reference), Read article
6 min read The String Matching Problem Given a text T of length n and a pattern P of length m, find all Read article
7 min read Core Entities Property: property_id, address, city, state, zip, lat, lng, type (APARTMENT, HOUSE, CONDO, TOWNHOUSE), status (FOR_SALE, FOR_RENT, SOLD, OFF_MARKET), Read article
6 min read Core Requirements 1:1 messaging and group chats. Real-time delivery (< 100ms latency). Message persistence: users can scroll back through history. Read article
6 min read Core Entities Vehicle: vehicle_id, license_plate, type (SEDAN, VAN, TRUCK), capacity_kg, fuel_type, status (AVAILABLE, ON_TRIP, MAINTENANCE, OFFLINE), current_location (lat, lng), odometer_km, Read article