A REST API developed using Java Spring that enables users to interact with League of Legends (LoL) champions through a chat completion service.
This API connects to the Llama3-8b-8192 model provided by Groq Cloud. To acquire an API key, follow these instructions and add the key to the CHAT_SERVICE_KEY
environment variable in the docker-compose.yaml
file. Also, set the CHAT_SERVICE_URL
accordingly.
Run the following command to start the containers:
docker-compose up -d
By default, the application will be available at http://localhost:8080
.
The project structure includes five main directories:
application
: Contains use cases and interfaces for accessing resources such as databases and HTTP clients.domain
: Defines system entities and business-rule exceptions.infrastructure
: Implements the application layer's gateways, providing access to databases, repositories, HTTP client interfaces, controllers, DTOs, framework-specific exceptions, and other Spring resources.configuration
: Holds configuration files with dependency injection beans.shared
: Contains utility classes accessible across multiple layers.
- Java 21
- Docker Desktop (required for integration tests)
Run the following commands in the terminal from the application's root directory:
- Only unit tests:
./mvnw test
- For integration and unit tests:
./mvnw verify
Note: Ensure Docker is running, as the application uses TestContainers to create a PostgreSQL database in Docker for each integration test class.
GET /champions - Retrieve a list of champions.
POST /champions/ask/{id} - Ask a question to a specific champion by ID and retrieve the champion's response.
-
To view the full API documentation, including endpoints and data schemas, open the Swagger UI at:
/swagger-ui/index.html
-
For API documentation in JSON format suitable for tools like Postman, Insomnia, and other API clients, visit:
/v3/api-docs
.