Architecture
Software architecture patterns and system design notes: how to structure code within a service, and how services communicate with each other.
Articles
- DDD & the Service Layer — structuring FastAPI projects by domain, and keeping business logic in a service layer instead of the router.
- Event-Driven Architecture: Kafka vs. SQS vs. RabbitMQ — event-driven basics and how the three major messaging systems compare.
- Kafka Consumers Behind a FastAPI API on Kubernetes — consumer groups, background tasks vs. blocking startup, pod-local state, and when to split the consumer into its own deployment.
- Dependency Inversion via Interfaces and Abstract Classes
— the SOLID principle behind DI, and
abc.ABCas the nominal-typing way to express the abstraction it requires. - Understanding Consistency in Distributed Systems — strong vs. eventual consistency, why replication introduces staleness, and a checklist for choosing the right guarantee per piece of data.
- Senior Software Engineer Architecture Interview Cheat Sheet — a problem-to-pattern table for recurring architecture and distributed-systems interview questions, plus a response template.
Patterns
Code-level design patterns — how you structure and construct objects within a service — live in their own Patterns subsection, separate from the broader architectural styles above. Dependency Injection and the Factory Pattern below are both concrete, code-level ways of achieving the Dependency Inversion principle described above them:
- Dependency Injection with Protocols
— structural typing with
typing.Protocolinstead of ABC inheritance, and why that avoids hierarchy hell. - Factory Pattern in Python — from a plain
function to registries to
@classmethodalternative constructors.
Contributing
Learned a new architecture pattern or design principle worth keeping? Add it here as its own file. See Contributing for the how-to.