1. Cheat sheets
  2. Architecture

8 minReference

Software architecture cheat sheet

Software, solution and enterprise architecture on a few screens: quality attributes and the tactics behind them, when to pick each architecture style, who owns which data, integration patterns, an ADR template, the C4 levels, cloud cost levers, strangler-fig migration, and the enterprise basics of capability maps, value streams and the TIME portfolio model. Keep it open during design reviews and roadmap planning.

The architect's job on one line

Find the few decisions that are expensive to change, make them on purpose with the people affected, write them down, and keep checking that the system still matches them. Everything else, let the team decide quickly (The architect's job, Design reviews).

Quality attributes and tactics

Turn every "-ility" into a scenario with a number: source, stimulus, environment, response, measure. "During the festival peak, 4 times the normal 60,000 orders a day, checkout p95 stays under 800 ms" can be tested; "checkout must be fast" cannot (Quality attributes).

AttributeScenario to writeTactics to reach forLesson
Performancep95 latency at peak loadCaching, indexes, async work in queues, fewer network hopsQuality attributes, Caching
ScalabilityLoad the system must take next year, and how fast it growsStateless services, horizontal scaling, partitioning, read replicasScale up vs out
AvailabilitySLO such as 99.9% a month, and allowed downtimeRedundancy, health checks, failover, graceful degradationp99 and SLOs
ResilienceWhat the user sees when a dependency failsTimeouts, retries with backoff, circuit breakers, bulkheads, fallbacksTimeouts and retries
ModifiabilityHow long a typical change takes and how many teams it touchesClear module boundaries, low coupling, high cohesion, stable interfacesArchitecture styles
SecurityWho may do what, and what happens when an account is stolenLeast privilege, defence in depth, encryption, audit logsSecurity
ObservabilityTime to find the cause of a slow requestStructured logs, metrics, traces, a request id everywhereObservability
Data integrityWhat must never be lost or duplicated (payments, stock)Transactions, idempotency keys, outbox, reconcilersOutbox and sagas
CostCost per order or per store per monthRight-sizing, autoscaling, storage tiers, fewer moving partsCloud and cost
DeployabilityHow often and how safely you can releaseCI/CD, feature flags, backward-compatible changes, canariesShipping

Trade-offs that keep coming back

Attributes pull against each other. Name the trade-off out loud in the review instead of hiding it (Quality attributes, CAP and consistency).

  • Consistency or availability during a network split (CAP), and latency or consistency the rest of the time.
  • Performance or modifiability: caches and denormalized copies are fast but are more to keep in step.
  • Independence or simplicity: more services means more freedom for teams and more operations work.
  • Security or convenience: every extra step at login costs some users.
  • Cost or resilience: a second region doubles some bills.

Architecture styles: when to pick which

Start with the simplest style that meets the scenarios. Mangrove's order platform is still one NestJS modular monolith shared by four teams; it splits out a service only when a scenario demands it (Architecture styles, Service boundaries).

StyleGood whenCosts youLesson
MonolithOne small team, a new product, unclear domainGrows into a "big ball of mud" without boundariesArchitecture styles
Modular monolithA few teams in one codebase; the default for most companiesNeeds discipline: modules talk through interfaces, own their tablesService boundaries
MicroservicesMany teams that must deploy and scale independently; clear, stable domainsNetwork failures, distributed data, many pipelines, on-call per serviceService boundaries
Event-drivenSeveral parts react to the same business event (order placed, stock received)Harder to follow a flow; needs idempotent consumers and good tracingArchitecture styles, Queues and jobs
LayeredSimple apps with CRUD screensBusiness rules leak across layers; changes cut through every layerArchitecture styles
Hexagonal (ports and adapters)Core rules must be tested without the database or vendorsMore interfaces and filesArchitecture styles
Serverless functionsSpiky or rare workloads, glue between servicesCold starts, vendor limits, harder local testingCloud and cost
Offline-first clientsTills, scanners and riders on patchy networksSync, conflict rules, versioned clients in the fieldOffline sync

If you see X, reach for Y

Most architecture problems show up as team pain long before they show up as outages.

You seeReach for firstThen, if neededLesson
Every change touches five modulesRedraw boundaries around business capabilitiesMove code and data together into one moduleData ownership
Two services write the same tableGive the table one owner; others call its API or read its eventsA read-only copy fed by eventsData ownership
Releases wait for other teamsBackward-compatible contracts and feature flagsSplit the deployable along team linesService boundaries
A chain of synchronous calls fails oftenTimeouts, fewer hops, cache reference dataEvents and a local copy instead of a callTimeouts and retries
Saved in the database but the event never went outTransactional outboxCDC as the relayOutbox and sagas
A process spans services and can half-failSaga with compensating actionsAn orchestrator with a state machineOutbox and sagas
The cloud bill grows faster than ordersCost per order dashboard; tag every resource by teamRight-size, reserve steady load, delete idle environmentsCloud and cost
Nobody remembers why something was built this wayWrite ADRs for new decisions from todayReconstruct ADRs for the three most painful old onesADRs and C4
An old system nobody dares to touchCharacterization tests, then strangler figAnti-corruption layer around itLegacy migration
Three apps do the same job in three departmentsApp portfolio review with the TIME modelOne target platform with a migration roadmapApp portfolio

Data ownership rules

  • Every table has exactly one owning module or service. Only the owner writes it (Data ownership).
  • Others get data through the owner's API, its published events, or a read-only copy they keep themselves.
  • Name one source of truth for each key fact: stock on hand, price, customer address (Capability maps).
  • Copies are allowed; disagreement is not. Decide which copy wins and how it catches up.
  • No shared database between services that deploy separately: it couples their releases and their schemas (Service boundaries).
  • Reporting reads from a warehouse fed by events or CDC, not from production tables (Data stores).

Integration patterns

How the Store app, POS, Partner app and warehouse systems exchange data at Mangrove (Architecture styles, Queues and jobs).

PatternUse whenWatch out forLesson
Synchronous API callThe caller needs the answer now (price check, stock reservation)Latency adds up; set timeouts; the callee's outage becomes yoursAPIs
Queue (point to point)Work one worker should do once (send receipt, resize image)At-least-once delivery: handlers must be idempotentQueues and jobs
Pub/sub eventsSeveral systems react to one fact (order placed)Event schema becomes a contract; version itQueues and jobs
Change data captureStream a database's changes to search, warehouse or cachesExposes table structure; publish clean events where you canData stores
Batch file transferOld systems, suppliers, nightly finance exportsLate data, partial files; validate and quarantine bad rowsPOS sales sync
WebhookAn outside system tells you something happenedVerify signatures; expect duplicates and lost callsNo overselling
API gateway or backend-for-frontendMany clients need one entry point, auth and rate limitsKeep business rules out of the gatewayArchitecture styles
Anti-corruption layerA legacy or vendor model would leak into your designOne more layer to maintainLegacy migration

ADR template

One decision per record, about one page, kept in the repository next to the code (for example docs/adr/0007-modular-monolith.md). Never edit an accepted ADR's decision; write a new one that supersedes it (ADRs and C4).

Markdown
# ADR 0007: Keep the order platform a modular monolith

Status: Accepted (2026-03-02). Supersedes: none.
Deciders: Nadia (tech lead), Ken (EM), platform team.

## Context
4 teams (about 30 engineers) share one NestJS app and one Postgres.
Festival peak is 4x normal (240,000 app orders a day).
Pain today: modules call each other's tables directly.

## Options
1. Split into 6 microservices now.
2. Modular monolith: modules own their tables, talk via interfaces and events.
3. Do nothing.

## Decision
Option 2. Revisit when one module needs its own scaling or release cadence.

## Consequences
+ One deploy, one database, simple on-call.
+ Boundaries ready if we split later.
- Needs a lint rule that blocks cross-module imports.
- One bad migration can still affect everyone.

C4 model: four zoom levels

Draw only the levels your audience needs. Most teams keep levels 1 and 2 up to date and draw level 3 when a container is complex. Every box has a name, a type and one line on what it does; every arrow says what flows and how (ADRs and C4).

LevelShowsMangrove exampleAudience
1. System contextYour system, its users and the other systems around itOrder platform, customers, riders, payment provider, warehouse systemEveryone, including execs
2. ContainerDeployable or runnable parts: apps, APIs, databases, queuesMangrove app, NestJS API, Postgres, Redis, job queue, Back officeEngineers, ops, security
3. ComponentMain modules inside one containerOrders, Slots, Stock and Payments modules in the APIThe team that owns it
4. CodeClasses and functionsGenerated from code, if at allRarely needed

Cloud and cost levers

Measure cost per unit of business (per order, per store, per active user), not just the monthly total. Then pull the levers in this order (Cloud and cost, FinOps).

LeverHowTypical effectLesson
Delete wasteIdle environments, unattached disks, old snapshots, forgotten test clustersQuick wins, no riskFinOps
Right-sizeMatch instance size to measured CPU and memoryOften large savings on over-provisioned serversCloud and cost
ScheduleTurn off dev and test outside working hoursThose environments run about a third of the weekFinOps
CommitReserved capacity or savings plans for steady base loadLower unit price in exchange for a 1 or 3 year commitmentCloud and cost
Autoscale and spotScale with traffic; interruptible capacity for batch jobsPay for peaks only during peaksCloud and cost
Storage tiersLifecycle rules move old files and logs to cheaper tiersMatters once logs and images pile upCloud and cost
Data transferCDN for public files, keep chatty services in one zoneEgress is easy to overlookFiles and CDNs
Build or buyCompare total cost of ownership, including people and on-callA managed service often costs less than the engineers to run your ownBuild or buy

Legacy migration: strangler fig, step by step

Replace an old system piece by piece behind a routing layer, instead of a big-bang rewrite. Mangrove used it to move goods received notes (GRN) off the old store back office (Legacy migration).

  1. Put a facade or proxy in front of the old system so every call passes through one place.
  2. Write characterization tests that record what the old system does today, bugs included.
  3. Pick one thin slice with clear value and low risk (for example "view GRN history").
  4. Build it in the new system; route a few stores (start with S-014) to it; compare results in shadow mode.
  5. Move data with a one-way sync first, then switch the source of truth when the slice is stable.
  6. Repeat slice by slice. Remove old code as each slice moves, so you never run two full systems forever.
  7. Decommission: switch off, archive the data, cancel the licence. Put the date in the plan.

Enterprise architecture basics

Enterprise architecture looks at the whole company: what it must be able to do, how value reaches customers, and which applications support that (Why EA).

ToolWhat it isMangrove exampleLesson
Capability mapWhat the business does, as stable nouns, independent of org chart and systems; 2 or 3 levels deepSourcing, Inventory management, Store operations, Last-mile delivery, Customer paymentsCapability maps
Heat mapCapabilities coloured by importance and how well they are supported todayInventory accuracy (82%) marked red: high importance, weak supportCapability maps
Value streamStages that deliver one outcome to a customer, end to end"Get groceries delivered": browse, order, pick, deliver, resolve issuesValue streams
Application portfolioEvery application with owner, cost, users, capabilities supported and healthThree stock-count tools across regionsApp portfolio
Target state and roadmapWhere the landscape should be in 2 or 3 years, and the steps to get thereOne inventory platform; old tools retired by store regionTarget and roadmap
GovernanceLight rules: principles, an architecture review for one-way doors, standards"Buy for commodity capabilities, build for differentiating ones"Governance

TIME model for the app portfolio

Score each application on business value and technical health, then place it in one of four boxes (Gartner's TIME model) (App portfolio).

BoxBusiness valueTechnical healthAction
TolerateLowGoodKeep running, minimal spend, no new features
InvestHighGoodFund and extend; it is a platform to build on
MigrateHighPoorMove its capability to a new platform (strangler fig)
EliminateLowPoorRetire it and move or archive its data

Design review questions

  • Which quality scenarios drive this design, with numbers?
  • Which decisions are one-way doors, and are they in an ADR?
  • Who owns each piece of data, and what is the source of truth?
  • What happens when each dependency is slow or down?
  • How do we deploy, roll back and migrate data without downtime?
  • What does it cost per order at today's load and at the festival peak?
  • How will we know it works in production (metrics, alerts, dashboards)?
  • What would make us revisit this decision?

See Design reviews.

Glossary

Plain definitions of the terms used most in the Architecture line.

Quality attribute
A measurable property of a system such as performance, availability or modifiability. Quality attributes
Quality attribute scenario
A testable statement of a quality goal: stimulus, environment, response and a measure. Quality attributes
Tactic
A design technique that improves one quality attribute, such as caching for performance. Quality attributes
Coupling
How much one part must change when another changes; lower is better. Architecture styles
Cohesion
How closely the things inside one module belong together; higher is better. Architecture styles
Bounded context
A part of the domain where each term has one clear meaning and one model, often owned by one team. Service boundaries
Modular monolith
One deployable application with strong internal module boundaries. Service boundaries
Microservices
Small services deployed separately, each owning its own data. Service boundaries
Event-driven architecture
Parts of a system communicate by publishing and reacting to events. Architecture styles
Hexagonal architecture
Business logic in the centre with ports, and adapters that connect it to databases, APIs and UIs. Architecture styles
Data ownership
The rule that exactly one module or service may write a given piece of data. Data ownership
Source of truth
The one place whose copy of a fact wins when copies disagree. Data ownership
Outbox pattern
Writing an event to a table in the same transaction as the data, then publishing it. Outbox and sagas
Saga
A long business process split into local steps, each with a compensating action. Outbox and sagas
ADR (architecture decision record)
A one-page note recording one decision, its context, options and consequences. ADRs and C4
C4 model
Four zoom levels for diagrams: context, container, component and code. ADRs and C4
Fitness function
An automated check that a system still meets an architecture goal, such as a test that blocks cross-module imports. ADRs and C4
One-way door
A decision that is expensive or impossible to reverse; it deserves slow review. Design reviews
FinOps
The practice of making engineering, finance and product share responsibility for cloud cost. FinOps
Total cost of ownership (TCO)
All costs of a system over its life: licences, cloud, people, support and exit. Build or buy
Strangler fig
Replacing a legacy system piece by piece behind a routing layer until the old one can be switched off. Legacy migration
Anti-corruption layer
A translation layer that keeps a legacy or vendor model from leaking into your own design. Legacy migration
Capability
Something the business must be able to do, independent of who does it or which system supports it. Capability maps
Value stream
The end-to-end stages that deliver one outcome to a customer. Value streams
TIME model
Tolerate, Invest, Migrate, Eliminate: four actions for an application portfolio based on value and health. App portfolio
Target architecture
The planned future state of systems and capabilities, with a roadmap to reach it. Target and roadmap
Architecture governance
The light rules and reviews that keep decisions consistent across teams. Governance

Courses on Kolom

  • Software Architecture in Practice by Len Bass, Paul Clements and Rick Kazman. The source of quality attribute scenarios and tactics.
  • Fundamentals of Software Architecture by Mark Richards and Neal Ford. A broad, practical tour of styles and trade-offs.
  • The C4 model by Simon Brown at c4model.com.
  • Martin Fowler's articles at martinfowler.com, including "StranglerFigApplication" and "MonolithFirst".
  • ADR examples and templates collected at adr.github.io.
  • Building Evolutionary Architectures by Neal Ford, Rebecca Parsons and Patrick Kua, on fitness functions.