Learn architecture by running code.
Browse the templatesArchitecture
See all- Hexagonal architectureKeep the business rules in a core that declares ports, and plug HTTP, storage and providers in as adapters.TypeScriptGo
- CQRSChange orders through commands, and answer reads from read models that projections keep up to date.TypeScriptGo
- Event sourcingStore what happened to an order as events, and rebuild its current state by replaying them.TypeScript
- OutboxSave each event in the same transaction as the order, and let a relay publish it to the broker.TypeScriptGo
- State machineReplace status booleans with explicit states and one table of allowed transitions.TypeScript
SOLID principles
See all- Single responsibilitySplit a class along its reasons to change, so each change touches one small piece.TypeScript
- Open/closedAdd a new discount by adding a rule, without editing the code that computes prices.TypeScript
- Liskov substitutionA subtype must keep every promise of the type it stands in for, or not claim to be one.TypeScript
- Interface segregationGive each client an interface with only the methods it calls, so no implementation has to fake the rest.TypeScriptGo
- Dependency inversionMake the business code own the interfaces it needs, and let the infrastructure plug into them.TypeScriptGo
- StrategyPick an algorithm at runtime without the caller knowing which one runs.TypeScriptGo
- ObserverAnnounce that something happened and let any number of subscribers react, without knowing them.TypeScriptJavaScript
- DecoratorAdd behaviour to an object by wrapping it in another object with the same interface.TypeScriptJavaScriptGo
- Factory MethodLet subclasses decide which object to create, inside an algorithm the base class keeps.TypeScript
- AdapterWrap a foreign interface in one class that speaks the interface your code expects.TypeScriptGo