Microservices
Screaming Architecture, Clean Architecture, Event-Driven Architecture, Clean Code, DDD, SOLID, Test Pyramid, Patterns (Ambassador, Circuit Breaker, Mediator, Outbox, Result, Retry, Strategy), Java 25, Spring Boot 4, Kong, Keycloak, Kafka, MongoDB, Redis, Elastic, Testcontainers, Docker
Install / Use
/learn @rafaelfgx/MicroservicesREADME
Microservices
Ebooks
<table> <tr> <td> <a href="https://hotmart.com/product/microservices/X102617285D"> <img src="https://hotmart.s3.amazonaws.com/product_pictures/01486abc-d26b-4125-a8ea-4b2a212e4a86/Cover.png" /> </a> </td> <td> <a href="https://hotmart.com/pt-br/marketplace/produtos/microservices/A102616752Q"> <img src="https://hotmart.s3.amazonaws.com/product_pictures/a2a7cc7f-de97-49fe-9fdb-1d6de5fe21a1/Cover.png" /> </a> </td> </tr> </table>System Design


Flow
sequenceDiagram
participant Client
participant AuthService
participant CustomerService
participant ProductService
participant OrderService
participant PaymentService
participant Kafka
Client->>AuthService: POST /auth
AuthService-->>Client: JWT
Client->>CustomerService: POST /customers
CustomerService-->>Client: Customer Created
Client->>ProductService: POST /products
ProductService-->>Client: Product Created
Client->>OrderService: POST /orders
OrderService-->>Client: Order Created
OrderService->>Kafka: OrderEvent Published
Kafka-->>PaymentService: OrderEvent Consumed
Note right of PaymentService: Payment Created
Client->>PaymentService: PUT /payments/order/{orderId}/status/{status}
PaymentService-->>Client: Payment Status Updated
PaymentService->>Kafka: PaymentEvent Published
Kafka-->>OrderService: PaymentEvent Consumed
Note right of OrderService: Status Updated
Architecture, Design and Principles
- Screaming Architecture
- Clean Architecture
- Event-Driven Architecture
- Clean Code
- Domain-Driven Design
- SOLID Principles
- Separation of Concerns
- Common Closure Principle
- Common Reuse Principle
- Test Pyramid
Patterns
- Ambassador Pattern
- Circuit Breaker Pattern
- Mediator Pattern
- Outbox Pattern
- Result Pattern
- Retry Pattern
- Strategy Pattern
Technologies and Tools
- Java
- Spring Boot
- Kong
- Keycloak
- OAuth2
- JWT
- Kafka
- MongoDB
- Debezium
- Redis
- Elastic
- Swagger
- Testcontainers
- Docker
- Kubernetes
Docker
docker compose up --detach --build --remove-orphans
Starter
Install Into Local Maven Repository: mvn clean install
Tools
-
Kong:
http://localhost:8002 -
Keycloak:
http://localhost:8005Username:adminPassword:password -
Kafka:
http://localhost:9000 -
Mongo:
http://localhost:27018 -
Redis:
http://localhost:6380 -
Logs:
http://localhost:5601/app/management/data/index_management/data_streams -
APM:
http://localhost:5601/app/apm/services
Services
AuthService
Localhost: http://localhost:8010
Docker: http://localhost:9010
Kong: http://localhost:8000/authservice
| Method | Endpoint | Description |
|:-----------------------------------------------------:|-------------|-------------|
| | /auth | Get |
|
| /auth | Auth |
|
| /users | Save |
|
| /users/{id} | Delete |
ConfigurationService
Localhost: http://localhost:8015
Docker: http://localhost:9015
Kong: http://localhost:8000/configurationservice
| Method | Endpoint | Description |
|:-----------------------------------------------------:|--------------------------------|---------------|
| | /configurations | Get |
|
| /configurations/broadcast | Broadcast |
|
| /features | List |
|
| /features | Create |
|
| /features/{id} | Get |
|
| /features/{id} | Delete |
|
| /features/{id}/disable | Disable |
|
| /features/{id}/enable | Enable |
|
| /features/{id}/enabled | Enabled |
|
| /features/groups/{group} | List By Group |
|
| /properties | List |
|
| /properties | Create |
|
| /properties/{id} | Get |
|
| /properties/{id} | Delete |
|
| /properties/{id}/value/{value} | Update Value |
CustomerService
Localhost: http://localhost:8020
Docker: http://localhost:9020
Kong: http://localhost:8000/customerservice
| Method | Endpoint | Description |
|:-----------------------------------------------------:|-----------------|-------------|
| | /customers | List |
|
| /customers | Create |
|
| /customers/{id} | Get |
|
| /customers/{id} | Update |
|
| /customers/{id} | Delete |
ProductService
Localhost: http://localhost:8025
Docker: http://localhost:9025
Kong: http://localhost:8000/productservice
| Method | Endpoint | Description |
|:-----------------------------------------------------:|----------------|-------------|
| | /products | List |
|
| /products | Create |
|
| /products/{id} | Get |
|
| /products/{id} | Update |
|
| /products/{id} | Delete |
OrderService
Localhost: http://localhost:8030
Docker: http://localhost:9030
Kong: http://localhost:8000/orderservice
| Method | Endpoint | Description |
|:-------------------------------------------------:|--------------|-------------|
| | /orders | List |
|
| /orders | Create |
|
| /orders/{id} | Get |
PaymentService
Localhost: http://localhost:8035
Docker: http://localhost:9035
Kong: http://localhost:8000/paymentservice
| Method | Endpoint | Description |
|-------------------------------------------------|-------------------------------------------|-----------------|
| | /payments | List |
|
| /payments/{id} | Get |
| 