Layered and Hexagonal Architecture
Layered architecture commonly separates controllers, services, and repositories. Hexagonal architecture separates application/domain logic from external adapters through ports.
HTTP / Messaging / CLI
|
Adapters
|
Ports
|
Application / Domain
|
Ports
|
DB / APIs / Files
The key idea is dependency direction: business rules should not be tightly coupled to HTTP frameworks, database drivers, or cloud SDKs.
Key Takeaways
Architecture is primarily about dependency direction.
Ports isolate business logic from infrastructure.
Adapters are translation boundaries, not business-rule containers.