Hermes is a RESTful backend developed in Java with Spring Boot for managing Minecraft player data (users, economy, statistics) and authenticating multiple Minecraft servers using JWT. It includes Redis caching, persistence with MySQL, and is fully dockerized for development and production.
Hermes is a backend system that:
- Manages Minecraft player data.
- Authenticates Minecraft servers with credentials and JWT.
- Supports multiple server instances with synchronized data via Redis.
- Provides secure token handling (access and refresh tokens).
- Ready to run with Docker + Docker Compose.
This project is designed as a robust Minecraft backend foundation (economy, achievements, statistics, etc.).
| Component | Technology |
|---|---|
| Backend | Java 17 + Spring Boot |
| Persistence | MySQL |
| Cache | Redis |
| Authentication | JWT |
| Build | Gradle (with Gradle Wrapper) |
| Containers | Docker + Docker Compose |
hermes/
├─ src/
│ ├─ main/java/... # Main code
│ ├─ main/resources # Configs and startup SQL
│ └─ test/ # Tests (if any)
├─ gradlew
├─ build.gradle.kts # Gradle build
├─ settings.gradle.kts
├─ Dockerfile
├─ docker-compose.yml
├─ .env-template # Example environment variables
└─ README.md # ← This file
- Docker & Docker Compose (V2 integrated)
- (Optional local) Java 17 + Gradle
- Copy the environment template:
cp .env-template .env-
Edit
.envwith your secrets (JWT, MySQL, Redis, etc.) -
Start all services:
docker compose --env-file .env up --buildThis will launch:
✔️ MySQL ✔️ Redis ✔️ Hermes backend
- To run in detached mode:
docker compose --env-file .env up -d --build- Check running containers:
docker compose ps- View logs in real-time:
docker compose logs -f hermes- Stop all containers:
docker compose down| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/login |
Server login with credentials |
| POST | /api/v1/auth/refresh |
Refresh token to renew access token |
Returns accessToken and refreshToken.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/users |
List users (paginated) |
| GET | /api/v1/users/{id} |
Get user by ID |
| POST | /api/v1/users |
Create a new user |
| DELETE | /api/v1/users/{id} |
Delete user |
- Access Token: expires in 1 day
- Refresh Token: expires in 7 days
- The client must handle automatic refresh if the access token expires.
This allows Minecraft servers to maintain sessions without resending sensitive credentials continuously.
| Entity | Key Fields |
|---|---|
Server |
id, password |
User |
id, name |
UserEconomy |
coins, gems |
UserStatistic |
kills, deaths, wins, losses |
Place a data.sql file in src/main/resources with initial inserts for:
- Initial servers
- Test users
- Economy and statistics
Spring Boot will execute it automatically on startup (configurable with spring.jpa.hibernate.ddl-auto).
# MySQL
MYSQL_ROOT_PASSWORD=rootpassword
MYSQL_DATABASE=hermes
MYSQL_USER=hermesuser
MYSQL_PASSWORD=hermespass
# Redis
REDIS_PASSWORD=redispass
# Application
SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/hermes
SPRING_DATASOURCE_USERNAME=hermesuser
SPRING_DATASOURCE_PASSWORD=hermespass
SPRING_REDIS_HOST=redis
SPRING_REDIS_PASSWORD=redispass
JWT_SECRET=yourSuperSecretJWT- Use environment variables for secrets; do not hardcode sensitive values.
- Set
spring.jpa.hibernate.ddl-auto=updateto let Spring create tables automatically. - Docker Compose volumes ensure MySQL data persists across container restarts.
For guidance on README structure and best practices: GitHub Docs
This project is licensed under the MIT License. See the LICENSE file for details.
- Fork the repo
- Create a new feature branch
- Submit a pull request with clear description