This project is a backend application built with Spring Boot, designed for managing players and their group nicknames (e.g., Avengers, Justice League). It features RESTful APIs, web views with Thymeleaf, and uses an H2 database for data persistence. The project is containerized with Docker and includes infrastructure-as-code (IaC) for cloud provisioning using Terraform.
- Player registration and management
- Unique nickname enforcement within groups
- RESTful API endpoints
- Web interface using Thymeleaf
- H2 file-based database
- Docker and Docker Compose support
- Infrastructure automation with Terraform
├── src/main/java/uol_host_backend/
│ ├── application/
│ │ ├── dtos/ # Data Transfer Objects (AvengersDTO, JusticeLeagueDTO, NicknameDTO)
│ │ ├── interfaces/ # Repository interfaces (NicknameRepository)
│ │ └── services/ # Business logic (NicknameService, PlayerService)
│ ├── domain/
│ │ ├── entities/ # Domain entities (Player)
│ │ ├── enums/ # Enum types (GroupNickname)
│ │ └── repositories/ # Repository implementations (AvengersRepository, etc.)
│ ├── exception/ # Custom exceptions (GroupNicknameUnavailableException)
│ └── infraestructure/
│ └── controllers/ # REST and web controllers (PlayerController, ListAllPlayers)
├── src/main/resources/
│ ├── application.properties # Spring Boot configuration
│ ├── schema.sql # Database schema
│ └── templates/ # Thymeleaf HTML templates
├── data/ # H2 database files (persisted with Docker volume)
├── iac/ # Infrastructure as Code (Terraform files)
├── Dockerfile # Docker build instructions
├── docker-compose.yml # Multi-container orchestration
├── pom.xml # Maven build configuration
├── HELP.md # Spring Boot help and references
└── README.md # Project documentation (this file)
- Java 21+
- Maven 3.9+
- Docker & Docker Compose (optional, for containerized deployment)
- Terraform (optional, for IaC)
- Build the project:
mvn clean package
- Run with Maven:
mvn spring-boot:run
- Or run with Docker Compose:
docker-compose up --build
- Web UI: http://localhost:8080
- H2 Console: http://localhost:8080/h2-console
- JDBC URL:
jdbc:h2:file:./data/players - User:
sa - Password: (leave blank)
- JDBC URL:
Terraform files are located in the iac/ directory. These files can be used to provision cloud resources (e.g., IAM, databases). Sensitive files and state are excluded via .gitignore.
Run tests with:
mvn testThis project is for demonstration and educational purposes.