Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
© 2026 CheatGrid™. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Hexagonal Architecture and Ports and Adapters Architecture Cheat Sheet

Hexagonal Architecture and Ports and Adapters Architecture Cheat Sheet

Back to Software Engineering
Updated 2026-05-16
Next Topic: Integration Testing Patterns and Strategies Cheat Sheet

Hexagonal Architecture, also known as Ports and Adapters, is an architectural pattern proposed by Alistair Cockburn in 2005 designed to create loosely coupled applications where the domain logic is completely isolated from external concerns like databases, frameworks, and user interfaces. The core principle is dependency inversion: all dependencies point inward toward the domain, ensuring that business logic remains pure, testable, and independent of technical implementation details. Unlike layered architectures where dependencies often flow downward through layers, hexagonal architecture uses ports (interfaces defined by the domain) and adapters (concrete implementations) to strictly enforce boundaries, making it trivial to swap databases, switch frameworks, or add new delivery mechanisms without touching business rules.

What This Cheat Sheet Covers

This topic spans 15 focused tables and 84 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Core Concepts and TerminologyTable 2: Architectural Layers and StructureTable 3: Port Types and PatternsTable 4: Adapter Implementation PatternsTable 5: Dependency Injection and WiringTable 6: Domain-Driven Design IntegrationTable 7: Testing StrategiesTable 8: Framework Independence and PortabilityTable 9: Migration and Refactoring PatternsTable 10: Architecture ComparisonsTable 11: Common Anti-Patterns and PitfallsTable 12: Implementation Technologies and ExamplesTable 13: Transaction and State ManagementTable 14: Cross-Cutting ConcernsTable 15: Advanced Patterns and Techniques

Table 1: Core Concepts and Terminology

ConceptExampleDescription
Hexagon (Domain Core)
Business logic implementing order validation, payment rules, inventory checks
• The innermost layer containing pure business logic with zero dependencies on external frameworks or infrastructure
• all dependencies point inward toward this core
Port
interface OrderRepository { save(order: Order): void }
• Interface defined by the domain that specifies what the core needs from external systems
• technology-agnostic contract that adapters must implement
Adapter
class PostgresOrderRepository implements OrderRepository
• Concrete implementation of a port that bridges the domain to external technologies (databases, APIs, UIs)
• contains all framework-specific code.
Inbound Port (Driving Port)
interface CreateOrderUseCase { execute(data): Result }
• Interface exposed by the domain defining operations that external actors can trigger
• represents what the application does. Commands or queries from the outside
Outbound Port (Driven Port)
interface PaymentGateway { charge(amount): boolean }
• Interface required by the domain defining operations it needs from external systems
• represents what the application needs. Persistence, messaging, external APIs

More in Software Engineering

  • Git Branching Strategies and Workflows Cheat Sheet
  • Integration Testing Patterns and Strategies Cheat Sheet
  • _Dependency_Injection_Patterns
  • Design Patterns Cheat Sheet
  • Monorepo Strategy and Tooling Cheat Sheet
  • Software Resilience Patterns Cheat Sheet
View all 36 topics in Software Engineering