hexagonal-architecture

Featured

Use when the project follows hexagonal (ports & adapters) architecture. Prevents domain code from depending on Spring or JPA. Use when you see packages like domain/, application/, infrastructure/, or adapters/ in the project structure.

AI & Automation 225 stars 37 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
78
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Hexagonal Architecture ## Package Structure ``` src/main/java/com/example/ ├── domain/ ← Pure Java. Zero framework dependencies. │ ├── model/ ← Entities, value objects, aggregates │ ├── port/ │ │ ├── in/ ← Use case interfaces (driving ports) │ │ └── out/ ← Repository/external interfaces (driven ports) │ └── service/ ← Domain services (pure business logic) ├── application/ ← Orchestrates use cases. Spring allowed here. │ └── usecase/ ← @Service implementations of domain ports └── infrastructure/ ← All framework/DB/HTTP details ├── persistence/ ← JPA adapters implementing out ports ├── web/ ← REST controllers (driving adapters) └── external/ ← HTTP clients, messaging adapters ``` ## Domain Layer — Zero Spring ```java // domain/model/Order.java — pure Java, no annotations public class Order { private final OrderId id; private final CustomerId customerId; private OrderStatus status; private final List<OrderItem> items; private Order(OrderId id, CustomerId customerId) { this.id = id; this.customerId = customerId; this.status = OrderStatus.PENDING; this.items = new ArrayList<>(); } public static Order create(CustomerId customerId) { return new Order(OrderId.generate(), customerId); } public void addItem(P...

Details

Author
rrezartprebreza
Repository
rrezartprebreza/spring-boot-skills
Created
4 months ago
Last Updated
6 days ago
Language
Java
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category