This is a Reactive Spring Boot web service for managing client data and resolving bank names by credit card numbers. The service uses MongoDB for data persistence and supports high-throughput asynchronous operations.
- CRUD operations for clients
- Lookup of banks for specific credit card IDs
- Reactive stack (WebFlux + Reactive MongoDB)
- Docker & Docker Compose ready
- Collection filtering happens on MongoDb Side by generic repository customization.
- Primary data validation presents using Jakarta Validation.
- Errors handling:
- 404 (Not Found) Error thrown if a client not found
- 400 (Bad Request) Error thrown if a client already exists (by name) or the request is not valid.
- Used MapStruct for DTO <-> Models mapping.
- Used Smart tests approach - if no Mongo present, the tests depends on it will be skipped to allow normal build anytime
Base URL: http://localhost:8080/clients
curl -X POST http://localhost:8080/clients \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"creditCardIds": ["1111222233334444", "5555666677778888"]
}'curl -X PUT http://localhost:8080/clients/<id> \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Name",
"creditCardIds": ["cc1", "cc3"]
}'curl http://localhost:8080/clientscurl http://localhost:8080/clients/<id>curl -X DELETE http://localhost:8080/clients/<id>curl -X POST http://localhost:8080/clients/bank-names \
-H "Content-Type: application/json" \
-d '{
"personIds": ["<clientId1>", "<clientId2>"],
"creditCardIds": ["1111222233334444", "cc1"]
}'- Java 17
- Gradle
- Docker & Docker Compose
./gradlew clean builddocker-compose up --build
docker-compose up -d
docker-compose down
The app will be available at:
📍 http://localhost:8080/clients
{
"_id": "abc123",
"name": "Alice",
"creditCardIds": ["cc1", "cc2", "cc3"]
}The app uses the following environment variables (loaded via .env):
MONGO_IMAGE=docker.io/library/mongo:latest
MONGO_PORT=27017
APP_PORT=8080
MONGO_DB_NAME=clients_db
MONGO_URI=mongodb://mongo:${MONGO_PORT}/${MONGO_DB_NAME}- Add tests and monitor test coverage.
- Replace Smart tests with TestContainers usage.