https://github.com/maria-leiliane/quarkus-client-address-api
This project is a REST API built with 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.
https://github.com/maria-leiliane/quarkus-client-address-api
api-rest clean-architecture docker docker-compose java microservice quarkus women-in-tech
Last synced: 2 days ago
JSON representation
This project is a REST API built with 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.
- Host: GitHub
- URL: https://github.com/maria-leiliane/quarkus-client-address-api
- Owner: Maria-Leiliane
- Created: 2025-08-14T22:02:49.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-08-25T23:32:12.000Z (about 1 month ago)
- Last Synced: 2025-09-18T22:47:51.435Z (18 days ago)
- Topics: api-rest, clean-architecture, docker, docker-compose, java, microservice, quarkus, women-in-tech
- Language: Java
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π REST API for Clients and Addresses
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**.---
## π οΈ Key Technologies
* **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.---
## π Project Structure
* **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/migration` for schema versioning.---
## π Features
* β **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.---
## βοΈ Setup and Execution
### 1. Clone the repository
```bash
git clone git@github.com:Maria-Leiliane/quarkus-client-address-api.git
cd quarkus-client-address-api
```Create the database local: clientdb
### 2. Configure the Database
Edit `application.properties`:
```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
```### 3. Run in Dev Mode (with live coding)
```bash
./gradlew quarkusDev
```> Dev UI: [http://localhost:8080](http://localhost:8080)
For test we have the doc: [http://localhost:8080/q/swagger-ui/](http://localhost:8080/q/swagger-ui/)
Other options: Import the `client-address-api.json` file and lets test it.### 5. Run with Docker (In Development)
### 6. Run unit tests
```bash
./gradlew test
```---
## π API Endpoints
### **Clients**
* `GET /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.### **Addresses** *(sub-resource of 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.---