Architecture, explained the way I use it.
My working notes as an architect. Every topic follows the same template: problem → diagram → how it works → when to use / avoid → trade-offs → where I've applied it → curated sources (videos, courses, docs, books).
Layered (N-Tier) Architecture
Split an application into horizontal layers — presentation, application, domain, data — where each layer only calls the one below it.
Hexagonal Architecture (Ports & Adapters)
Put the business core at the centre and talk to the outside world — HTTP, DB, queues, third-party APIs — only through ports (interfaces) implemented by swappable adapters.
Clean Architecture
Concentric rings — entities, use cases, interface adapters, frameworks — with one rule: source-code dependencies only point inward.
Modular Monolith
One deployable unit, internally split into strongly bounded modules with explicit public APIs — microservice-style boundaries without the distributed-systems tax.
Microservices Architecture
Structure a system as independently deployable services, each owning a business capability and its data, communicating over the network.
Event-Driven Architecture
Services announce facts ("EntryPublished") and others react asynchronously — decoupling producers from consumers in time, space and knowledge.
CQRS (Command Query Responsibility Segregation)
Use one model to change data (commands) and a different, optimised model to read it (queries) — often kept in sync by events.
Event Sourcing
Store every state change as an immutable event; current state is derived by replaying events. The log is the source of truth.
Saga Pattern
Keep data consistent across services without distributed transactions — a sequence of local transactions, each with a compensating action if a later step fails.
Transactional Outbox
Write the business change and the outgoing event in the same local transaction, then relay the event to the broker — no more "saved to DB but message lost".
Strangler Fig Migration
Replace a legacy system incrementally — route traffic slice by slice to the new system behind a facade until the old one can be switched off.
API Gateway & Backend-for-Frontend (BFF)
A single entry point that handles cross-cutting concerns (auth, rate limits, routing); BFFs go further with one tailored backend per client type.
Circuit Breaker, Retry, Timeout & Bulkhead
The resilience toolkit — fail fast, retry safely, bound waiting, and isolate resources so one slow dependency can't take down the whole system.
Sidecar & Service Mesh
Move networking concerns — mTLS, retries, traffic splitting, telemetry — out of application code into a proxy deployed next to every service.
Multi-Tenant SaaS Architecture
Serve many customers from shared infrastructure while guaranteeing isolation of data, performance and configuration per tenant.
SOLID Principles
Five object-oriented design principles that keep code open to change — single responsibility, open/closed, Liskov substitution, interface segregation, dependency inversion.
KISS, DRY, YAGNI & Rule of Three
The pragmatic trio — keep it simple, don't repeat knowledge, don't build what you don't need yet — and when each one actually applies.
Coupling, Cohesion & Separation of Concerns
High cohesion inside a module, loose coupling between modules — the single most important property of a maintainable architecture.
The Twelve-Factor App
Twelve rules for building cloud-native services that are portable, scalable and deployable anywhere — config in env, stateless processes, logs as streams.
Idempotency
Doing an operation twice has the same effect as doing it once. The foundation of safe retries, at-least-once messaging and reliable APIs.
API Evolution & Backward Compatibility
Change APIs without breaking clients — additive changes, tolerant readers, versioning strategy and explicit compatibility boundaries.
Architecture Decision Records (ADRs) & Trade-off Thinking
Capture each significant decision — context, options, decision, consequences — so the "why" survives people leaving. Plus how to reason about trade-offs.
How to Approach Any System Design
A repeatable framework — requirements, estimates, API, data model, high-level design, deep dives, trade-offs — plus the numbers every architect should know.
Design: URL Shortener
The classic warm-up — ID generation, read-heavy caching, redirects at scale and analytics without slowing the hot path.
Design: Distributed Rate Limiter
Protect APIs and tenants — algorithms (token bucket, sliding window), distributed counters in Redis, and where to enforce limits.
Design: Notification System
Send email, SMS, push and webhooks at scale — fan-out, user preferences, retries, dedupe and provider failover.
Design: Real-time Chat
WebSockets at scale — connection gateways, message fan-out, ordering, delivery receipts, presence and offline sync.
Design: Headless CMS with Branches & Releases
My speciality — a multi-tenant content platform with Git-like branches, scheduled releases, multi-locale publishing and per-item job status.
CAP & PACELC Theorems
During a network partition you choose consistency or availability; when there's no partition you still trade latency against consistency.
Consistency Models
From linearizable to eventual — what each guarantee means for users, and practical models like read-your-writes and monotonic reads.
Replication
Keep copies of data on multiple nodes for availability, durability and read scaling — single-leader, multi-leader and leaderless, sync vs async.
Sharding & Partitioning
Split data across nodes so storage and throughput scale horizontally — choosing shard keys, range vs hash, hot spots and rebalancing.
Caching Strategies
Cache-aside, read/write-through, write-behind; TTLs, invalidation, stampede protection and multi-layer caches (browser → CDN → app → DB).
Message Queues vs Event Streams
RabbitMQ/SQS-style queues distribute work; Kafka-style logs retain ordered events for many consumers and replay. Know which one your problem needs.
MongoDB at Enterprise Scale
Data modelling by access pattern, indexing (ESR rule), transactions, change streams and the operational gotchas of large multi-tenant collections.
CI/CD & GitOps
From commit to Kubernetes — build once, promote the same artefact, and let Git be the source of truth for what's running (ArgoCD).
Kubernetes Essentials for Architects
The objects that matter — Deployment, Service, Ingress, ConfigMap/Secret, HPA — and the settings that decide reliability (probes, requests/limits, PDBs).
Observability — Logs, Metrics, Traces
Know what your system is doing in production — the three pillars, OpenTelemetry, SLIs/SLOs, and alerting on symptoms not causes.
AWS Well-Architected Framework
Six pillars for reviewing any cloud architecture — operational excellence, security, reliability, performance efficiency, cost optimisation, sustainability.
RAG (Retrieval-Augmented Generation) Architecture
Ground LLM answers in your own data — ingestion, chunking, embeddings, vector search, reranking, prompting with citations, and evaluation.
AI Agents & Tool Use
LLMs that plan and act through tools in a loop — workflows vs agents, the agent loop, guardrails, and when not to build an agent.
Model Context Protocol (MCP)
An open protocol that standardises how AI apps connect to tools and data — build a server once, use it from any MCP-capable client.
LLM Evaluation (Evals)
Test AI features like software — golden datasets, code-based and LLM-as-judge graders, regression gates in CI, and production monitoring.
Visual cheatsheets
One-page visual notes I made while studying: architecture, trade-offs, examples and interview questions for each topic.