Hexagonal reference implementation
# The house reference for structuring a hexagonal service in Java — a Maven/Gradle modulith whose module graph is the architecture, one hexagon per bounded context under modules/, composed into runnable assemblies under application/ — with per-layer implementation guidelines.
❯ cat documents/
-
Hexagonal architecture reference implementation — Java
Concept
2026-08-09
The house layout for a hexagonal service in Java — a Maven/Gradle modulith whose module graph is the architecture, one hexagon per bounded context under modules/, composed into runnable assemblies under application/.
-
User-side adapters & assemblies
Concept
2026-08-09
Each module's user-side/ holds its driving adapters as libraries — api contract+adapters where the contract is real, consumers, and the in-process service — while application/<typology> assembles them into the runnable deployment units.
-
Domain layer — contract & implementation
Concept
2026-08-09
Each module's hexagon is two modules — domain/contract with the surface API (ports, commands, events) and domain/core with the implementation — over a platform/kernel that supplies the dispatch vocabulary and depends on nothing.
-
Infrastructure layer — secondary adapters & the granularity debate
Concept
2026-08-09
A module's infra/ implements its driven ports — persistence, messaging, clients and peer gateways — with granularity decided ad-hoc per context; ubiquitous ports live in platform/ rather than in any module.
-
Module composition — the in-process service seam
Concept
2026-08-14
How two modules of the modulith meet in Java — a consumer-owned driven port implemented by an infra gateway that delegates to the peer's user-side/service adapter, and the build rules that keep it the only edge.
-
Deployment & IaC — containers beside their unit, stacks in one folder
Concept
2026-08-09
Containerisation definitions live alongside the assembly they package; a deployment folder holds the infrastructure-as-code (OpenTofu or the like) defining the services, mirroring the application tree.