tags: #publish
links: [[Software Architecture]]
created: 2021-02-10 Wed
---
# Hexagonal or Ports and Adapters Architecture
**Put inputs and outputs at the edges of the application.**
Loosely-coupled components connected only through an application core, represented as ports and adapters.
Intention:
- make components exchangeable
- avoid dependencies between layers
- separate UI and business logic
- make components easier to test
System is architected around an **Application Core** (the hexagon).
Around its sides are adapters (the straight sides encourage you to think of them by domain), e.g. usually broken up into domains:
- **Persistence** - adapters to the DB, filesystem, ...
- **Notification** outbound - email, SMS
- **Admin** - adapters for admin APIs, audit, logging
- **Event sources** inbound - UI, event inputs
The point is to think about the input/outputs from the appplication and don't have those external things interacting, only have them connected via the application core.