This project is a REST API built with Quarkus, a Supersonic Subatomic Java Framework. The solution provides a complete set of endpoints to manage clients and their addresses, following a clean layered architecture, with features like exception handling, validation (CPF/CNPJ), encryption, and pagination.
- Quarkus → Modern Java framework for cloud-native applications.
- JDBI 3 → SQL persistence library with lightweight abstractions.
- PostgreSQL → Relational database for reliable data storage.
- Flyway → Schema version control with migration scripts.
- JUnit 5 → Unit and integration testing framework.
- Jackson → JSON serialization/deserialization.
- Gradle → Build automation tool.
- Docker → Containerization for consistent environments.
- Controller → Handles HTTP requests and maps them to services.
- Service → Core business logic, validation, and transaction orchestration.
- Repository → Encapsulates persistence and database interaction.
- Entity → Database schema representation.
- DTOs → Transfer data between layers, isolating domain models.
- Exception → Centralized custom exception handling (consistent error responses).
- Flyway Migrations →
src/main/resources/db/migrationfor schema versioning.
- ✅ Custom exception handling → Unified error responses.
- ✅ Password encryption → Using
BcryptUtil. - ✅ Validation for CPF and CNPJ → Ensures domain integrity.
- ✅ Pagination & filtering → For efficient client listing.
- ✅ Main address logic → Enforces one main address per client.
git clone git@github.com:Maria-Leiliane/quarkus-client-address-api.git
cd quarkus-client-address-apiCreate the database local: clientdb
Edit application.properties:
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=youruser
quarkus.datasource.password=yourpassword
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/clientdb
quarkus.flyway.migrate-at-start=true./gradlew quarkusDevDev UI: http://localhost:8080
For test we have the doc: http://localhost:8080/q/swagger-ui/
Other options: Import the client-address-api.json file and lets test it.
./gradlew testGET /clients→ List clients (pagination + filters).GET /clients/{id}→ Retrieve client by ID.POST /clients→ Create new client (with encrypted password).PATCH /clients/{id}→ Partial update.DELETE /clients/{id}→ Remove client.
GET /clients/{id}/addresses→ List client’s addresses.POST /clients/{id}/addresses→ Add new address.DELETE /clients/{id}/addresses/{addressId}→ Remove client’s address.