Clean & Hexagonal Architecture
Structure an application so its domain logic depends on nothing external, with ports and adapters that make infrastructure replaceable and testable.
3 objectives 6 steps about 120 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Compare layered, hexagonal, onion and clean architecture by dependency direction, place MVC-family presentation patterns (MVC, MVP, MVVM) within them, and judge when the extra indirection is not worth its cost.
- Restructure a service into domain core, application ports and infrastructure adapters with all dependencies pointing inward.
- Test domain and application logic without a database or network by substituting adapters.
Lesson plan
6 steps, about 120 min · 5 of 5 lessons available so far
- Which way dependencies point: layers, the MVC family, ports and adapters Concept · 25 min
- Driving ports, driven ports and the composition root Concept · 20 min
- Moving a layered service to hexagonal Lab · 30 min
- Testing the core with in-memory adapters Lab · 20 min
- When a plain layered design is the better choice Concept · 10 min
- Dependency rule check Knowledge check · 6 questions
Practise it
Refactor a small layered web service into a hexagonal structure, add an in-memory adapter for its repository port, and show the domain and application tests running with no database or HTTP server.
References
Hard prerequisites
Unlocks
Nothing depends on this skill yet.
On these roadmaps
Progress and evidence for this skill are shared across all of them.