Hexagonal architecture (ports and adapters)
Business logic in the middle defines interfaces (ports); databases, APIs and user interfaces plug in from outside as adapters.
The core says “I need to save an order” and “I need to charge a card”; adapters implement that with Postgres or a payment provider. Dependencies point inward, so the rules can be tested without a database and an adapter can be swapped. Clean architecture and onion architecture are close variants. The cost is more interfaces and mapping code, which simple CRUD apps do not repay.
Related terms
- DDD (domain-driven design): Designing software around the business’s own language and rules, with the code split where that language changes meaning.
- Modular monolith: One deployable application split inside into modules with clear boundaries, each owning its data and using the others only through defined interfaces.
- Anti-corruption layer (ACL): A translation layer between your model and a legacy or external system, so its data shapes and quirks do not leak into your code.
