A minimal Java Spring Boot project that implements the Hexagonal Architecture pattern (a.k.a. Clean Architecture or Ports & Adapters).
It showcases a basic CRUD for Product with layers clearly separated into Domain, Application, and Infrastructure.
- domain: Business model (
Product) and core rules - application:
port/in: Use case interfaces (e.g. CreateProductUseCase)port/out: Interfaces for persistence and external accessservice: Implements the use cases
- infrastructure:
web: REST controller, DTOs, mapperspersistence: JPA entities, repositories, adaptersconfig: Spring beans and wiring
| Method | Endpoint | Description | Body Required |
|---|---|---|---|
| POST | /products | Create a new product | Yes |
| GET | /products | List all products | No |
| GET | /products/{id} | Get product by ID | No |
| PUT | /products/{id} | Update product by ID | Yes |
| DELETE | /products/{id} | Delete product by ID | No |
To explore and test the API, Swagger UI is available at: