# gustavomiranda-dev/arquitetura-microservices-pedidos architecture

> Architecture diagram of the GitHub repository gustavomiranda-dev/arquitetura-microservices-pedidos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gustavomiranda-dev/arquitetura-microservices-pedidos
- Repository: https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos

## Overview

This Spring Cloud microservices example returns product details with a price that includes a currency-specific tax. The documented request begins at the API Gateway, reaches Product, then calls Price and Tax before the result returns. Product owns product lookup; Price delegates tax calculation; Tax applies the rate. Eureka provides service discovery, and the README also documents load balancing and Swagger/OpenAPI. Source excerpts support the internal calls; gateway routing and service registration are documented in the README, while some configuration and integration details were not sampled.

Main entry points: [`service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java`](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java) (Product workflow), [`pre-cluster-state/naming-server/src/main/java/github/io/Gusta_code22/Startup.java`](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/pre-cluster-state/naming-server/src/main/java/github/io/Gusta_code22/Startup.java) (Eureka Registry), [`service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java`](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java) (Price calculation), [`service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java`](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java) (Tax calculation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Access and discovery"]
  node_gateway["API Gateway"]
  node_registry["Eureka Registry<br/>[Startup.java]"]
end

subgraph group_product["Product service"]
  node_product_api["Product API"]
  node_product_service["Product workflow"]
  node_product_db_access["Product repository"]
  node_product_data["Product records<br/>[Produto.java]"]
  node_product_response["Product response<br/>[ProdutoDto.java]"]
  node_product_price_proxy["Price Feign client<br/>[PrecoProxy.java]"]
  node_product_errors["Product errors"]
  node_currency_error["Currency validation"]
end

subgraph group_pricing["Pricing services"]
  node_price_api["Price API"]
  node_price_service["Price calculation<br/>[PrecoService.java]"]
  node_tax_proxy["Tax Feign client<br/>[ImpostoProxy.java]"]
  node_price_response["Price response<br/>[PrecoDTO.java]"]
  node_tax_api["Tax API"]
  node_tax_service["Tax calculation"]
  node_tax_response["Tax response<br/>[ImpostoDTO.java]"]
  node_tax_error["Unsupported currency"]
end

subgraph group_ops["API and operations"]
  node_instance_info["Instance metadata"]
  node_api_docs["Swagger / OpenAPI"]
end

node_client(("Client"))
node_sql[("SQL database")]

node_client -->|"requests"| node_gateway
node_gateway -->|"routes to"| node_product_api
node_gateway -->|"discovers services"| node_registry
node_registry -->|"registers instances"| node_product_api
node_registry -->|"registers instances"| node_price_api
node_registry -->|"registers instances"| node_tax_api
node_product_api -->|"calls"| node_product_service
node_product_service -->|"queries"| node_product_db_access
node_product_db_access -->|"persists via JPA"| node_sql
node_product_service -->|"requests price"| node_product_price_proxy
node_product_service -->|"builds response"| node_product_response
node_product_service -->|"raises when missing"| node_product_errors
node_product_service -->|"rejects blank currency"| node_currency_error
node_product_price_proxy -->|"calls price service"| node_price_api
node_price_api -->|"calls"| node_price_service
node_price_service -->|"requests tax"| node_tax_proxy
node_tax_proxy -->|"calls tax service"| node_tax_api
node_price_service -->|"builds response"| node_price_response
node_tax_api -->|"calls"| node_tax_service
node_tax_service -->|"builds response"| node_tax_response
node_tax_service -->|"rejects unsupported currency"| node_tax_error
node_price_service -->|"reads instance data"| node_instance_info
node_tax_service -.->|"reads instance data"| node_instance_info
node_api_docs -.->|"documents endpoints"| node_product_api

click node_gateway "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/pre-cluster-state/api-gateway/src/main/java/github/io/Gusta_code22/config/ApiGatewayConfiguration.java"
click node_registry "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/pre-cluster-state/naming-server/src/main/java/github/io/Gusta_code22/Startup.java"
click node_product_api "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/controller/ProdutoController.java"
click node_product_service "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java"
click node_product_db_access "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/repository/ProdutoRepository.java"
click node_product_data "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/entity/Produto.java"
click node_product_response "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/dto/ProdutoDto.java"
click node_product_price_proxy "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/proxy/PrecoProxy.java"
click node_product_errors "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/exception/ProdutoNaoEncontradoException.java"
click node_currency_error "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/exception/MoedaInvalidaException.java"
click node_price_api "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/controller/PrecoController.java"
click node_price_service "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java"
click node_tax_proxy "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/proxy/ImpostoProxy.java"
click node_price_response "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/dto/PrecoDTO.java"
click node_tax_api "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/controller/ImpostoController.java"
click node_tax_service "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java"
click node_tax_response "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/dto/ImpostoDTO.java"
click node_tax_error "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/exception/MoedaNaoSuportadaException.java"
click node_instance_info "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/enviroment/InstanceInformationService.java"
click node_api_docs "https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/tree/main/service-produto/src/main"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gateway,node_registry,node_client toneBlue
class node_product_api,node_product_service,node_product_db_access,node_product_data,node_product_response,node_product_price_proxy,node_product_errors,node_currency_error,node_sql toneAmber
class node_price_api,node_price_service,node_tax_proxy,node_price_response,node_tax_api,node_tax_service,node_tax_response,node_tax_error toneMint
class node_instance_info,node_api_docs toneRose
```

## Components

### Access and discovery

- [API Gateway](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/pre-cluster-state/api-gateway/src/main/java/github/io/Gusta_code22/config/ApiGatewayConfiguration.java): `pre-cluster-state/api-gateway/src/main/java/github/io/Gusta_code22/config/ApiGatewayConfiguration.java`
- [Eureka Registry](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/pre-cluster-state/naming-server/src/main/java/github/io/Gusta_code22/Startup.java): `pre-cluster-state/naming-server/src/main/java/github/io/Gusta_code22/Startup.java`

### Product service

- [Product API](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/controller/ProdutoController.java): `service-produto/src/main/java/github/io/Gusta_code22/controller/ProdutoController.java`
- [Product workflow](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java): `service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java`
- [Product repository](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/repository/ProdutoRepository.java): `service-produto/src/main/java/github/io/Gusta_code22/repository/ProdutoRepository.java`
- [Product records](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/entity/Produto.java): `service-produto/src/main/java/github/io/Gusta_code22/entity/Produto.java`
- [Product response](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/dto/ProdutoDto.java): `service-produto/src/main/java/github/io/Gusta_code22/dto/ProdutoDto.java`
- [Price Feign client](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/proxy/PrecoProxy.java): `service-produto/src/main/java/github/io/Gusta_code22/proxy/PrecoProxy.java`
- [Product errors](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/exception/ProdutoNaoEncontradoException.java): `service-produto/src/main/java/github/io/Gusta_code22/exception/ProdutoNaoEncontradoException.java`
- [Currency validation](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-produto/src/main/java/github/io/Gusta_code22/exception/MoedaInvalidaException.java): `service-produto/src/main/java/github/io/Gusta_code22/exception/MoedaInvalidaException.java`

### Pricing services

- [Price API](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/controller/PrecoController.java): `service-preco/src/main/java/github/io/Gusta_code22/controller/PrecoController.java`
- [Price calculation](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java): `service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java`
- [Tax Feign client](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/proxy/ImpostoProxy.java): `service-preco/src/main/java/github/io/Gusta_code22/proxy/ImpostoProxy.java`
- [Price response](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/dto/PrecoDTO.java): `service-preco/src/main/java/github/io/Gusta_code22/dto/PrecoDTO.java`
- [Tax API](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/controller/ImpostoController.java): `service-imposto/src/main/java/github/io/Gusta_code22/controller/ImpostoController.java`
- [Tax calculation](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java): `service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java`
- [Tax response](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/dto/ImpostoDTO.java): `service-imposto/src/main/java/github/io/Gusta_code22/dto/ImpostoDTO.java`
- [Unsupported currency](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-imposto/src/main/java/github/io/Gusta_code22/exception/MoedaNaoSuportadaException.java): `service-imposto/src/main/java/github/io/Gusta_code22/exception/MoedaNaoSuportadaException.java`

### API and operations

- [Instance metadata](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/blob/main/service-preco/src/main/java/github/io/Gusta_code22/enviroment/InstanceInformationService.java): `service-preco/src/main/java/github/io/Gusta_code22/enviroment/InstanceInformationService.java`
- [Swagger / OpenAPI](https://github.com/gustavomiranda-dev/arquitetura-microservices-pedidos/tree/main/service-produto/src/main): `service-produto/src/main`

### Other components

- **Client**
- **SQL database**

## Connections

- Client → API Gateway: requests (evidence: `README.md`)
- API Gateway → Product API: routes to (evidence: `README.md`)
- API Gateway → Eureka Registry: discovers services (evidence: `README.md`)
- Eureka Registry → Product API: registers instances (evidence: `README.md`)
- Eureka Registry → Price API: registers instances (evidence: `README.md`)
- Eureka Registry → Tax API: registers instances (evidence: `README.md`)
- Product API → Product workflow: calls (evidence: `service-produto/src/main/java/github/io/Gusta_code22/controller/ProdutoController.java`)
- Product workflow → Product repository: queries (evidence: `service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java`)
- Product repository → SQL database: persists via JPA (evidence: `README.md`)
- Product workflow → Price Feign client: requests price (evidence: `service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java`)
- Product workflow → Product response: builds response (evidence: `service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java`)
- Product workflow → Product errors: raises when missing (evidence: `service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java`)
- Product workflow → Currency validation: rejects blank currency (evidence: `service-produto/src/main/java/github/io/Gusta_code22/service/ProdutoService.java`)
- Price Feign client → Price API: calls price service (evidence: `README.md`)
- Price API → Price calculation: calls (evidence: `service-preco/src/main/java/github/io/Gusta_code22/controller/PrecoController.java`)
- Price calculation → Tax Feign client: requests tax (evidence: `service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java`)
- Tax Feign client → Tax API: calls tax service (evidence: `README.md`)
- Price calculation → Price response: builds response (evidence: `service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java`)
- Tax API → Tax calculation: calls (evidence: `service-imposto/src/main/java/github/io/Gusta_code22/controller/ImpostoController.java`)
- Tax calculation → Tax response: builds response (evidence: `service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java`)
- Tax calculation → Unsupported currency: rejects unsupported currency (evidence: `service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java`)
- Price calculation → Instance metadata: reads instance data (evidence: `service-preco/src/main/java/github/io/Gusta_code22/service/PrecoService.java`)
- Tax calculation → Instance metadata: reads instance data (evidence: `service-imposto/src/main/java/github/io/Gusta_code22/service/ImpostoService.java`)
- Swagger / OpenAPI → Product API: documents endpoints (evidence: `README.md`)
