A choose-your-own-adventure REST API backend. Players navigate through stories, make choices, fight enemies, and track their progression — all driven by a fully authenticated API.
- Language: Kotlin
- Framework: Spring Boot 4.0.5 / Spring Cloud 2025.1.1
- Security: Spring Security 7 + JWT + RBAC (
ROLE_ADMIN/ROLE_USER) - Database: PostgreSQL
- API docs: SpringDoc / OpenAPI (Swagger UI)
- Resilience: Resilience4j (circuit breaker, retry)
- Chaos testing: Chaos Monkey for Spring Boot
- Build: Maven (Maven Wrapper included)
- Containerization: Docker / Docker Compose
urthehero/
├── back/ # Main REST API (Spring Boot)
├── config-server/ # Spring Cloud Config Server
└── docker-compose.yml # Local environment (PostgreSQL + back)
| Entity | Description |
|---|---|
| Story | An interactive story a player can choose |
| Page | A story page with choices (next pages) |
| NextPage | A transition between pages |
| Progression | Tracks a player's current position in a story |
| User | An authenticated player |
| Enemy | A monster/enemy a player can encounter |
| Dice | A dice roll mechanic |
- Java 21+
- Maven 3.8+ (or use
./mvnw) - Docker & Docker Compose
docker compose up -d postgres./mvnw -pl back spring-boot:runThe API is available at http://localhost:8080.
# Build the JAR first
./mvnw -pl back clean package -DskipTests
# Start all services
docker compose up -dOnce the application is running, the Swagger UI is available at:
http://localhost:8080/swagger-ui.html
All API endpoints require a JWT token. Authenticate first:
POST /authenticate
{
"username": "...",
"password": "..."
}Use the returned token as a Bearer header or via the Swagger UI lock icon.
Two roles are supported:
| Role | Permissions |
|---|---|
ROLE_ADMIN |
Full access — read and write (PUT/POST/DELETE) |
ROLE_USER |
Read-only access |
| Prefix | Description |
|---|---|
/authenticate/** |
Login / token generation |
/api/story/** |
Story management |
/api/page/** |
Page management |
/api/user/** |
User management |
/api/progression/** |
Player progression |
/api/enemy/** |
Enemy / monster CRUD |
/api/dice/** |
Dice roll |
./mvnw testIntegration tests use Testcontainers and require a running Docker daemon.
The pipeline (.gitlab-ci.yml) runs four stages:
| Stage | Description |
|---|---|
build |
Compile the project |
test |
Run tests + SonarCloud analysis |
quality |
CodeClimate analysis (merge requests and main branches) |
package |
Build and push Docker image (main branches only) |
See CHANGELOG.md for the full release history.