# ganchevdimitarg/e-commorce architecture

> Architecture diagram of the GitHub repository ganchevdimitarg/e-commorce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ganchevdimitarg/e-commorce
- Repository: https://github.com/ganchevdimitarg/e-commorce

## Overview

This repository is a Spring Cloud e-commerce platform. The principal path is a client request through the API gateway into domain services: users can register, browse catalog data, place and track orders, and manage payment/profile information. Authentication publishes user lifecycle events; notifications consume order-notification events and send email. The README documents gateway routing and asynchronous messaging, but most cross-service wiring was not sampled, so those relationships are shown only where documentation or excerpts support them. Several service internals are represented at their exact source paths without asserting unseen calls.

Main entry points: [`gateway/src/main/java/com/ganchevdimitarg/gateway`](https://github.com/ganchevdimitarg/e-commorce/tree/main/gateway/src/main/java/com/ganchevdimitarg/gateway) (API gateway), [`order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java`](https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java) (Order API), [`catalog/src/main/java/com/ganchevdimitarg/catalog`](https://github.com/ganchevdimitarg/e-commorce/tree/main/catalog/src/main/java/com/ganchevdimitarg/catalog) (Product catalog), [`notification/src/main/java/com/ganchevdimitarg/notification/listener/KafkaListenerService.java`](https://github.com/ganchevdimitarg/e-commorce/blob/main/notification/src/main/java/com/ganchevdimitarg/notification/listener/KafkaListenerService.java) (Notification consumer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and identity"]
  node_gateway["API gateway"]
  node_auth["Authentication"]
  node_account["Account lifecycle"]
end

subgraph group_commerce["Commerce services"]
  node_catalog["Product catalog"]
  node_product["Product operations"]
  node_category["Category operations"]
  node_comments["Product comments"]
  node_order["Order management<br/>[OrderService.java]"]
  node_order_api["Order API"]
  node_order_state["Order lifecycle<br/>[OrderStatus.java]"]
  node_order_idempotency["Order idempotency"]
  node_payment["Payment processing<br/>[ChargeService.java]"]
  node_profile_api["Profile API"]
  node_profile["Profile service"]
end

subgraph group_events["Events and notifications"]
  node_events["User event outbox<br/>[OutboxWriter.java]"]
  node_notification["Notification consumer"]
  node_email["Email delivery<br/>[EmailService.java]"]
  node_notify_dedupe["Notification dedupe"]
end

subgraph group_platform["Platform infrastructure"]
  node_eureka["Service discovery"]
  node_kafka["Message broker"]
  node_redis[("Redis")]
end

node_customer(("Client user"))

node_customer -->|"sends requests"| node_gateway
node_gateway -.->|"routes requests"| node_auth
node_gateway -.->|"routes requests"| node_catalog
node_gateway -.->|"routes requests"| node_order_api
node_gateway -.->|"routes requests"| node_payment
node_gateway -.->|"routes requests"| node_profile_api
node_account -->|"writes events"| node_events
node_order_api -->|"calls"| node_order
node_order_api -->|"guards mutations"| node_order_idempotency
node_order_api -->|"requests lifecycle changes"| node_order
node_order -->|"uses transitions"| node_order_state
node_profile_api -->|"calls"| node_profile
node_profile -->|"fetches card reference"| node_payment
node_notification -->|"sends email"| node_email
node_notification -->|"deduplicates events"| node_notify_dedupe
node_events -.->|"publishes events"| node_kafka
node_kafka -.->|"delivers events"| node_notification
node_order_idempotency -->|"stores replay results"| node_redis
node_notify_dedupe -->|"claims event keys"| node_redis
node_product -.->|"serves catalog operations"| node_catalog
node_category -.->|"serves category operations"| node_catalog
node_comments -.->|"serves comment operations"| node_catalog
node_customer -.->|"discovers services"| node_eureka

click node_gateway "https://github.com/ganchevdimitarg/e-commorce/tree/main/gateway/src/main/java/com/ganchevdimitarg/gateway"
click node_auth "https://github.com/ganchevdimitarg/e-commorce/tree/main/authentication/src/main/java/com/ganchevdimitarg/auth"
click node_account "https://github.com/ganchevdimitarg/e-commorce/blob/main/authentication/src/main/java/com/ganchevdimitarg/auth/service/AccountService.java"
click node_catalog "https://github.com/ganchevdimitarg/e-commorce/tree/main/catalog/src/main/java/com/ganchevdimitarg/catalog"
click node_product "https://github.com/ganchevdimitarg/e-commorce/blob/main/catalog/src/main/java/com/ganchevdimitarg/catalog/service/product/ProductService.java"
click node_category "https://github.com/ganchevdimitarg/e-commorce/blob/main/catalog/src/main/java/com/ganchevdimitarg/catalog/service/category/CategoryService.java"
click node_comments "https://github.com/ganchevdimitarg/e-commorce/blob/main/catalog/src/main/java/com/ganchevdimitarg/catalog/service/comment/CommentService.java"
click node_order "https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/service/OrderService.java"
click node_order_api "https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java"
click node_order_state "https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/domain/OrderStatus.java"
click node_order_idempotency "https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/service/IdempotencyService.java"
click node_payment "https://github.com/ganchevdimitarg/e-commorce/blob/main/payment/src/main/java/com/ganchevdimitarg/payment/service/ChargeService.java"
click node_profile_api "https://github.com/ganchevdimitarg/e-commorce/blob/main/profile/src/main/java/com/ganchevdimitarg/profile/controller/ProfileController.java"
click node_profile "https://github.com/ganchevdimitarg/e-commorce/blob/main/profile/src/main/java/com/ganchevdimitarg/profile/service/ProfileService.java"
click node_events "https://github.com/ganchevdimitarg/e-commorce/blob/main/authentication/src/main/java/com/ganchevdimitarg/auth/service/OutboxWriter.java"
click node_notification "https://github.com/ganchevdimitarg/e-commorce/blob/main/notification/src/main/java/com/ganchevdimitarg/notification/listener/KafkaListenerService.java"
click node_email "https://github.com/ganchevdimitarg/e-commorce/blob/main/notification/src/main/java/com/ganchevdimitarg/notification/service/EmailService.java"
click node_notify_dedupe "https://github.com/ganchevdimitarg/e-commorce/blob/main/notification/src/main/java/com/ganchevdimitarg/notification/service/IdempotencyService.java"
click node_eureka "https://github.com/ganchevdimitarg/e-commorce/blob/main/eureka-server/src/main/java/com/ganchevdimitarg/EurekaServerApplication.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_auth,node_account,node_customer toneBlue
class node_catalog,node_product,node_category,node_comments,node_order,node_order_api,node_order_state,node_order_idempotency,node_payment,node_profile_api,node_profile toneAmber
class node_events,node_notification,node_email,node_notify_dedupe toneMint
class node_eureka,node_kafka,node_redis toneRose
```

## Components

### Entry and identity

- [API gateway](https://github.com/ganchevdimitarg/e-commorce/tree/main/gateway/src/main/java/com/ganchevdimitarg/gateway): `gateway/src/main/java/com/ganchevdimitarg/gateway`
- [Authentication](https://github.com/ganchevdimitarg/e-commorce/tree/main/authentication/src/main/java/com/ganchevdimitarg/auth): `authentication/src/main/java/com/ganchevdimitarg/auth`
- [Account lifecycle](https://github.com/ganchevdimitarg/e-commorce/blob/main/authentication/src/main/java/com/ganchevdimitarg/auth/service/AccountService.java): `authentication/src/main/java/com/ganchevdimitarg/auth/service/AccountService.java`

### Commerce services

- [Product catalog](https://github.com/ganchevdimitarg/e-commorce/tree/main/catalog/src/main/java/com/ganchevdimitarg/catalog): `catalog/src/main/java/com/ganchevdimitarg/catalog`
- [Product operations](https://github.com/ganchevdimitarg/e-commorce/blob/main/catalog/src/main/java/com/ganchevdimitarg/catalog/service/product/ProductService.java): `catalog/src/main/java/com/ganchevdimitarg/catalog/service/product/ProductService.java`
- [Category operations](https://github.com/ganchevdimitarg/e-commorce/blob/main/catalog/src/main/java/com/ganchevdimitarg/catalog/service/category/CategoryService.java): `catalog/src/main/java/com/ganchevdimitarg/catalog/service/category/CategoryService.java`
- [Product comments](https://github.com/ganchevdimitarg/e-commorce/blob/main/catalog/src/main/java/com/ganchevdimitarg/catalog/service/comment/CommentService.java): `catalog/src/main/java/com/ganchevdimitarg/catalog/service/comment/CommentService.java`
- [Order management](https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/service/OrderService.java): `order/src/main/java/com/ganchevdimitarg/order/service/OrderService.java`
- [Order API](https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java): `order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java`
- [Order lifecycle](https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/domain/OrderStatus.java): `order/src/main/java/com/ganchevdimitarg/order/domain/OrderStatus.java`
- [Order idempotency](https://github.com/ganchevdimitarg/e-commorce/blob/main/order/src/main/java/com/ganchevdimitarg/order/service/IdempotencyService.java): `order/src/main/java/com/ganchevdimitarg/order/service/IdempotencyService.java`
- [Payment processing](https://github.com/ganchevdimitarg/e-commorce/blob/main/payment/src/main/java/com/ganchevdimitarg/payment/service/ChargeService.java): `payment/src/main/java/com/ganchevdimitarg/payment/service/ChargeService.java`
- [Profile API](https://github.com/ganchevdimitarg/e-commorce/blob/main/profile/src/main/java/com/ganchevdimitarg/profile/controller/ProfileController.java): `profile/src/main/java/com/ganchevdimitarg/profile/controller/ProfileController.java`
- [Profile service](https://github.com/ganchevdimitarg/e-commorce/blob/main/profile/src/main/java/com/ganchevdimitarg/profile/service/ProfileService.java): `profile/src/main/java/com/ganchevdimitarg/profile/service/ProfileService.java`

### Events and notifications

- [User event outbox](https://github.com/ganchevdimitarg/e-commorce/blob/main/authentication/src/main/java/com/ganchevdimitarg/auth/service/OutboxWriter.java): `authentication/src/main/java/com/ganchevdimitarg/auth/service/OutboxWriter.java`
- [Notification consumer](https://github.com/ganchevdimitarg/e-commorce/blob/main/notification/src/main/java/com/ganchevdimitarg/notification/listener/KafkaListenerService.java): `notification/src/main/java/com/ganchevdimitarg/notification/listener/KafkaListenerService.java`
- [Email delivery](https://github.com/ganchevdimitarg/e-commorce/blob/main/notification/src/main/java/com/ganchevdimitarg/notification/service/EmailService.java): `notification/src/main/java/com/ganchevdimitarg/notification/service/EmailService.java`
- [Notification dedupe](https://github.com/ganchevdimitarg/e-commorce/blob/main/notification/src/main/java/com/ganchevdimitarg/notification/service/IdempotencyService.java): `notification/src/main/java/com/ganchevdimitarg/notification/service/IdempotencyService.java`

### Platform infrastructure

- [Service discovery](https://github.com/ganchevdimitarg/e-commorce/blob/main/eureka-server/src/main/java/com/ganchevdimitarg/EurekaServerApplication.java): `eureka-server/src/main/java/com/ganchevdimitarg/EurekaServerApplication.java`
- **Message broker**
- **Redis**

### Other components

- **Client user**

## Connections

- Client user → API gateway: sends requests
- API gateway → Authentication: routes requests
- API gateway → Product catalog: routes requests
- API gateway → Order API: routes requests
- API gateway → Payment processing: routes requests
- API gateway → Profile API: routes requests
- Account lifecycle → User event outbox: writes events (evidence: `authentication/src/main/java/com/ganchevdimitarg/auth/service/AccountService.java`)
- Order API → Order management: calls (evidence: `order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java`)
- Order API → Order idempotency: guards mutations (evidence: `order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java`)
- Order API → Order management: requests lifecycle changes (evidence: `order/src/main/java/com/ganchevdimitarg/order/controller/OrderController.java`)
- Order management → Order lifecycle: uses transitions (evidence: `order/src/main/java/com/ganchevdimitarg/order/service/OrderService.java`)
- Profile API → Profile service: calls (evidence: `profile/src/main/java/com/ganchevdimitarg/profile/controller/ProfileController.java`)
- Profile service → Payment processing: fetches card reference (evidence: `profile/src/main/java/com/ganchevdimitarg/profile/service/ProfileService.java`)
- Notification consumer → Email delivery: sends email (evidence: `notification/src/main/java/com/ganchevdimitarg/notification/listener/KafkaListenerService.java`)
- Notification consumer → Notification dedupe: deduplicates events (evidence: `notification/src/main/java/com/ganchevdimitarg/notification/listener/KafkaListenerService.java`)
- User event outbox → Message broker: publishes events
- Message broker → Notification consumer: delivers events
- Order idempotency → Redis: stores replay results (evidence: `order/src/main/java/com/ganchevdimitarg/order/service/IdempotencyService.java`)
- Notification dedupe → Redis: claims event keys (evidence: `notification/src/main/java/com/ganchevdimitarg/notification/service/IdempotencyService.java`)
- Product operations → Product catalog: serves catalog operations (evidence: `catalog/src/main/java/com/ganchevdimitarg/catalog/service/product/ProductService.java`)
- Category operations → Product catalog: serves category operations (evidence: `catalog/src/main/java/com/ganchevdimitarg/catalog/service/category/CategoryService.java`)
- Product comments → Product catalog: serves comment operations (evidence: `catalog/src/main/java/com/ganchevdimitarg/catalog/service/comment/CommentService.java`)
- Client user → Service discovery: discovers services
