Category · 34 articles
Design Pattern
Event Sourcing Checklist: When It Makes Sense & Common Pitfalls
I remember the first time I convinced a team to try event sourcing. We were building odds for a betting system with lots of domain rules, projections, and...
17 Nov 2025
Error Boundary React Design Pattern
A single undefined.map() in one widget crashed my entire React app. The user saw a white screen. No error message. No way to recover. A bug in the sidebar...
15 Apr 2024
Context API React Design Pattern
I had a theme toggle that needed to reach 15 components deep. Passing theme and toggleTheme as props through every intermediate component — components tha...
14 Apr 2024
Higher-Order Component (HOC) React Design Pattern
I needed to add analytics tracking to 12 different components. Each one had to log when it mounted and when the user interacted with it. Copy-pasting the ...
14 Apr 2024
Container Component React Design Pattern
I used to build React components that fetched data, managed loading states, handled errors, and rendered UI — all in one file. Every component was 200+ li...
14 Apr 2024
Best Practices for Structuring Express.js Applications with Prisma Design Pattern
I've seen Express projects where everything lives in one giant app.js. Routes, database calls, validation, error handling — all tangled together. It works...
24 Mar 2024
Best Practice FrontEnd React App Design Pattern
I've joined React projects where everything lived in a flat src/ folder. 200 files. No structure. Finding anything meant Cmd+P and guessing filenames. The...
24 Mar 2024
Command Query Responsibility Segregation (CQRS) Design Pattern
I was working on a system where the read path and the write path had completely different performance profiles. Writes were complex — validations, busines...
24 Mar 2024
Domain-Driven Design (DDD) Design Pattern
I spent six months building a system where developers and domain experts used different words for the same things. We called it a "record." They called it...
24 Mar 2024
Event-Driven Architecture (EDA) Design Pattern
I had a monolith where placing an order triggered a payment charge, an inventory update, an email notification, and an analytics event. All synchronous. A...
23 Mar 2024
Layered Architecture Design Pattern
Early in my career, I worked on a Node.js app where route handlers contained SQL queries, business logic, and HTML rendering — all in the same function. C...
23 Mar 2024
Service-Oriented Architecture (SOA) Design Pattern
I worked on a monolith that handled everything — user management, product catalog, order processing, payments, and email. Deploying a typo fix in the emai...
23 Mar 2024
Unit of Work Design Pattern
I had a checkout flow that created an order, deducted inventory, and charged a payment — three separate database calls. If the payment failed after invent...
23 Mar 2024
Model-View-Controller (MVC) Design Pattern
MVC is probably the first architecture pattern most developers encounter. It splits your application into three parts, each with a clear job. Sounds simpl...
23 Mar 2024
Thread Pool Design Pattern
I was processing images in a Node.js service. Each image resize spawned a new worker thread. Under load, the system created hundreds of threads, burned th...
23 Mar 2024
Monitor Object Design Pattern
I had a shared counter in a Node.js worker setup. Two async operations would read the counter, both see 5, both increment to 6. I lost an increment. Class...
23 Mar 2024
Active Object Design Pattern
I had a dashboard that fired off five API calls on load. They all competed for the main thread. The UI froze, users complained, and my "loading spinner" w...
23 Mar 2024
Chain of Responsibility Design Pattern
If you've used Express middleware, you already know this pattern. A request comes in. The first middleware checks auth. If it passes, it calls next(). The...
23 Mar 2024
Momento Design Pattern
I built a text editor with an undo feature. My first approach: store a deep copy of the entire document state before every keystroke. It worked. It also a...
23 Mar 2024
Mediator Design Pattern
I had a form where changing a dropdown updated a text field, which triggered a validation, which enabled a submit button, which showed a confirmation pane...
23 Mar 2024
Iterator Design Pattern
I built a custom data structure — a paginated result set from an API. It wasn't an array, but I wanted to loop over it with for...of. I didn't want to exp...
23 Mar 2024
Strategy Design Pattern
I had a checkout system with a growing if/else chain for payment methods. Credit card? One block. PayPal? Another. Apple Pay? A third. Bank transfer? A fo...
23 Mar 2024
Observer Design Pattern
I built a dashboard where a stock price update needed to refresh a chart, a notification badge, and a data table — simultaneously. My first approach was t...
23 Mar 2024
Proxy Design Pattern
I had a database service that every part of the application could call directly. No access control, no logging, no caching. Any component could query anyt...
23 Mar 2024
Facade Design Pattern
I was integrating a video streaming feature. Playing a movie meant initializing a video decoder, setting up audio, loading subtitles, configuring bufferin...
23 Mar 2024
Director Design Pattern
I was adding features to a coffee ordering system. A basic coffee costs $5. Add milk, that's $2 more. Add vanilla syrup, another $1.50. Whipped cream? $1....
23 Mar 2024
Composite Design Pattern
I needed to calculate the total size of a directory. The directory contains files and subdirectories. Subdirectories contain more files and subdirectories...
23 Mar 2024
Bridge Design Pattern
I was building a charting library. I had shapes (circles, rectangles) and rendering targets (SVG, Canvas). My first instinct was to create SvgCircle, Canv...
23 Mar 2024
Adapter Design Pattern
I inherited a codebase that used a homegrown logger. The new team wanted Winston. Rewriting every log() call across 200 files wasn't happening. Instead, I...
23 Mar 2024
Prototype Design Pattern
I was generating test data for a vehicle inventory system. Each test needed slightly different vehicle objects — different models, different years — but 8...
23 Mar 2024
Builder Design Pattern
I once had a constructor that took 11 parameters. Positional arguments. No defaults. Every call looked like new Report(true, false, null, "pdf", 12, null,...
23 Mar 2024
Abstract Factory Design Pattern
I once built a UI toolkit that needed to render on both the web and a React Native app. I started with a single factory per component. By the third compon...
23 Mar 2024
Factory Method Design Pattern
I had a notification system that started with just email. Then someone wanted SMS. Then push notifications. Every time I added a channel, I had to change ...
23 Mar 2024
Singleton Design Pattern
I created three database connection pools in the same application. Each module imported the config and spun up its own pool. We hit the connection limit f...
13 Mar 2024