com.example.orders ├── domain/ <-- Pure Java (No frameworks) │ ├── model/ │ │ └── Order.java │ └── exception/ │ └── OrderNotFoundException.java ├── ports/ <-- Interfaces │ ├── inbound/ │ │ └── CreateOrderUseCase.java │ └── outbound/ │ └── OrderRepositoryPort.java └── infrastructure/ <-- Frameworks & Technologies ├── adapters/ │ ├── inbound/ │ │ └── OrderRestController.java │ └── outbound/ │ └── PostgresOrderRepositoryAdapter.java └── config/ └── BeanConfiguration.java Use code with caution. 2. The Domain Layer
The ports define how the application interacts with the outside world. In Java, this can be represented by an interface: