Software Architecture Decision Sheet

Pick the architecture at project start based on criteria, not trends. One page, three layers, one flowchart.

1. Three layers2. Styles compared3. Criteria 4. Flowchart5. Inside a service6. Principles7. AI apps8. Record it

1. First: these are three different decisions

Common confusion: SOLID is not an alternative to microservices. They live at different levels. You choose one deployment style, one internal structure, and you apply principles everywhere.
LevelQuestion it answersOptionsDecided whenCost to change later
A. Architectural style
(system level)
How many deployable units? How do they talk?Monolith · Modular monolith · Microservices · Serverless · Event-drivenProject startHigh
B. Internal structure
(codebase level)
How is code inside one unit organized?Layered (N-tier) · Hexagonal (ports & adapters) · Clean / Onion · CQRS · Vertical slicesProject start, per serviceMedium
C. Design principles
(class / module level)
How do I write each piece so it stays changeable?SOLID · DRY · KISS · YAGNI · Separation of concerns · High cohesion / low couplingAlways, every PRLow (refactor)

2. Architectural styles compared

CriterionMonolithModular monolithMicroservicesServerless (FaaS)Event-driven
What it isOne codebase, one deployOne deploy, strict internal module boundariesMany small services, each deployed and owning its dataFunctions triggered by events, managed infraComponents react to events via a broker (Kafka, Service Bus)
Time to first releaseFastestFastSlowFastMedium
Team size fit1–8 devs3–30 devsSeveral teams (20+)Any, small appsMedium–large
Independent deployNoNoYesYes, per functionYes
Independent scalingWhole appWhole appPer serviceAutomaticPer consumer
Ops / DevOps maturity neededLowLowHigh (K8s, tracing, CI/CD per service)MediumHigh
Data consistencyEasy (one DB, ACID)EasyHard (sagas, eventual)MediumEventual
DebuggingEasyEasyHard (distributed)MediumHard
LatencyIn-process callsIn-processNetwork hopsCold startsAsync by nature
Infra cost at small scaleLowLowHighVery lowMedium
Main riskBecomes a "big ball of mud"Boundaries erode without discipline"Distributed monolith"Vendor lock-in, timeoutsHard to trace flows
Best whenMVP, PoC, unclear domainDefault for most new productsClear domains, many teams, different scaling needsSpiky / low traffic, glue jobsAsync workflows, integrations, audit trails

Styles combine: e.g. a modular monolith + a few serverless functions + an event bus is very common.

3. Decision criteria — answer these first

#CriterionAsk yourselfPoints toward simpler (monolith)Points toward distributed
1Domain clarityDo we know the business boundaries well?New / changing domainStable, well-understood domains
2Team structureHow many teams will work on it in parallel? (Conway's Law)One teamSeveral autonomous teams
3Scaling profileDo parts need very different scale / hardware (e.g. GPU)?Uniform loadOne part 100× the others
4Release cadenceMust parts ship independently?Release together is fineDifferent release cycles
5Ops maturityDo we have CI/CD, containers, monitoring, tracing, on-call?LimitedStrong platform team
6ConsistencyDo transactions span many entities?Strong ACID neededEventual consistency acceptable
7Time-to-marketHow fast must v1 ship?WeeksMonths, long-lived platform
8BudgetInfra + people cost limits?TightComfortable
9Tech diversityNeed different languages / runtimes?One stackPython ML + Java core + Node UI, etc.
10Compliance / isolationMust some data or failures be isolated?NoPII / payment / tenant isolation
Rule of thumb: if 7+ answers are in the left column → monolith / modular monolith. Only go distributed when you can name the specific criteria (3, 4, 9, 10) that force it. "It's modern" is not a criterion.

4. Decision flowchart

flowchart TD S([Start: new project]) --> Q1{Is it a PoC / MVP
or is the domain unclear?} Q1 -- Yes --> M1[Monolith
+ layered or hexagonal inside] Q1 -- No --> Q2{More than one team
working in parallel?} Q2 -- No --> Q3{Do parts need very different
scaling or hardware? e.g. GPU} Q3 -- No --> MM[Modular monolith
clear module boundaries] Q3 -- Yes --> HY[Modular monolith
+ extract only the hot part
as a separate service] Q2 -- Yes --> Q4{Strong DevOps?
CI/CD, containers, tracing, on-call} Q4 -- No --> MM2[Modular monolith first
build platform maturity] Q4 -- Yes --> Q5{Can each domain own its data
and accept eventual consistency?} Q5 -- No --> MM3[Modular monolith
shared DB, separate schemas] Q5 -- Yes --> MS[Microservices
one service per bounded context] M1 --> Q6{Mostly event-triggered,
spiky or low traffic tasks?} MM --> Q6 HY --> Q6 MS --> Q6 Q6 -- Yes --> SV[Add serverless functions
for those tasks] Q6 -- No --> Q7{Async workflows, integrations,
long-running jobs?} SV --> Q7 Q7 -- Yes --> EV[Add event bus / queue
event-driven between parts] Q7 -- No --> D([Pick internal structure: section 5
Apply principles: section 6
Write an ADR: section 8]) EV --> D MM2 --> D MM3 --> D

5. Inside each deployable unit — internal structure

PatternIdeaUse whenAvoid when
Layered (N-tier)API → Service → Repository → DBCRUD apps, small teams, simple logicComplex business rules (logic leaks across layers)
Hexagonal (Ports & Adapters)Core logic in the middle; DB, LLM, APIs plug in via interfacesMany external integrations, need to swap providers (OpenAI ↔ Azure), testabilityTiny scripts / throwaway PoCs
Clean / OnionDependencies point inward to the domainLong-lived, rich domain logicShort projects — more boilerplate
CQRSSeparate read model and write modelReads ≫ writes, different query shapesSimple CRUD — doubles complexity
Vertical slicesOrganize by feature, not by layerFeature teams, fast iterationHeavy shared domain rules

6. Design principles — apply in any architecture

PrincipleMeaning (plain)Smell when violated
SSingle ResponsibilityA module has one reason to change (one actor/owner)One class handles parsing, DB, and email
OOpen / ClosedAdd behavior by extending, not editing existing codeEvery new provider = edit a big if/elif
LLiskov SubstitutionA subtype must work anywhere the parent worksSubclass throws "not supported" for a parent method
IInterface SegregationSmall, specific interfaces over one fat oneClasses implement methods they don't use
DDependency InversionDepend on abstractions; inject concrete onesBusiness logic does OpenAI() directly
Separation of concernsKeep UI, logic, data, infra apartSQL inside API handlers
High cohesion / low couplingRelated things together; few links between modulesChange in one module breaks five others
DRYOne source of truth for each piece of knowledgeSame rule copied in 4 places
KISS / YAGNISimplest thing that works; don't build for imagined needsKafka + K8s for 50 users
12-FactorConfig in env, stateless processes, logs as streamsSecrets in code, local file state

7. Applied to AI / LLM projects (RAG, agents)

Start here

  • Modular monolith (FastAPI)
  • Hexagonal inside: ports for LLM, vector store, tools
  • Background worker + queue for ingestion

Split out when…

  • Ingestion / embedding load differs from query load
  • Self-hosted model needs GPU scaling
  • Eval pipeline runs on its own schedule

Don't

  • One microservice per agent "because agents"
  • Call the LLM SDK directly from route handlers
  • Share one DB across "independent" services

8. Record the decision (ADR — 5 lines)

Title · Context (criteria answers from section 3) · Decision (style + internal structure) · Consequences (what gets easier / harder) · Revisit trigger (e.g. "2nd team joins" or "ingestion > 10× query load")
Bottom line: start with a modular monolith with clean module boundaries and SOLID inside. It keeps you fast now, and good boundaries let you extract microservices later — when a real criterion forces it, not before.