This repository is a Kotlin + Spring Boot backend template built using Hexagonal Architecture (Ports & Adapters).
It is designed to be used as a GitHub Template, so you can quickly bootstrap new backend services with a clean, scalable structure.
Click "Use this template" on GitHub and create your new project.
After cloning your new repository:
chmod +x scripts/setup.sh
./scripts/setup.shThe script will ask for:
- Project name (e.g.
order-service) - Base package (e.g.
com.yourcompany.orderservice)
β Renames:
- Project (
hamletβ your project name)
β Updates:
pom.xml(artifactId, name)README.md- Kotlin package declarations
β Refactors:
- Package structure
(
com.lucienvirecourt.hamletβ your package)
β Cleans:
- Removes template setup script after execution
./mvnw clean install -DskipTests -U
docker-compose -f bootstrap/src/main/resources/docker/docker-compose.dev.yml up
./mvnw spring-boot:run -pl bootstrapThis project follows Hexagonal Architecture:
ββββββββββββββββββββββββββββ
β Adapter β
β (GraphQL / REST / JPA) β
ββββββββββββ¬ββββββββββββββββ
β
ββββββββββββΌββββββββββββββββ
β Application β
β (Use Cases / Ports) β
ββββββββββββ¬ββββββββββββββββ
β
ββββββββββββΌββββββββββββββββ
β Domain β
β (Pure Business Logic) β
ββββββββββββββββββββββββββββ
- Core business models
- Framework-independent
-
Business logic
-
Ports:
port.in(use cases)port.out(interfaces)
-
Inbound:
- GraphQL
- REST
-
Outbound:
- JPA (database)
- Spring Boot startup
- Configuration
- Flyway migrations
- Docker setup
Create User:
- Request β GraphQL/REST (
adapter) - β
CreateUserUseCase - β
CreateUserService - β
UserRepository - β JPA Adapter
- β Response
Uses Flyway.
Location:
bootstrap/src/main/resources/db.migrationdocker-compose -f bootstrap/src/main/resources/docker/docker-compose.dev.yml up./mvnw spring-boot:run -pl bootstrapProfiles:
devstagingprod
Files:
application.yml
application-dev.yml
application-staging.yml
application-prod.yml./mvnw test- β Clean Architecture (Hexagonal)
- β Scalable for microservices
- β Framework-independent domain
- β Easy to test
- β Ready-to-use Flyway + Docker setup
-
Default package:
com.lucienvirecourt.hamlet -
This will be replaced by the setup script
- macOS & Linux are supported
- If script fails, check
sedcompatibility - Always review changes before committing
- GitHub Actions CI
- Authentication module
- Observability (metrics + logging)
- Event-driven support
Template built for scalable backend systems using Kotlin & Spring Boot.