How arhohuttunen/hexagonal-architecture-spring-boot works
This is a Spring Boot coffee-shop ordering application organized around hexagonal ports and adapters. A customer submits or changes an order through REST; the application use case validates domain transitions and uses order/payment ports. Payment, receipt lookup, and order taking are distinct operations, while coffee preparation is represented by separate application ports and order states. The sampled code confirms the REST-to-use-case and use-case-to-port calls; infrastructure persistence wiring and preparation dispatch are present in the tree but were not shown, so those links are marked unverified.
Main entry points: CoffeeShop.java Coffee Shop Use Case · PaymentController.java Payment Controller · OrderController.java Order Controller · OrderingCoffee.java Ordering Port
Components 24
REST API
- Order Controller
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/OrderController.java - Payment Controller
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/PaymentController.java - Receipt Controller
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/ReceiptController.java - Order Resources
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/resource - Payment Resources
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/resource - Receipt Response
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/resource/ReceiptResponse.java
Application Use Cases
- Ordering Port
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/in/OrderingCoffee.java - Coffee Shop Use Case
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeShop.java - Preparation Port
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/in/PreparingCoffee.java - Orders Port
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/out/Orders.java - Payments Port
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/out/Payments.java
Order And Payment Domain
- Order Lifecycle
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/order/Order.java - Line Items
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/order/LineItem.java - Payment And Receipt
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/payment/Payment.java - Credit Card
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/payment/CreditCard.java - Receipt
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/payment/Receipt.java
Persistence Adapters
- Orders Persistence Adapter
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/out/persistence/OrdersJpaAdapter.java - Payments Persistence Adapter
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/out/persistence/PaymentsJpaAdapter.java - Order Repository
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/out/persistence/OrderJpaRepository.java - Payment Repository
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/out/persistence/PaymentJpaRepository.java - Order Entity
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/out/persistence/entity/OrderEntity.java - Payment Entity
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/out/persistence/entity/PaymentEntity.java
Coffee Preparation
- Coffee Machine
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeMachine.java
Other components
- Customer
Connections 22
- Customer → Order Controller: submits order
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/OrderController.java - Customer → Payment Controller: pays order
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/PaymentController.java - Order Controller → Ordering Port: invokes
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/OrderController.java - Order Controller → Order Resources: maps requests
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/OrderController.java - Payment Controller → Ordering Port: invokes payment
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/PaymentController.java - Payment Controller → Payment Resources: maps requests
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/PaymentController.java - Receipt Controller → Ordering Port: requests receipt
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/ReceiptController.java - Receipt Controller → Receipt Response: returns response
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/ReceiptController.java - Coffee Shop Use Case → Orders Port: reads and saves
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeShop.java - Coffee Shop Use Case → Payments Port: reads and saves
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeShop.java - Coffee Shop Use Case → Order Lifecycle: creates and updates
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeShop.java - Coffee Shop Use Case → Payment And Receipt: creates payment
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeShop.java - Coffee Shop Use Case → Receipt: builds receipt
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeShop.java - Order Lifecycle → Line Items: prices items
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/order/Order.java - Payment Controller → Credit Card: constructs
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/in/rest/PaymentController.java - Coffee Shop Use Case → Preparation Port: dispatches preparation
- Preparation Port → Coffee Machine: uses machine
coffeeshop-application/src/main/java/com/arhohuttunen/coffeeshop/application/CoffeeMachine.java - Orders Port → Orders Persistence Adapter: implemented by
- Payments Port → Payments Persistence Adapter: implemented by
- Orders Persistence Adapter → Order Repository: persists through
- Payments Persistence Adapter → Payment Repository: persists through
- Payment Repository → Payment Entity: stores
coffeeshop-infrastructure/src/main/java/com/arhohuttunen/coffeeshop/adapter/out/persistence/PaymentJpaRepository.java