# senaustun-dev/springboot-microservices-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/senaustun-dev/springboot-microservices-ecommerce
- Repository: https://github.com/senaustun-dev/springboot-microservices-ecommerce

## Overview

This is a Spring Boot e-commerce microservices practice project. A client sends product, order, or inventory requests through the API gateway; the gateway routes them to services, with Eureka-backed discovery documented for service lookup. Product and inventory requests are handled by their respective services. Order placement checks inventory synchronously, persists the order, and emits an event for asynchronous notification. The README also documents centralized security, aggregated API docs, resilience, and observability. Order-service implementation details and infrastructure wiring are partly inferred from the README and tree; their exact call paths were not sampled.

Main entry points: [`api-gateway/src/main/java/com/github/senaustundev/api_gateway/routes/Routes.java`](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/routes/Routes.java) (Gateway Routes), [`order-service/src/main/java/com/github/senaustundev/order_service/service/impl/OrderServiceImpl.java`](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/service/impl/OrderServiceImpl.java) (Order Service), [`inventory-service/src/main/java/com/github/senaustundev/inventory_service/controller/InventoryController.java`](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/controller/InventoryController.java) (Inventory API), [`product-service/src/main/java/com/github/senaustundev/product_service/controller/ProductController.java`](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/controller/ProductController.java) (Product API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["API Gateway"]
  node_gateway_routes["Gateway Routes<br/>[Routes.java]"]
  node_gateway_security["Gateway Security"]
  node_gateway_fallback["Fallback Handler"]
end

subgraph group_discovery["Service Discovery"]
  node_eureka["Eureka Server"]
end

subgraph group_commerce["Commerce Services"]
  node_product_api["Product API"]
  node_product_logic["Product Service"]
  node_product_store["Product Repository"]
  node_product_db[("Product Database")]
  node_order_api["Order API"]
  node_order_logic["Order Service"]
  node_inventory_client["Inventory Client"]
  node_order_store["Order Repository"]
  node_order_db[("Order Database")]
  node_inventory_api["Inventory API"]
  node_inventory_logic["Inventory Service"]
  node_inventory_store["Inventory Repository"]
  node_inventory_db[("Inventory Database")]
end

subgraph group_messaging["Notifications"]
  node_kafka["Kafka"]
  node_notification_logic["Notification Service"]
end

subgraph group_platform["Security And Observability"]
  node_keycloak["Keycloak"]
  node_observability["Observability Stack"]
  node_gateway_observability["Gateway Telemetry"]
  node_product_observability["Product Telemetry"]
  node_order_observability["Order Telemetry"]
  node_inventory_observability["Inventory Telemetry"]
  node_notification_observability["Notification Telemetry"]
end

node_client(("API Client"))

node_client -->|"sends request"| node_gateway_routes
node_gateway_routes -->|"routes product"| node_product_api
node_gateway_routes -->|"routes order"| node_order_api
node_gateway_routes -->|"routes inventory"| node_inventory_api
node_gateway_routes -->|"forwards fallback"| node_gateway_fallback
node_gateway_routes -->|"resolves service"| node_eureka
node_gateway_security -.->|"authenticates with"| node_keycloak
node_product_api -->|"invokes"| node_product_logic
node_product_logic -->|"uses repository"| node_product_store
node_product_store -->|"reads and writes"| node_product_db
node_order_api -->|"invokes"| node_order_logic
node_order_logic -->|"checks stock"| node_inventory_client
node_inventory_client -->|"requests availability"| node_inventory_api
node_order_logic -->|"saves order"| node_order_store
node_order_store -->|"reads and writes"| node_order_db
node_order_logic -->|"publishes event"| node_kafka
node_kafka -->|"delivers event"| node_notification_logic
node_inventory_api -->|"invokes"| node_inventory_logic
node_inventory_logic -->|"uses repository"| node_inventory_store
node_inventory_store -->|"reads stock"| node_inventory_db
node_gateway_observability -->|"exports telemetry"| node_observability
node_product_observability -->|"exports telemetry"| node_observability
node_order_observability -->|"exports telemetry"| node_observability
node_inventory_observability -->|"exports telemetry"| node_observability
node_notification_observability -->|"exports telemetry"| node_observability

click node_gateway_routes "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/routes/Routes.java"
click node_gateway_security "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/config/SecurityConfig.java"
click node_gateway_fallback "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/controller/FallbackController.java"
click node_eureka "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/eureka-server/src/main/java/com/github/senaustundev/eureka_server/EurekaServerApplication.java"
click node_product_api "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/controller/ProductController.java"
click node_product_logic "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/service/impl/ProductSerciveImpl.java"
click node_product_store "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/repository/ProductRepository.java"
click node_order_api "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/controller/OrderController.java"
click node_order_logic "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/service/impl/OrderServiceImpl.java"
click node_inventory_client "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/client/InventoryClient.java"
click node_order_store "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/repository/OrderRepository.java"
click node_inventory_api "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/controller/InventoryController.java"
click node_inventory_logic "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/service/impl/InventoryServiceImpl.java"
click node_inventory_store "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/repository/InventoryRepository.java"
click node_notification_logic "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/notification-service/src/main/java/com/github/senaustundev/notification_service/service/impl/NotificationServiceImpl.java"
click node_gateway_observability "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/config/ObservabilityConfig.java"
click node_product_observability "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/config/ObservabilityConfig.java"
click node_order_observability "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/config/ObservabilityConfig.java"
click node_inventory_observability "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/config/ObservabilityConfig.java"
click node_notification_observability "https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/notification-service/src/main/java/com/github/senaustundev/notification_service/config/ObservabilityConfig.java"

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_routes,node_gateway_security,node_gateway_fallback,node_client toneBlue
class node_eureka toneAmber
class node_product_api,node_product_logic,node_product_store,node_product_db,node_order_api,node_order_logic,node_inventory_client,node_order_store,node_order_db,node_inventory_api,node_inventory_logic,node_inventory_store,node_inventory_db toneMint
class node_kafka,node_notification_logic toneRose
class node_keycloak,node_observability,node_gateway_observability,node_product_observability,node_order_observability,node_inventory_observability,node_notification_observability toneIndigo
```

## Components

### API Gateway

- [Gateway Routes](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/routes/Routes.java): `api-gateway/src/main/java/com/github/senaustundev/api_gateway/routes/Routes.java`
- [Gateway Security](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/config/SecurityConfig.java): `api-gateway/src/main/java/com/github/senaustundev/api_gateway/config/SecurityConfig.java`
- [Fallback Handler](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/controller/FallbackController.java): `api-gateway/src/main/java/com/github/senaustundev/api_gateway/controller/FallbackController.java`

### Service Discovery

- [Eureka Server](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/eureka-server/src/main/java/com/github/senaustundev/eureka_server/EurekaServerApplication.java): `eureka-server/src/main/java/com/github/senaustundev/eureka_server/EurekaServerApplication.java`

### Commerce Services

- [Product API](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/controller/ProductController.java): `product-service/src/main/java/com/github/senaustundev/product_service/controller/ProductController.java`
- [Product Service](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/service/impl/ProductSerciveImpl.java): `product-service/src/main/java/com/github/senaustundev/product_service/service/impl/ProductSerciveImpl.java`
- [Product Repository](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/repository/ProductRepository.java): `product-service/src/main/java/com/github/senaustundev/product_service/repository/ProductRepository.java`
- **Product Database**
- [Order API](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/controller/OrderController.java): `order-service/src/main/java/com/github/senaustundev/order_service/controller/OrderController.java`
- [Order Service](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/service/impl/OrderServiceImpl.java): `order-service/src/main/java/com/github/senaustundev/order_service/service/impl/OrderServiceImpl.java`
- [Inventory Client](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/client/InventoryClient.java): `order-service/src/main/java/com/github/senaustundev/order_service/client/InventoryClient.java`
- [Order Repository](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/repository/OrderRepository.java): `order-service/src/main/java/com/github/senaustundev/order_service/repository/OrderRepository.java`
- **Order Database**
- [Inventory API](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/controller/InventoryController.java): `inventory-service/src/main/java/com/github/senaustundev/inventory_service/controller/InventoryController.java`
- [Inventory Service](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/service/impl/InventoryServiceImpl.java): `inventory-service/src/main/java/com/github/senaustundev/inventory_service/service/impl/InventoryServiceImpl.java`
- [Inventory Repository](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/repository/InventoryRepository.java): `inventory-service/src/main/java/com/github/senaustundev/inventory_service/repository/InventoryRepository.java`
- **Inventory Database**

### Notifications

- **Kafka**
- [Notification Service](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/notification-service/src/main/java/com/github/senaustundev/notification_service/service/impl/NotificationServiceImpl.java): `notification-service/src/main/java/com/github/senaustundev/notification_service/service/impl/NotificationServiceImpl.java`

### Security And Observability

- **Keycloak**
- **Observability Stack**
- [Gateway Telemetry](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/api-gateway/src/main/java/com/github/senaustundev/api_gateway/config/ObservabilityConfig.java): `api-gateway/src/main/java/com/github/senaustundev/api_gateway/config/ObservabilityConfig.java`
- [Product Telemetry](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/product-service/src/main/java/com/github/senaustundev/product_service/config/ObservabilityConfig.java): `product-service/src/main/java/com/github/senaustundev/product_service/config/ObservabilityConfig.java`
- [Order Telemetry](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/order-service/src/main/java/com/github/senaustundev/order_service/config/ObservabilityConfig.java): `order-service/src/main/java/com/github/senaustundev/order_service/config/ObservabilityConfig.java`
- [Inventory Telemetry](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/inventory-service/src/main/java/com/github/senaustundev/inventory_service/config/ObservabilityConfig.java): `inventory-service/src/main/java/com/github/senaustundev/inventory_service/config/ObservabilityConfig.java`
- [Notification Telemetry](https://github.com/senaustun-dev/springboot-microservices-ecommerce/blob/main/notification-service/src/main/java/com/github/senaustundev/notification_service/config/ObservabilityConfig.java): `notification-service/src/main/java/com/github/senaustundev/notification_service/config/ObservabilityConfig.java`

### Other components

- **API Client**

## Connections

- API Client → Gateway Routes: sends request
- Gateway Routes → Product API: routes product
- Gateway Routes → Order API: routes order
- Gateway Routes → Inventory API: routes inventory
- Gateway Routes → Fallback Handler: forwards fallback
- Gateway Routes → Eureka Server: resolves service
- Gateway Security → Keycloak: authenticates with
- Product API → Product Service: invokes
- Product Service → Product Repository: uses repository
- Product Repository → Product Database: reads and writes
- Order API → Order Service: invokes
- Order Service → Inventory Client: checks stock
- Inventory Client → Inventory API: requests availability
- Order Service → Order Repository: saves order
- Order Repository → Order Database: reads and writes
- Order Service → Kafka: publishes event
- Kafka → Notification Service: delivers event
- Inventory API → Inventory Service: invokes
- Inventory Service → Inventory Repository: uses repository
- Inventory Repository → Inventory Database: reads stock
- Gateway Telemetry → Observability Stack: exports telemetry
- Product Telemetry → Observability Stack: exports telemetry
- Order Telemetry → Observability Stack: exports telemetry
- Inventory Telemetry → Observability Stack: exports telemetry
- Notification Telemetry → Observability Stack: exports telemetry
