# rohankotian/spring-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/rohankotian/spring-ecommerce
- Repository: https://github.com/rohankotian/spring-ecommerce

## Overview

This is a Spring Boot e-commerce microservices backend. The principal flow begins with a client entering through the API Gateway, then reaching domain services such as identity, product, and orders; order persistence is visible, while the sampled controller currently leaves event publishing commented out. README documents Eureka discovery and Kafka-based payment/notification flows, but their detailed wiring is not shown in the excerpts, so those relationships are not asserted. The graph preserves the documented service capabilities and the sampled identity internals.

Main entry points: [`identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java`](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java) (Auth Workflow), [`api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/filter/AuthenticationFilter.java`](https://github.com/rohankotian/spring-ecommerce/blob/master/api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/filter/AuthenticationFilter.java) (API Gateway), [`order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java`](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java) (Order API), [`identity-service/src/main/java/com/rohan/ecommerce/identity_service/controller/AuthController.java`](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/controller/AuthController.java) (Auth API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["API Entry"]
  node_gateway["API Gateway"]
  node_gateway_jwt["JWT Validation<br/>[JwtUtil.java]"]
end

subgraph group_identity["Identity"]
  node_identity_api["Auth API"]
  node_auth["Auth Workflow<br/>[AuthService.java]"]
  node_jwt["Token Issuer<br/>[JwtService.java]"]
  node_user_details["User Details"]
  node_user_store[("User Store")]
  node_user_model["User and Roles<br/>[User.java]"]
  node_identity_support["Identity Contracts"]
  node_identity_security["Identity Security<br/>[JwtAuthFilter.java]"]
end

subgraph group_catalog["Catalog"]
  node_product_api["Product Catalog API"]
  node_product_store[("Product Store")]
  node_product_model["Product Model<br/>[Product.java]"]
end

subgraph group_orders["Order Processing"]
  node_order_api["Order API"]
  node_order_store[("Order Store")]
  node_order_model["Order Model<br/>[Order.java]"]
  node_product_client["Product Client<br/>[ProductClient.java]"]
  node_product_fallback["Product Fallback"]
  node_order_contract["Product Response DTO"]
end

subgraph group_platform["Messaging and Discovery"]
  node_order_events["Order Event Producer<br/>[OrderProducer.java]"]
  node_payment["Payment Consumer"]
  node_email["Email Consumer<br/>[EmailConsumer.java]"]
  node_kafka["Kafka"]
  node_registry["Eureka Registry"]
  node_registry_external[("Service Discovery")]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_gateway
node_gateway -->|"validates tokens"| node_gateway_jwt
node_gateway -.->|"routes requests"| node_identity_api
node_identity_api -->|"delegates auth"| node_auth
node_auth -->|"reads and writes"| node_user_store
node_auth -->|"builds users"| node_user_model
node_auth -->|"issues tokens"| node_jwt
node_auth -->|"loads credentials"| node_user_details
node_user_details -->|"loads user"| node_user_store
node_identity_security -->|"loads identity"| node_user_details
node_identity_api -->|"uses contracts"| node_identity_support
node_product_api -->|"reads and writes"| node_product_store
node_product_api -->|"accepts products"| node_product_model
node_order_api -->|"saves orders"| node_order_store
node_order_api -->|"accepts order"| node_order_model
node_product_client -->|"falls back to"| node_product_fallback
node_product_client -->|"returns DTO"| node_order_contract
node_order_api -.->|"event call disabled"| node_order_events
node_order_events -.->|"publishes events"| node_kafka
node_kafka -.->|"delivers events"| node_payment
node_kafka -.->|"delivers notifications"| node_email
node_registry -.->|"provides discovery"| node_registry_external
node_gateway -.->|"uses discovery"| node_registry

click node_gateway "https://github.com/rohankotian/spring-ecommerce/blob/master/api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/filter/AuthenticationFilter.java"
click node_gateway_jwt "https://github.com/rohankotian/spring-ecommerce/blob/master/api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/util/JwtUtil.java"
click node_identity_api "https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/controller/AuthController.java"
click node_auth "https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java"
click node_jwt "https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/JwtService.java"
click node_user_details "https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/CustomUserDetailsService.java"
click node_user_store "https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/repository/UserRepository.java"
click node_user_model "https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/entity/User.java"
click node_identity_support "https://github.com/rohankotian/spring-ecommerce/tree/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/dto"
click node_identity_security "https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/filter/JwtAuthFilter.java"
click node_product_api "https://github.com/rohankotian/spring-ecommerce/blob/master/product-service/src/main/java/com/rohan/ecommerce/product_service/controller/ProductController.java"
click node_product_store "https://github.com/rohankotian/spring-ecommerce/blob/master/product-service/src/main/java/com/rohan/ecommerce/product_service/repository/ProductRepository.java"
click node_product_model "https://github.com/rohankotian/spring-ecommerce/blob/master/product-service/src/main/java/com/rohan/ecommerce/product_service/entity/Product.java"
click node_order_api "https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java"
click node_order_store "https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/repository/OrderRepository.java"
click node_order_model "https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/entity/Order.java"
click node_product_client "https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClient.java"
click node_product_fallback "https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClientFallback.java"
click node_order_contract "https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/dto/ProductResponse.java"
click node_order_events "https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/kafka/OrderProducer.java"
click node_payment "https://github.com/rohankotian/spring-ecommerce/blob/master/payment-service/src/main/java/com/rohan/ecommerce/payment_service/kafka/PaymentConsumer.java"
click node_email "https://github.com/rohankotian/spring-ecommerce/blob/master/email-service/src/main/java/com/rohan/ecommerce/email_service/kafka/EmailConsumer.java"
click node_registry "https://github.com/rohankotian/spring-ecommerce/blob/master/service-registry/src/main/java/com/rohan/ecommerce/service_registry/ServiceRegistryApplication.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,node_gateway_jwt,node_client toneBlue
class node_identity_api,node_auth,node_jwt,node_user_details,node_user_store,node_user_model,node_identity_support,node_identity_security toneAmber
class node_product_api,node_product_store,node_product_model toneMint
class node_order_api,node_order_store,node_order_model,node_product_client,node_product_fallback,node_order_contract toneRose
class node_order_events,node_payment,node_email,node_kafka,node_registry,node_registry_external toneIndigo
```

## Components

### API Entry

- [API Gateway](https://github.com/rohankotian/spring-ecommerce/blob/master/api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/filter/AuthenticationFilter.java): `api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/filter/AuthenticationFilter.java`
- [JWT Validation](https://github.com/rohankotian/spring-ecommerce/blob/master/api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/util/JwtUtil.java): `api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/util/JwtUtil.java`

### Identity

- [Auth API](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/controller/AuthController.java): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/controller/AuthController.java`
- [Auth Workflow](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java`
- [Token Issuer](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/JwtService.java): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/JwtService.java`
- [User Details](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/CustomUserDetailsService.java): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/CustomUserDetailsService.java`
- [User Store](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/repository/UserRepository.java): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/repository/UserRepository.java`
- [User and Roles](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/entity/User.java): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/entity/User.java`
- [Identity Contracts](https://github.com/rohankotian/spring-ecommerce/tree/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/dto): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/dto`
- [Identity Security](https://github.com/rohankotian/spring-ecommerce/blob/master/identity-service/src/main/java/com/rohan/ecommerce/identity_service/filter/JwtAuthFilter.java): `identity-service/src/main/java/com/rohan/ecommerce/identity_service/filter/JwtAuthFilter.java`

### Catalog

- [Product Catalog API](https://github.com/rohankotian/spring-ecommerce/blob/master/product-service/src/main/java/com/rohan/ecommerce/product_service/controller/ProductController.java): `product-service/src/main/java/com/rohan/ecommerce/product_service/controller/ProductController.java`
- [Product Store](https://github.com/rohankotian/spring-ecommerce/blob/master/product-service/src/main/java/com/rohan/ecommerce/product_service/repository/ProductRepository.java): `product-service/src/main/java/com/rohan/ecommerce/product_service/repository/ProductRepository.java`
- [Product Model](https://github.com/rohankotian/spring-ecommerce/blob/master/product-service/src/main/java/com/rohan/ecommerce/product_service/entity/Product.java): `product-service/src/main/java/com/rohan/ecommerce/product_service/entity/Product.java`

### Order Processing

- [Order API](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java): `order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java`
- [Order Store](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/repository/OrderRepository.java): `order-service/src/main/java/com/rohan/ecommerce/order_service/repository/OrderRepository.java`
- [Order Model](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/entity/Order.java): `order-service/src/main/java/com/rohan/ecommerce/order_service/entity/Order.java`
- [Product Client](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClient.java): `order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClient.java`
- [Product Fallback](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClientFallback.java): `order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClientFallback.java`
- [Product Response DTO](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/dto/ProductResponse.java): `order-service/src/main/java/com/rohan/ecommerce/order_service/dto/ProductResponse.java`

### Messaging and Discovery

- [Order Event Producer](https://github.com/rohankotian/spring-ecommerce/blob/master/order-service/src/main/java/com/rohan/ecommerce/order_service/kafka/OrderProducer.java): `order-service/src/main/java/com/rohan/ecommerce/order_service/kafka/OrderProducer.java`
- [Payment Consumer](https://github.com/rohankotian/spring-ecommerce/blob/master/payment-service/src/main/java/com/rohan/ecommerce/payment_service/kafka/PaymentConsumer.java): `payment-service/src/main/java/com/rohan/ecommerce/payment_service/kafka/PaymentConsumer.java`
- [Email Consumer](https://github.com/rohankotian/spring-ecommerce/blob/master/email-service/src/main/java/com/rohan/ecommerce/email_service/kafka/EmailConsumer.java): `email-service/src/main/java/com/rohan/ecommerce/email_service/kafka/EmailConsumer.java`
- **Kafka**
- [Eureka Registry](https://github.com/rohankotian/spring-ecommerce/blob/master/service-registry/src/main/java/com/rohan/ecommerce/service_registry/ServiceRegistryApplication.java): `service-registry/src/main/java/com/rohan/ecommerce/service_registry/ServiceRegistryApplication.java`
- **Service Discovery**

### Other components

- **API Client**

## Connections

- API Client → API Gateway: sends requests (evidence: `README.md`)
- API Gateway → JWT Validation: validates tokens (evidence: `api-gateway/src/main/java/com/rohan/ecommerce/api_gateway/filter/AuthenticationFilter.java`)
- API Gateway → Auth API: routes requests (evidence: `README.md`)
- Auth API → Auth Workflow: delegates auth (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/controller/AuthController.java`)
- Auth Workflow → User Store: reads and writes (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java`)
- Auth Workflow → User and Roles: builds users (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java`)
- Auth Workflow → Token Issuer: issues tokens (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java`)
- Auth Workflow → User Details: loads credentials (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/AuthService.java`)
- User Details → User Store: loads user (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/CustomUserDetailsService.java`)
- Identity Security → User Details: loads identity (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/service/CustomUserDetailsService.java`)
- Auth API → Identity Contracts: uses contracts (evidence: `identity-service/src/main/java/com/rohan/ecommerce/identity_service/controller/AuthController.java`)
- Product Catalog API → Product Store: reads and writes (evidence: `product-service/src/main/java/com/rohan/ecommerce/product_service/controller/ProductController.java`)
- Product Catalog API → Product Model: accepts products (evidence: `product-service/src/main/java/com/rohan/ecommerce/product_service/controller/ProductController.java`)
- Order API → Order Store: saves orders (evidence: `order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java`)
- Order API → Order Model: accepts order (evidence: `order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java`)
- Product Client → Product Fallback: falls back to (evidence: `order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClient.java`)
- Product Client → Product Response DTO: returns DTO (evidence: `order-service/src/main/java/com/rohan/ecommerce/order_service/client/ProductClient.java`)
- Order API → Order Event Producer: event call disabled (evidence: `order-service/src/main/java/com/rohan/ecommerce/order_service/controller/OrderController.java`)
- Order Event Producer → Kafka: publishes events (evidence: `README.md`)
- Kafka → Payment Consumer: delivers events (evidence: `README.md`)
- Kafka → Email Consumer: delivers notifications (evidence: `README.md`)
- Eureka Registry → Service Discovery: provides discovery (evidence: `README.md`)
- API Gateway → Eureka Registry: uses discovery (evidence: `README.md`)
