HexaDEVenture is a project that showcases Hexagonal Architecture (Ports & Adapters) in a realistic and moderately complex environment. It consists of two services developed in Java Spring Boot: a turn-based strategy game and a statistics microservice communicating via HTTP.
The system uses multiple output ports/adapters, including multi-database persistence (PostgreSQL and MongoDB), the JNoise library, an A* pathfinding adapter, and a HTTP communication adapter. It also features a Unity-based frontend fully integrated with the game service, an easy deployment using Docker, and includes extensive automated tests with approximately 90% code coverage.
- Complex Hexagonal Architecture (Ports & Adapters).
- Two independent services: Game (Main Service) and Statistics microservice.
- Strict layer separation: Adapter, Application, Domain, Bootstrap.
- Multi-database support: PostgreSQL and MongoDB in each service.
- Multiple output adapters.
- Basic Security with Spring Security.
- Automated testing with high coverage.
- Containerized deployment with Docker.
- Swagger documentation for both services.
- Fully integrated Unity frontend prototype.
The project is structured following the Hexagonal Architecture (Ports & Adapters) pattern, which is divided into four layers: Adapter, Application, Domain, and Bootstrap. The repository contains two main services:
- Adapter Layer: Contains REST controllers and other output services implementations.
- Application Layer: Manages the business logic and use cases.
- Domain Layer: Contains the domain models.
- Bootstrap Layer: Responsible for initializing the application.
- Adapter Layer: Includes REST controllers and HTTP client adapters for communication with the Main Service.
- Application Layer: Manages the business logic and use cases.
- Domain Layer: Contains the domain models.
- Bootstrap Layer: Responsible for initializing the application.
Both services are designed to be independently deployable, ensuring a clear separation of concerns and maintainability. However, since the statistics service depends on the main game service to function, it automatically launches the main service as a separate Docker Container to enable communication and preserve functionality.
- Java 22+
- Maven 3.9+
- Docker & Docker Compose (Docker Desktop)
- Unity (Optional, for frontend)
- IntelliJ IDEA (Recommended IDE)
-
Clone the repository:
git clone https://github.com/Zarpyk/HexaDEVenture.git cd HexaDEVenture -
Build all modules with Maven:
mvn clean package -DskipTests
- Database connection settings can be change on the
docker-compose.yaml.- For PostgreSQL: On the main service use
SPRING_PROFILES_ACTIVE=jpaenvironment variable and use PostgreSQL container. - For MongoDB: On the main service use
SPRING_PROFILES_ACTIVE=mongoenvironment variable and use MongoDB container.
- For PostgreSQL: On the main service use
Run on the root folder
docker-compose upExecute all automated tests:
mvn testThis project is licensed under the Commons Clause on top of the Apache License 2.0.
See LICENSE for details.
- Based on references from Sven Woltmann’s project.
- Game Assets from Kenney and Kay Lousberg
- Unity Assets: FastScriptReload, Hierarcy 2 and UnityEditor-DarkMode