Skip to main content

Design Patterns Directory

Explore proven design patterns for software architecture and code migration. Learn when to use each pattern and see related implementations.

architecturalcloud-architecture

Strangler Fig Pattern

Incrementally migrate a legacy system by gradually replacing pieces of functionality with new applications

When to Use:
large-legacy-systemsincremental-migration+1
1 related pattern
architecturalapi-design

Anti-Corruption Layer

Create a translation layer between new and legacy systems to prevent legacy concepts from leaking into new code

When to Use:
legacy-integrationbounded-context+1
2 related patterns
operationaldeployment

Blue-Green Deployment

Run two identical production environments, switching traffic between them for zero-downtime deployments

When to Use:
zero-downtimequick-rollback+1
1 related pattern
operationaldeployment

Canary Deployment

Gradually roll out changes to a small subset of users before rolling out to the entire infrastructure

When to Use:
risk-reductiona-b-testing+1
2 related patterns
architecturaldata-engineering

Database per Service

Each microservice owns and manages its own database, enabling loose coupling and independent deployability

When to Use:
microservicesteam-autonomy+1
2 related patterns
architecturaldata-engineering

Saga Pattern

Manage data consistency across microservices using a sequence of local transactions with compensating actions

When to Use:
distributed-transactionseventual-consistency+1
2 related patterns
architecturaldata-engineering

Event Sourcing

Store state changes as a sequence of events rather than just the current state

When to Use:
audit-trailtemporal-queries+1
2 related patterns
architecturalapi-design

Backend for Frontend (BFF)

Create separate backend services tailored to each frontend's needs

When to Use:
multiple-clientsmobile-web+1
operationalinfrastructure

Sidecar Pattern

Deploy auxiliary components alongside primary services for cross-cutting concerns

When to Use:
service-meshobservability+1
1 related pattern
operationaldeployment

Feature Flags

Toggle functionality on or off without deploying new code

When to Use:
trunk-based-developmenta-b-testing+1
1 related pattern
creationalprogramming-language

Factory Method

Defines an interface for creating an object but lets subclasses decide which concrete class to instantiate, deferring instantiation to subclasses.

When to Use:
unknown-concrete-typesubclass-decides-creation+2
3 related patterns
creationalprogramming-language

Abstract Factory

Provides an interface for creating families of related objects without specifying their concrete classes, ensuring products from one family are used together.

When to Use:
families-of-related-objectsenforce-product-consistency+2
3 related patterns
creationalprogramming-language

Builder

Separates the construction of a complex object from its representation so the same construction process can create different representations step by step.

When to Use:
many-optional-parametersimmutable-objects+2
2 related patterns
creationalprogramming-language

Prototype

Creates new objects by cloning an existing instance (the prototype) rather than instantiating a class, useful when construction is costly or types are decided at runtime.

When to Use:
expensive-constructionruntime-determined-types+2
3 related patterns
creationalprogramming-language

Singleton

Ensures a class has only one instance and provides a global point of access to it, used for shared resources like configuration, logging, or connection pools.

When to Use:
single-shared-instanceglobal-access-point+2
3 related patterns
creationalbackend

Object Pool

Reuses a set of pre-initialized, expensive-to-create objects from a managed pool instead of creating and destroying them on demand, improving performance.

When to Use:
expensive-object-creationhigh-allocation-churn+2
3 related patterns
creationalsoftware-process

Dependency Injection

Supplies an object's dependencies from the outside rather than having it construct them, inverting control to improve testability, flexibility, and decoupling.

When to Use:
decouple-collaboratorsimprove-testability+2
2 related patterns
creationalprogramming-language

Lazy Initialization

Defers the creation or computation of an object until the first time it is actually needed, avoiding upfront cost for resources that may never be used.

When to Use:
expensive-to-createmay-never-be-used+2
3 related patterns
creationalprogramming-language

Multiton

Generalizes Singleton to manage a fixed, keyed set of named instances, ensuring exactly one instance exists per key through a registry.

When to Use:
one-instance-per-keynamed-shared-resources+2
3 related patterns
creationalprogramming-language

Registry

Provides a well-known central object where shared instances or services can be registered and looked up by key, giving a single point of access without scattered globals.

When to Use:
central-lookup-of-servicesdecouple-locate-from-create+2
3 related patterns
structuralprogramming-language

Adapter

Converts the interface of a class into another interface clients expect, letting classes that could not otherwise collaborate work together.

When to Use:
incompatible-interfacesintegrate-legacy-code+2
2 related patterns2 examples
structuralprogramming-language

Bridge

Decouples an abstraction from its implementation so the two can vary independently, avoiding a combinatorial explosion of subclasses.

When to Use:
two-varying-dimensionsavoid-subclass-explosion+2
3 related patterns
structuralprogramming-language

Composite

Composes objects into tree structures to represent part-whole hierarchies, letting clients treat individual objects and compositions uniformly.

When to Use:
part-whole-hierarchiestree-structures+2
3 related patterns
structuralprogramming-language

Decorator

Attaches additional responsibilities to an object dynamically by wrapping it, providing a flexible alternative to subclassing for extending behavior.

When to Use:
add-behavior-at-runtimeavoid-subclass-explosion+2
3 related patterns
structuralprogramming-language

Flyweight

Minimizes memory use by sharing as much data as possible between many similar objects, separating intrinsic shared state from extrinsic context-specific state.

When to Use:
huge-number-of-objectshigh-memory-pressure+2
3 related patterns
structuralprogramming-language

Proxy

Provides a surrogate or placeholder for another object to control access to it, enabling lazy loading, access control, caching, or remote access.

When to Use:
control-accesslazy-load-heavy-object+2
2 related patterns
structuralprogramming-language

Module

Encapsulates related code into a single self-contained unit with a controlled public interface and hidden private state, organizing code and avoiding global namespace pollution.

When to Use:
encapsulate-related-codehide-implementation-detail+2
2 related patterns1 example
structuralprogramming-language

Marker Interface

Uses an empty interface to tag a class with metadata so other code can detect the capability at runtime via type checks, without adding any methods.

When to Use:
tag-types-with-metadataruntime-type-detection+2
3 related patterns
structuralprogramming-language

Mixin

Composes reusable units of behavior into a class without inheritance, letting unrelated classes share functionality by mixing in shared method sets.

When to Use:
share-behavior-across-classesavoid-deep-inheritance+2
3 related patterns
structuralprogramming-language

Extension Object

Lets you add new interfaces and behavior to a class over time without changing it, by attaching extension objects that clients query for at runtime.

When to Use:
add-interfaces-over-timeoptional-capabilities+2
3 related patterns
structuralprogramming-language

Private Class Data

Restricts accessor-write access to class attributes by isolating data in a separate object exposed read-only after construction, enforcing immutability and encapsulation.

When to Use:
enforce-immutabilitylimit-attribute-write-access+2
3 related patterns
structuralbackend

Front Controller

Channels all incoming requests through a single handler that centralizes cross-cutting concerns like routing, authentication, and logging before dispatching to handlers.

When to Use:
centralize-request-handlingshared-cross-cutting-concerns+2
2 related patterns
behavioralmodeling

Strategy

Defines a family of interchangeable algorithms behind a common interface so the algorithm can vary independently from the clients that use it.

When to Use:
interchangeable-algorithmsavoid-conditional-branching+1
3 related patterns
behavioralmodeling

Observer

Establishes a one-to-many dependency so that when one object changes state, all its dependents are notified and updated automatically.

When to Use:
state-change-notificationdecoupled-listeners+1
3 related patterns
behavioralmodeling

Command

Encapsulates a request as an object, letting you parameterize, queue, log, and undo operations independently of who invokes them.

When to Use:
undo-redoqueue-requests+1
3 related patterns
behavioralmodeling

Iterator

Provides a uniform way to traverse the elements of a collection sequentially without exposing its underlying representation.

When to Use:
uniform-traversalhide-collection-internals+1
3 related patterns
behavioralmodeling

Mediator

Centralizes complex communication between objects in a mediator so components refer to it instead of to each other, reducing coupling.

When to Use:
reduce-object-couplingcentralize-interactions+1
2 related patterns
behavioralmodeling

Memento

Captures and externalizes an object's internal state so it can be restored later without violating encapsulation.

When to Use:
undo-snapshotsrollback-state+1
3 related patterns
behavioralmodeling

State

Lets an object alter its behavior when its internal state changes, appearing to change class by delegating to state-specific objects.

When to Use:
state-dependent-behaviorreplace-state-conditionals+1
3 related patterns
behavioralmodeling

Template Method

Defines the skeleton of an algorithm in a base method, deferring specific steps to subclasses so they can vary parts without changing the structure.

When to Use:
fixed-algorithm-skeletonshare-common-steps+1
3 related patterns
behavioralmodeling

Visitor

Separates an algorithm from the object structure it operates on, letting you add new operations over a class hierarchy without modifying it.

When to Use:
add-operations-without-editingoperate-over-object-tree+1
3 related patterns
behavioralmodeling

Chain of Responsibility

Passes a request along a chain of handlers, each deciding to process it or forward it, decoupling sender from the specific receiver.

When to Use:
multiple-possible-handlersdecouple-sender-receiver+1
3 related patterns
behavioralmodeling

Interpreter

Defines a grammar for a simple language and an interpreter that evaluates sentences in that language using a class per grammar rule.

When to Use:
small-domain-languagerepeated-expression-evaluation+1
3 related patterns
behavioralmodeling

Null Object

Provides a do-nothing object with neutral behavior in place of null, eliminating null checks and special-case handling.

When to Use:
avoid-null-checksdefault-neutral-behavior+1
2 related patterns
behavioralmodeling

Specification

Encapsulates a business rule as a reusable, combinable predicate object that tells whether a candidate satisfies the rule.

When to Use:
reusable-business-rulescombinable-criteria+1
3 related patterns
messagingmessaging-protocol

Publish-Subscribe

Decouples senders from receivers by routing messages through a broker or channel so publishers and subscribers never reference each other.

When to Use:
decoupled-async-messagingfan-out-events+1
2 related patterns
behavioralmodeling

Servant

Defines shared behavior for a group of classes in a separate servant object that operates on them, instead of duplicating the behavior in each class.

When to Use:
shared-behavior-across-classesavoid-method-duplication+1
3 related patterns
architecturalmodeling

Blackboard

Coordinates independent specialized components that incrementally build a shared solution on a common data store for ill-defined problems.

When to Use:
no-deterministic-solutionheterogeneous-knowledge-sources+1
3 related patterns
datamodeling

Repository

Mediates between the domain and data mapping layers via a collection-like interface for accessing domain objects, hiding persistence details.

When to Use:
abstract-data-accesstestable-domain-logic+1
3 related patterns2 examples
datamodeling

Unit of Work

Tracks objects affected by a business transaction and coordinates writing out changes and resolving concurrency as a single commit.

When to Use:
atomic-multi-object-writesminimize-database-round-trips+1
3 related patterns1 example
datamodeling

Data Mapper

Moves data between objects and a database while keeping them independent, so domain objects carry no persistence knowledge.

When to Use:
rich-domain-modeldecouple-domain-from-schema+1
3 related patterns2 examples
datamodeling

Active Record

Wraps a database row in an object that carries both the data and the methods to load, save, and delete itself.

When to Use:
simple-domain-schema-matchcrud-heavy-apps+1
3 related patterns2 examples
datamodeling

Value Object

Models a concept defined by its attributes rather than identity, making it immutable and compared by value to keep the domain expressive and safe.

When to Use:
identity-irrelevantimmutable-domain-concept+1
3 related patterns
datamodeling

Domain Event

Captures something significant that happened in the domain as an explicit object, decoupling the trigger from the reactions to it.

When to Use:
react-to-domain-changesdecouple-side-effects+1
3 related patterns
architecturalmicroservices

API Gateway

A single entry point that routes, aggregates, and secures client requests across many backend microservices.

When to Use:
many-microservicesdiverse-clients+2
4 related patterns
architecturalmicroservices

Service Registry

A database of available service instances and their network locations, kept current as instances start, stop, and fail.

When to Use:
dynamic-instance-locationsautoscaling+2
1 related pattern
architecturalmicroservices

Service Discovery

A mechanism for clients to find the current network location of a service without hard-coding addresses.

When to Use:
dynamic-addressesload-balancing-across-instances+2
2 related patterns1 example
architecturalcloud-architecture

Ambassador

An out-of-process helper that proxies network calls on behalf of an application, handling connectivity concerns transparently.

When to Use:
polyglot-servicesoffload-connectivity-logic+2
3 related patterns
integrationcloud-architecture

Adapter Microservice

A microservice that translates between an application and an external system with an incompatible interface or protocol.

When to Use:
heterogeneous-monitoringinterface-mismatch+2
4 related patterns
architecturalcloud-architecture

Service Mesh

A dedicated infrastructure layer that manages service-to-service communication via co-located proxies and a central control plane.

When to Use:
many-services-east-westuniform-mtls+2
3 related patterns2 examples
integrationmicroservices

API Composition

Implements a query that spans multiple services by invoking each owner service and joining the results in memory.

When to Use:
query-spans-servicesdatabase-per-service+2
4 related patterns
architecturalmicroservices

CQRS (Command Query Responsibility Segregation)

Separates the model that writes data (commands) from the model that reads it (queries) so each can be optimized independently.

When to Use:
read-write-asymmetrycomplex-read-models+2
4 related patterns
integrationmessaging-protocol

Transactional Outbox

Reliably publishes messages by writing them to an outbox table in the same local transaction as the business data change.

When to Use:
atomic-update-and-publishavoid-dual-writes+2
4 related patterns
integrationmessaging-protocol

Change Data Capture (CDC)

Captures row-level changes from a database's transaction log and streams them as events to downstream consumers.

When to Use:
stream-database-changesoutbox-relay+2
4 related patterns2 examples
integrationmicroservices

Aggregator

A component that invokes multiple services and combines their responses into a single consolidated result for the caller.

When to Use:
combine-multiple-responsesreduce-client-round-trips+2
4 related patterns
architecturalapi-design

Gateway Aggregation

Uses a gateway to combine multiple backend requests into one, so clients make a single call instead of many.

When to Use:
chatty-clientshigh-latency-networks+2
4 related patterns
architecturalapi-design

Gateway Offloading

Moves shared cross-cutting functionality such as TLS, auth, and rate limiting out of services and into a gateway.

When to Use:
shared-cross-cutting-concernscentralize-security+2
4 related patterns
architecturalapi-design

Gateway Routing

Routes client requests to the correct backend service through a single endpoint using request attributes such as path or host.

When to Use:
single-public-endpointdecouple-clients-from-topology+2
4 related patterns
architecturalcloud-architecture

Leader Election

Designates a single instance among many to coordinate work, with automatic failover if the leader becomes unavailable.

When to Use:
single-coordinator-neededavoid-duplicate-work+2
3 related patterns
architecturalcloud-architecture

Distributed Lock

Coordinates exclusive access to a shared resource across multiple processes or nodes that do not share memory.

When to Use:
mutual-exclusion-across-nodesprevent-concurrent-updates+2
4 related patterns
architecturalcloud-architecture

Consistent Hashing

Distributes keys across nodes so that adding or removing a node remaps only a small fraction of keys.

When to Use:
distributed-cachingpartition-data-across-nodes+2
4 related patterns
architecturaldatabase

Sharding

Horizontally partitions a data store into independent shards so capacity and load scale beyond a single node.

When to Use:
dataset-exceeds-one-nodewrite-throughput-limits+2
4 related patterns
integrationmessaging-protocol

Scatter-Gather

Broadcasts a request to multiple recipients in parallel, then aggregates their replies into a single response.

When to Use:
query-many-providersbest-of-several-responses+2
4 related patterns
architecturalmicroservices

Choreography

Coordinates a distributed workflow through services reacting to each other's events, with no central controller.

When to Use:
decoupled-event-driven-flowavoid-central-coordinator+2
4 related patterns
architecturalmicroservices

Orchestration

Coordinates a distributed workflow through a central orchestrator that explicitly invokes each service in sequence.

When to Use:
complex-multi-step-workflowscentral-visibility+2
4 related patterns
architecturalcloud-architecture

Externalized Configuration

Stores configuration outside the application artifact so the same build runs unchanged across environments.

When to Use:
multiple-environmentsimmutable-artifacts+2
2 related patterns
cloudcloud-architecture

Cache-Aside

Load data into a cache on demand from a data store to improve read performance and reduce load on the backing store.

When to Use:
read-heavy-workloadsexpensive-data-store-reads+1
3 related patterns
messagingcloud-architecture

Competing Consumers

Enable multiple concurrent consumers to process messages from the same queue to increase throughput and improve resilience.

When to Use:
variable-message-volumeparallelizable-tasks+1
1 related pattern
messagingcloud-architecture

Queue-Based Load Leveling

Use a queue between tasks and a service to smooth intermittent heavy loads and protect the service from being overwhelmed.

When to Use:
spiky-trafficdownstream-throughput-limits+1
3 related patterns
resiliencecloud-architecture

Throttling

Control the consumption of resources by an instance, tenant, or service so a system stays within capacity under load.

When to Use:
protect-against-overloadenforce-tenant-quotas+1
2 related patterns
messagingcloud-architecture

Claim Check

Store a large message payload externally and pass only a reference through the messaging system to avoid moving bulky data.

When to Use:
large-message-payloadsbroker-size-limits+1
3 related patterns
securitysecurity

Valet Key

Issue a client a token granting scoped, time-limited direct access to a resource, offloading data transfer from the application.

When to Use:
large-file-upload-downloadoffload-data-transfer+1
3 related patterns
securitysecurity

Gatekeeper

Protect services by brokering all client requests through a dedicated host that validates and sanitizes them before forwarding.

When to Use:
sensitive-backend-servicesuntrusted-clients+1
3 related patterns
securityidentity-auth

Federated Identity

Delegate authentication to an external identity provider so applications trust tokens rather than managing credentials themselves.

When to Use:
single-sign-onexternal-or-social-identities+1
3 related patterns
datacloud-architecture

Compensating Transaction

Undo the completed steps of a multi-step operation when one step fails, restoring consistency without distributed ACID transactions.

When to Use:
distributed-multi-step-operationsno-two-phase-commit+1
2 related patterns
deploymentcloud-architecture

Geode

Deploy independent geographically distributed nodes that each serve any request, placing compute close to users worldwide.

When to Use:
global-user-baselow-latency-everywhere+1
3 related patterns
deploymentdeployment

Deployment Stamps

Deploy multiple independent copies of a full application stack to scale, isolate tenants, and contain failures.

When to Use:
multi-tenant-isolationscale-beyond-single-stack+1
3 related patterns
deploymentcloud-architecture

Static Content Hosting

Serve static assets from storage or a CDN instead of application servers to cut load, latency, and cost.

When to Use:
serving-static-assetsglobal-low-latency-delivery+1
3 related patterns
cloudcloud-architecture

External Configuration Store

Move configuration out of deployment packages into a central external store shared and updated across application instances.

When to Use:
shared-config-across-instancesruntime-config-changes+1
2 related patterns
resilienceobservability

Health Endpoint Monitoring

Expose health-check endpoints that monitoring tools and load balancers probe to verify an application is functioning correctly.

When to Use:
load-balancer-health-checksautomated-failure-detection+1
2 related patterns
datadatabase

Index Table

Create secondary index tables over data stores queried by non-key fields to speed up lookups that would otherwise scan.

When to Use:
frequent-non-key-queriesnosql-without-secondary-indexes+1
3 related patterns
datadatabase

Materialized View

Precompute and store read-optimized views of data so expensive queries become fast lookups against ready-made results.

When to Use:
expensive-aggregationsread-heavy-reporting+1
2 related patterns
integrationcloud-architecture

Pipes and Filters

Decompose complex processing into a sequence of independent components connected by channels so each step can scale and evolve.

When to Use:
multi-step-data-processingindependently-scalable-stages+1
3 related patterns
messagingcloud-architecture

Sequential Convoy

Process related messages in order while still processing unrelated messages in parallel, by grouping them into ordered sets.

When to Use:
ordering-within-groupsparallelism-across-groups+1
2 related patterns
resiliencecloud-architecture

Rate Limiting

Constrain the rate of operations against a service or resource to stay within quotas and avoid throttling or overload.

When to Use:
respect-downstream-quotasprevent-self-throttling+1
3 related patterns
resiliencecloud-architecture

Retry

Automatically reattempt a failed operation that is likely transient, using backoff and limits to recover without user impact.

When to Use:
transient-faultsunreliable-network-calls+1
2 related patterns
messagingmessaging-protocol

Message Channel

Connects two applications with a logical pipe so a sender can transmit data to a receiver without knowing the receiver's location or identity.

When to Use:
decouple-sender-receiverasynchronous-communication+1
3 related patterns
messagingmessaging-protocol

Point-to-Point Channel

Ensures exactly one receiver consumes each message on a channel, even when multiple consumers compete, so a message is processed once.

When to Use:
single-consumer-per-messagework-distribution+1
3 related patterns
messagingmessaging-protocol

Publish-Subscribe Channel

Broadcasts each message to all interested subscribers so one event can notify many independent consumers without the publisher knowing them.

When to Use:
broadcast-eventsmultiple-independent-consumers+1
4 related patterns
integrationmicroservices

Message Router

Consumes a message and redirects it to a different channel based on conditions, decoupling producers from the decision of where messages should go.

When to Use:
conditional-routingdecouple-routing-logic+1
3 related patterns
integrationmicroservices

Content-Based Router

Routes each message to a destination channel chosen by inspecting the message's content, so the payload itself determines where it is delivered.

When to Use:
route-by-payloadheterogeneous-message-types+1
4 related patterns
integrationmessaging-protocol

Message Filter

Lets only messages meeting specified criteria pass through a channel and silently discards the rest, so consumers receive only relevant messages.

When to Use:
drop-irrelevant-messagesselective-subscription+1
4 related patterns
integrationdata-engineering

Splitter

Breaks a composite message into a series of individual messages so each element can be processed independently downstream.

When to Use:
process-collection-itemsdecompose-batch+1
4 related patterns
integrationapi-design

Message Translator

Converts a message from one data format or schema to another so systems with incompatible representations can communicate.

When to Use:
bridge-incompatible-formatsschema-conversion+1
3 related patterns2 examples
integrationdata-engineering

Content Enricher

Augments a message with additional data from an external source when the original lacks information the receiver requires.

When to Use:
add-missing-datalookup-reference-data+1
3 related patterns
integrationdata-engineering

Normalizer

Translates messages arriving in many different formats into a single common format so downstream components handle one canonical representation.

When to Use:
unify-multiple-formatsmany-source-systems+1
4 related patterns
messagingmessaging-protocol

Polling Consumer

A consumer that explicitly checks a channel for messages on its own schedule, controlling exactly when and how fast it receives them.

When to Use:
control-consumption-ratebatch-style-processing+1
3 related patterns
messagingmessaging-protocol

Event-Driven Consumer

A consumer that is invoked by the messaging system the moment a message arrives, reacting to messages instead of polling for them.

When to Use:
low-latency-reactionpush-based-delivery+1
3 related patterns
resiliencemessaging-protocol

Idempotent Receiver

Makes a consumer safely handle duplicate messages so that processing the same message more than once has the same effect as processing it once.

When to Use:
at-least-once-deliverytolerate-duplicates+1
4 related patterns
resiliencemessaging-protocol

Dead Letter Channel

Routes messages that cannot be delivered or processed to a dedicated channel for inspection and recovery instead of discarding or blocking them.

When to Use:
handle-poison-messagesisolate-failures+1
3 related patterns
resiliencemessaging-protocol

Guaranteed Delivery

Persists messages so they are not lost if the sender, broker, or receiver fails, ensuring each message is eventually delivered despite outages.

When to Use:
no-message-losssurvive-broker-restart+1
3 related patterns
messagingapi-design

Request-Reply

Lets a requestor send a message and receive a corresponding response over messaging, combining two one-way channels into a logical two-way exchange.

When to Use:
need-responseasync-rpc-over-messaging+1
4 related patterns
messagingmessaging-protocol

Correlation Identifier

Tags messages with a unique id that links related messages together, so a reply can be matched to its request and parts to their whole.

When to Use:
match-reply-to-requesttrack-related-messages+1
4 related patterns
integrationobservability

Wire Tap

Copies messages flowing through a channel to a secondary channel for inspection, logging, or analysis without disturbing the primary flow.

When to Use:
inspect-message-flowaudit-and-logging+1
3 related patterns
integrationmicroservices

Routing Slip

Attaches a sequence of processing steps to a message so it routes itself through a series of components determined per message at runtime.

When to Use:
dynamic-processing-sequenceper-message-workflow+1
4 related patterns
integrationmicroservices

Process Manager

A central component that maintains the state of a multi-step message flow and decides the next step, coordinating complex or branching workflows.

When to Use:
coordinate-multi-step-workflowbranching-or-parallel-steps+1
4 related patterns
databackend

Read-Through Cache

A caching strategy where the cache itself loads missing data from the backing store on a miss, so application code reads only from the cache.

When to Use:
read-heavy-workloadtransparent-caching+1
2 related patterns1 example
databackend

Write-Through Cache

A caching strategy where every write goes to the cache and the backing store synchronously, keeping the two consistent at the cost of write latency.

When to Use:
read-after-write-consistencymoderate-write-rate+1
2 related patterns1 example
databackend

Write-Behind Cache

A caching strategy where writes update the cache immediately and are flushed to the backing store asynchronously, maximizing write throughput at the cost of durability.

When to Use:
write-heavy-workloadburst-absorption+1
3 related patterns1 example
databackend

Refresh-Ahead Cache

A caching strategy that proactively reloads hot entries before they expire, so reads of popular keys never pay miss latency.

When to Use:
predictable-hot-keyslow-latency-reads+1
2 related patterns
datadatabase

Materialized View

A precomputed, stored result set that trades storage and refresh cost for fast reads of expensive queries, aggregations, or denormalized projections.

When to Use:
expensive-aggregationsread-optimized-projections+1
3 related patterns2 examples
datadata-engineering

Polyglot Persistence

An architecture that uses multiple, purpose-fit data stores within one system, matching each store's strengths to each data access pattern.

When to Use:
heterogeneous-data-needsspecialized-query-patterns+1
3 related patterns3 examples
databackend

Command Query Responsibility Segregation (CQRS)

Separates the write model that handles commands from the read model that serves queries, letting each be optimized, scaled, and evolved independently.

When to Use:
divergent-read-write-modelsindependent-read-scaling+1
3 related patterns
architecturalbackend

Event-Driven Architecture

An architectural style where components communicate by producing and reacting to events, enabling loose coupling, asynchronous flow, and independent scaling.

When to Use:
loose-couplingasynchronous-workflows+1
3 related patterns
datadata-engineering

Lambda Architecture

A big-data design that runs a batch layer for accurate historical views and a speed layer for low-latency recent data, merging both at query time.

When to Use:
batch-plus-realtimereprocessable-history+1
3 related patterns
datadata-engineering

Kappa Architecture

A streaming-first data design that uses a single processing path over an immutable log, reprocessing history by replay instead of a separate batch layer.

When to Use:
streaming-firstsingle-codebase+1
3 related patterns
datadata-engineering

Medallion Architecture

A lakehouse data-organization pattern that refines data through bronze (raw), silver (cleaned), and gold (curated) layers for progressive quality and reuse.

When to Use:
lakehouse-pipelinesprogressive-data-refinement+1
3 related patterns
datadata-engineering

Data Lakehouse

A data architecture that adds warehouse-style ACID tables, schema, and governance directly on low-cost data-lake storage, unifying analytics and ML on one platform.

When to Use:
unified-analytics-and-mlopen-table-formats+1
3 related patterns
datadatabase

Star Schema

A dimensional data-modeling pattern with a central fact table linked to denormalized dimension tables, optimized for fast, intuitive analytical queries.

When to Use:
analytical-reportingbi-dashboards+1
3 related patterns
datadata-engineering

Slowly Changing Dimension (SCD)

Techniques for handling changes to dimension attributes over time in a data warehouse, ranging from overwriting to preserving full historical versions.

When to Use:
dimension-attribute-changeshistorical-accuracy+1
3 related patterns
databackend

Idempotent Writer

A pattern that makes repeated writes safe by ensuring duplicate operations produce the same result, essential for at-least-once delivery and retries.

When to Use:
at-least-once-deliveryretryable-writes+1
3 related patterns
concurrencyprogramming-language

Producer-Consumer

A concurrency pattern where producers place work on a shared bounded queue and consumers process it independently, decoupling rates and smoothing load.

When to Use:
rate-decouplingload-smoothing+1
3 related patterns
concurrencyprogramming-language

Thread Pool

A concurrency pattern that reuses a fixed set of worker threads to execute many tasks, avoiding per-task thread creation cost and bounding concurrency.

When to Use:
many-short-tasksbounded-concurrency+1
1 related pattern
concurrencyprogramming-language

Actor Model

A concurrency model where independent actors encapsulate state and communicate only by asynchronous messages, avoiding shared memory and locks.

When to Use:
high-concurrencystateful-entities+1
2 related patterns
concurrencyprogramming-language

Reactor

An event-handling pattern that demultiplexes I/O events on one or few threads and dispatches them synchronously to registered handlers, enabling scalable non-blocking servers.

When to Use:
high-connection-countsnon-blocking-io+1
1 related pattern
concurrencydatabase

Optimistic Concurrency Control

A concurrency strategy that lets transactions proceed without locking and validates at commit, retrying on conflict, assuming conflicts are rare.

When to Use:
low-contentionshort-transactions+1
3 related patterns
concurrencydatabase

Pessimistic Locking

A concurrency strategy that acquires locks on data before use to prevent concurrent modification, ensuring correctness under high contention at the cost of throughput.

When to Use:
high-contentionlong-critical-sections+1
2 related patterns
concurrencydatabase

Two-Phase Commit (2PC)

A distributed-transaction protocol that coordinates multiple participants to commit or abort atomically through a prepare phase and a commit phase.

When to Use:
distributed-atomic-commitmultiple-resource-managers+1
3 related patterns
resiliencemicroservices

Retry with Backoff

Automatically re-attempts a failed operation after progressively longer waits, smoothing over transient faults without overwhelming a struggling dependency.

When to Use:
transient-failuresidempotent-operations+2
3 related patterns
resiliencemicroservices

Exponential Backoff with Jitter

Adds randomness to exponentially growing retry delays so that many clients do not retry in lockstep and overwhelm a recovering service.

When to Use:
high-concurrency-retriesthundering-herd-risk+2
3 related patterns
resiliencemicroservices

Timeout

Bounds how long a caller waits for an operation, freeing resources and surfacing failures fast instead of blocking indefinitely on a slow or hung dependency.

When to Use:
remote-callsresource-protection+2
3 related patterns
resiliencemicroservices

Bulkhead

Isolates resources into independent pools so a failure or overload in one part of a system cannot consume capacity needed by the rest.

When to Use:
shared-resource-poolsnoisy-neighbor+2
3 related patterns
resiliencecloud-architecture

Rate Limiter

Caps how many requests a client or system may make in a time window, protecting services from overload, abuse, and runaway cost.

When to Use:
api-protectionabuse-prevention+2
3 related patterns
resiliencecloud-architecture

Load Shedding

Deliberately rejects or drops lower-priority work when a system nears capacity, preserving stability and protecting high-priority requests under overload.

When to Use:
overload-protectioncapacity-limits+2
4 related patterns
resiliencemicroservices

Fallback

Provides an alternative response or behavior when a primary operation fails, keeping the system useful instead of returning an error to the user.

When to Use:
dependency-failuredegraded-experience+2
2 related patterns
resiliencecloud-architecture

Graceful Degradation

Keeps core functionality working by selectively disabling or simplifying non-essential features when parts of a system fail or are overloaded.

When to Use:
partial-failuredependency-outage+2
3 related patterns
resiliencemicroservices

Fail Fast

Detects invalid state or unavailable dependencies as early as possible and reports the error immediately, rather than continuing into deeper, costlier failure.

When to Use:
input-validationunavailable-dependency+2
3 related patterns
resilienceinfrastructure

Fail Safe

Designs a system so that when a component fails it falls into a safe, known default state rather than an unsafe or undefined one.

When to Use:
safety-criticalsecurity-defaults+2
3 related patterns
resilienceinfrastructure

Heartbeat

Has a component emit periodic signals so observers can detect when it has failed or become unreachable within a bounded time.

When to Use:
failure-detectionliveness-monitoring+2
1 related pattern
resilienceinfrastructure

Health Check

Exposes endpoints that report whether a service is alive and ready to serve, enabling orchestrators and load balancers to route traffic only to healthy instances.

When to Use:
orchestrationload-balancing+2
2 related patterns2 examples
resilienceinfrastructure

Watchdog

An independent supervisor that monitors a system or process and takes corrective action — restart, alert, or failover — when it stops responding.

When to Use:
hang-detectionauto-recovery+2
2 related patterns
resiliencemicroservices

Backpressure

Lets a slow consumer signal upstream producers to slow down, preventing unbounded queues and memory exhaustion when demand exceeds processing capacity.

When to Use:
streamingproducer-consumer-mismatch+2
2 related patterns
resilienceapi-design

Idempotency Key

Attaches a unique key to a request so the server can detect and de-duplicate retries, making non-idempotent operations safe to repeat.

When to Use:
unreliable-networksat-least-once-delivery+2
3 related patterns
resiliencemessaging-protocol

Dead-Letter Queue

Routes messages that cannot be processed after repeated attempts to a separate queue for inspection and recovery, keeping the main pipeline flowing.

When to Use:
unprocessable-messagespoison-messages+2
3 related patterns
resiliencemessaging-protocol

Poison Message Handling

Detects and quarantines messages that repeatedly crash or block a consumer, preventing one bad message from stalling an entire queue.

When to Use:
repeated-consumer-failurequeue-blocking+2
3 related patterns
resiliencecloud-architecture

Hedged Requests

Sends a duplicate request to another replica after a delay, taking whichever response returns first to cut tail latency from slow servers.

When to Use:
tail-latencyread-heavy+2
4 related patterns
resiliencecloud-architecture

Request Coalescing

Merges multiple concurrent identical requests into a single backend call and shares the result, preventing duplicate work and cache-stampede overload.

When to Use:
cache-stampededuplicate-concurrent-requests+2
3 related patterns
resilienceobservability

Distributed Tracing

Tracks a single request as it flows across many services by propagating context, producing an end-to-end timeline that reveals latency and failure sources.

When to Use:
microservices-debugginglatency-analysis+2
3 related patterns
resilienceobservability

Correlation ID

Assigns a unique identifier to a request and propagates it through every service and log, so related events across a distributed system can be tied together.

When to Use:
log-correlationdistributed-debugging+2
3 related patterns
structuralfrontend

Container/Presentational Pattern

Separates components that fetch and manage data (containers) from components that only render UI from props (presentational), improving reuse and testability.

When to Use:
separate-data-from-uireuse-dumb-components+2
3 related patterns1 example
structuralfrontend

Higher-Order Component (HOC)

A function that takes a component and returns a new component with added behavior, enabling cross-cutting concerns to be shared without inheritance.

When to Use:
share-cross-cutting-logicwrap-components+2
4 related patterns1 example
behavioralfrontend

Render Props

A component shares logic by accepting a function prop that it calls with internal state, letting the caller control rendering while reusing behavior.

When to Use:
share-stateful-logicinvert-rendering-control+2
4 related patterns1 example
behavioralfrontend

Custom Hooks

Extracts reusable stateful logic from React function components into named hook functions, sharing behavior without wrapper components or prop drilling.

When to Use:
reuse-stateful-logicencapsulate-side-effects+2
4 related patterns1 example
structuralfrontend

Compound Components

A set of components that work together and share implicit state through context, giving consumers a flexible, declarative API for a composite widget.

When to Use:
build-flexible-widget-apishare-implicit-state+2
4 related patterns
structuralfrontend

Provider Pattern

Distributes shared state or services to a component subtree through context, avoiding prop drilling and centralizing access to cross-cutting data.

When to Use:
avoid-prop-drillingshare-global-state+2
2 related patterns1 example
architecturalfrontend

Model-View-Controller (MVC)

Separates an application into a model (data and rules), a view (presentation), and a controller (input handling), decoupling concerns for maintainability.

When to Use:
separate-ui-from-logicstructure-web-applications+2
2 related patterns2 examples
architecturalfrontend

Model-View-ViewModel (MVVM)

Separates UI from logic via a view-model that exposes bindable state and commands, with two-way data binding keeping the view and view-model in sync.

When to Use:
data-binding-frameworkstestable-presentation-logic+2
2 related patterns2 examples
architecturalfrontend

Micro Frontend

Decomposes a web frontend into independently developed and deployed pieces owned by separate teams, then composes them into one application at runtime or build time.

When to Use:
independent-team-ownershipindependent-deployments+2
4 related patterns2 examples
architecturalfrontend

Island Architecture

Renders a page as mostly static HTML with isolated interactive 'islands' that hydrate independently, minimizing JavaScript shipped to the browser.

When to Use:
content-heavy-sitesminimize-client-javascript+2
3 related patterns2 examples
apiapi-design

Pagination

Splits a large result set into smaller pages so APIs and UIs can return and traverse data incrementally instead of loading everything at once.

When to Use:
large-result-setslimit-response-size+2
3 related patterns1 example
apiapi-design

HATEOAS

Hypermedia as the Engine of Application State: REST responses include links describing available actions, letting clients navigate the API by following links.

When to Use:
discoverable-apisdecouple-clients-from-urls+2
3 related patterns
apiapi-design

Idempotency Key

A client-supplied unique key lets a server detect and dedupe retried requests, so repeated submissions produce the same result exactly once.

When to Use:
safe-retriesprevent-duplicate-charges+2
2 related patterns
apiapi-design

API Versioning

Strategies for evolving an API without breaking existing clients, by exposing multiple versions through URLs, headers, or media types.

When to Use:
breaking-contract-changessupport-multiple-clients+2
4 related patterns2 examples
integrationweb-protocol

Webhook

A server pushes event notifications to a client-registered HTTP endpoint as events occur, replacing inefficient polling with real-time callbacks.

When to Use:
push-event-notificationsavoid-polling+2
2 related patterns
securitysecurity

Defense in Depth

Layers multiple independent security controls so that if one fails, others still protect the system, avoiding reliance on any single defense.

When to Use:
reduce-single-point-of-failureprotect-sensitive-systems+2
4 related patterns
securitysecurity

Principle of Least Privilege

Grants every user, process, and service only the minimum permissions needed for its task, limiting the blast radius of compromise or error.

When to Use:
limit-blast-radiusscope-access-rights+2
4 related patterns
securitysecurity

Token Bucket (Rate Limiting)

A rate-limiting algorithm where requests consume tokens refilled at a steady rate, allowing controlled bursts while capping the long-run request rate.

When to Use:
rate-limit-apisthrottle-clients+2
3 related patterns
securitysecurity

Secrets Rotation

Regularly replacing credentials, keys, and tokens, ideally automatically, to limit the time window in which a leaked or compromised secret is useful.

When to Use:
limit-credential-exposurecomply-with-key-policy+2
4 related patterns
securitysecurity

Secure by Default

Systems ship with the most secure configuration out of the box, requiring deliberate action to reduce security rather than to enable it.

When to Use:
safe-default-configurationreduce-misconfiguration-risk+2
4 related patterns
securitysecurity

Zero Trust Segmentation

Eliminates implicit network trust by authenticating and authorizing every request and dividing the network into fine-grained, individually protected segments.

When to Use:
eliminate-implicit-trustlimit-lateral-movement+2
4 related patterns