A Java backend project using Hexagonal Architecture, integrated with MongoDB, and containerized using Docker. Follows clean architecture principles with clear separation of concerns between domain logic, application logic, and infrastructure.
src/main/java/com/letsplay/
├── LetsPlayApplication.java
├── domain/ # Core business logic
│ ├── model/
│ ├── port/
│ │ ├── in/ # Input ports (use cases)
│ │ └── out/ # Output ports (interfaces)
│ └── service/ # Domain services
├── infrastructure/ # External concerns
│ ├── config/
│ ├── persistence/ # Database adapters
│ └── security/
└── application/ # Application layer
├── controller/ # REST controllers
├── dto/ # Request & Response DTOs
└── exception/ # Global exception handling
Other files:
├── .env-example # Example environment variables
├── compose.yaml # Docker Compose config
├── pom.xml # Maven config
└── setup.sh # Setup environment script
| Method | Endpoint | Auth | Roles | Description |
|---|---|---|---|---|
| POST | /auth/register |
❌ | - | Register a new user |
| POST | /auth/login |
❌ | - | User login |
| GET | /users |
✅ | Admin | List all users |
| GET | /users/{id} |
✅ | Admin/User | Get user by ID |
| GET | /users/me |
✅ | Any | Get current user profile |
| POST | /users |
✅ | Admin | Create user |
| PATCH | /users/{id} |
✅ | Admin/User | Update user details |
| DELETE | /users/{id} |
✅ | Admin/User | Delete user |
| GET | /products |
❌ | - | List all products |
| GET | /products/{id} |
❌ | - | Get product by ID |
| POST | /products |
✅ | Admin | Create a product |
| PATCH | /products/{id} |
✅ | Admin | Update product |
| DELETE | /products/{id} |
✅ | Admin | Delete product |
classDiagram
User "1" -- "n" Product : Owns
User : +String id
User : +String name
User : +String email
User : +String password
User : +String role
Product : +String id
Product : +String name
Product : +String description
Product : +Double price
Product : +String userId
git clone https://github.com/hmaach/lets-play.git
cd lets-playcp .env-example .envUpdate .env with your MongoDB credentials:
# Database config
MONGO_INITDB_ROOT_USERNAME=username
MONGO_INITDB_ROOT_PASSWORD=password
MONGO_INITDB_DATABASE=lets-play-db
# JWT config
JWT_SECRET=secret-key
# SSL config
CERT_PASSWORD=password
CERT_ALIAS=letsplay
CERT_DNAME=CN=localhost,OU=Dev,O=LetsPlay,L=Oujda,ST=Oriental,C=MA
source ./setup.shThis will:
- Install Docker rootless if missing
- Create Docker volume for persistent data
mongosh "mongodb://localhost:27017"docker compose down- Java 17+
- Maven
- MongoDB (Dockerized)
- Docker (Rootless compatible)
- Docker Compose v2
mongosh(optional, for testing)- Angular (for frontend integration)