This project implements a comprehensive Beverage Store system, initially designed as a JAX-RS REST API and subsequently refactored into a Microservices Architecture deployed via Docker and Kubernetes.
The system is designed to handle inventory management, order processing, and user interactions from both Customer and Employee perspectives.
The initial phase focused on building a fully RESTful API following best practices and comprehensive requirements.
| Category | Technology/Standard | Notes |
|---|---|---|
| Backend | Java / Jakarta EE | Core language and enterprise framework. |
| REST Framework | JAX-RS (Jakarta RESTful Web Services) | Used for building REST endpoints. |
| Build Tool | Gradle | Used for dependency management and build automation. |
| API Contract | OpenAPI Specification (OAS) | Defines the contract in openapi.yaml. |
| Documentation | Swagger UI | Integrated for interactive API documentation and testing. |
| Data Transfer | DTOs (Data Transfer Objects) | Custom-designed for specific resource needs. |
- Resource Modeling: Clear separation between Customer and Employee domain logic.
-
URI Design: Follows REST standards (URIs use only nouns, versioned via
/v1). - Data Handling: Implements Pagination for collection resources, proper DTO design, and HATEOAS-like links for single resources.
- Robustness: Features proper Parameter Validation, Customized Error Messages with appropriate HTTP status codes, and comprehensive Logging.
-
Order Workflow: Manages a transactional lifecycle (SUBMITTED
$\rightarrow$ PROCESSED), including stock reduction and restricted modification/cancellation based on status.
The original monolith was refactored into a layered microservice architecture and deployed using container technology for scalability and resilience.
| Microservice | Role & Responsibility | External Port |
|---|---|---|
| Beverage Service | Customer-Facing API. Provides read-only access to the beverage list. Calls the DB-Handler internally. | 8080 |
| Management Service | Employee-Facing API. Handles CRUD (Create, Read, Update, Delete) operations for inventory. Calls the DB-Handler internally. | 8090 |
| DB-Handler Service | Data Access Layer. Single-instance service for reading/writing data files. Accessible only within the Docker/K8s internal network (at db:9999/v1). |
N/A |
| Technology | Implementation Detail | Purpose |
|---|---|---|
| Containerization | Docker | Each Java service is packaged into a standalone Docker image. |
| Local Orchestration |
Docker Compose (docker-compose.yml) |
Defines services, network, and volumes for simplified local deployment and testing. Manages service dependencies. |
| Persistence | Docker Volumes / K8s Persistent Volumes | Used to ensure data persistence for the DB - File System, decoupling data from the container lifecycle. |
| Configuration | Environment Variables / ConfigMaps | Service connectivity (e.g., Management |
| Deployment | Kubernetes (K8s) | Uses built images from Docker phase, managing deployments, services, and configuration without rebuilding images. |
- Java JDK (Version 17+)
- Docker & Docker Compose
- Kubernetes Cluster Access (e.g., Minikube or Docker Desktop K8s)
# Build all services (using the provided Gradle wrapper)
./gradlew build# Start all services (handles network and volume setup)
docker-compose up --build# 1. Apply Kubernetes configuration (ConfigMaps, Deployments, Services)
kubectl apply -f k8s/configmap.yaml
kubectl apply -f k8s/deployment.yaml
# ... (continue with other necessary Kubernetes YAML files)Once deployed, the primary services are accessible at:
| Service | Local Docker URL (External) |
|---|---|
| Beverage Service | http://localhost:8080/v1/beverages |
| Management Service | http://localhost:8090/v1/management/beverages |
| Swagger UI | Access via the deployed Service URL (e.g., http://localhost:8080/swagger-ui). |
- Source Code
- OpenAPI Specification (
openapi.yaml) - Bruno Collection (
bruno.json/bruno/) for complete API testing. - Docker Compose (
docker-compose.yml) and Kubernetes configuration files.