A RESTful API for managing Dungeons & Dragons 5th Edition character data, classes, spells, and other game resources. This API serves as a backend for DRS (Digital RPG Sheet) applications.
The 5E-DRS API provides a centralized service for storing, retrieving, and managing D&D 5E game data. It supports pagination, rate limiting, and caching for optimal performance.
The application is built with a microservice architecture and consists of the following components:
- RESTful API: Spring Boot application exposing endpoints for D&D resources
- MongoDB: NoSQL database storing all game data
- RabbitMQ: Message broker for asynchronous processing
- Caching: Caffeine for local caching to improve response times
- Rate Limiting: Bucket4j for API request throttling
- Java 17
- Spring Boot 3
- Spring Data MongoDB
- Spring AMQP (RabbitMQ)
- Bucket4j (Rate Limiting)
- Caffeine Cache
- Swagger/OpenAPI for documentation
- Docker & Docker Compose for containerization
- Docker and Docker Compose
- Java 17
- Maven
- Start the required infrastructure services:
docker-compose up -dThis will start:
- MongoDB (accessible at localhost:27017)
- RabbitMQ (accessible at localhost:5672, management console at localhost:15672)
- Run the application with the local profile:
mvn clean package
java -jar -Dspring.profiles.active=local target/5e-drs-api-1.jarAlternatively, you can run the API in Docker by uncommenting the drs-api service in the docker-compose.yml file and running:
docker-compose up -dThe application supports multiple environments through Spring profiles:
local- For local developmentprod- For production deployment
Once the application is running, you can access:
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI definition: http://localhost:8080/api-docs
- Character class management
- Spell cataloging and searching
- Character data storage and retrieval
- Pagination support for large data sets
- Rate limiting to prevent API abuse
- Caching for improved performance
src/
├── main/
│ ├── java/com/ced/
│ │ ├── config/ # Application configuration
│ │ ├── controller/ # REST controllers
│ │ ├── dto/ # Data transfer objects
│ │ ├── exception/ # Custom exceptions
│ │ ├── filter/ # Request filters
│ │ ├── model/ # Domain models
│ │ ├── repository/ # Data access layer
│ │ ├── service/ # Business logic
│ │ └── util/ # Utility classes
│ └── resources/ # Configuration files
└── test/ # Unit tests
The project uses JUnit and Mockito for testing. Run tests with:
mvn testThe application is automatically built, tested, and deployed to Discloud using GitHub Actions when changes are pushed to the main branch.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.