# jhansimahanthi/e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/jhansimahanthi/e-commerce
- Repository: https://github.com/jhansimahanthi/e-commerce

## Overview

This is a full-stack e-commerce platform: customers browse and manage carts, check out, pay, and track orders; administrators manage catalog, stock, orders, and payments. Angular routes through a JWT-validating API gateway to independently persisted services, while Kafka supports asynchronous order, payment, inventory, and notification events. The README documents the system-wide communication patterns; sampled source confirms selected controller-to-service and service-to-repository responsibilities. Other detailed service internals and frontend-to-API calls were not sampled, so those links are documented at architecture level.

Main entry points: [`api-gateway/src/main/java/com/ecommerce/gateway/ApiGatewayApplication.java`](https://github.com/jhansimahanthi/e-commerce/blob/main/api-gateway/src/main/java/com/ecommerce/gateway/ApiGatewayApplication.java) (API gateway), [`order-service/src/main/java/com/ecommerce/order/service/OrderService.java`](https://github.com/jhansimahanthi/e-commerce/blob/main/order-service/src/main/java/com/ecommerce/order/service/OrderService.java) (Cart and order lifecycle), [`inventory-service/src/main/java/com/ecommerce/inventory/service/InventoryService.java`](https://github.com/jhansimahanthi/e-commerce/blob/main/inventory-service/src/main/java/com/ecommerce/inventory/service/InventoryService.java) (Inventory management), [`frontend/src/app/components`](https://github.com/jhansimahanthi/e-commerce/tree/main/frontend/src/app/components) (Angular storefront)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Customer and Admin UI"]
  node_frontend["Angular storefront"]
  node_adminui["Admin dashboard"]
  node_routes["Route configuration<br/>[app.routes.ts]"]
end

subgraph group_edge["Gateway and Identity"]
  node_gateway["API gateway"]
  node_jwt["JWT filter"]
end

subgraph group_commerce["Commerce Services"]
  node_users["User and auth<br/>[UserService.java]"]
  node_products["Products and categories"]
  node_productapi["Product endpoints"]
  node_inventory["Inventory management"]
  node_orders["Cart and order lifecycle<br/>[OrderService.java]"]
  node_orderapi["Order endpoints"]
  node_payments["Payment processing"]
  node_notifications["Notifications"]
end

subgraph group_events["Event Messaging"]
  node_kafka["Kafka topics"]
end

subgraph group_state["Service Persistence"]
  node_userdb[("User database")]
  node_productdb[("Product database")]
  node_inventorydb[("Inventory database")]
  node_orderdb[("Order database")]
  node_paymentdb[("Payment database")]
  node_notificationdb[("Notification database")]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"shops through"| node_frontend
node_admin -->|"manages through"| node_adminui
node_frontend -->|"uses routes"| node_routes
node_adminui -->|"uses routes"| node_routes
node_frontend -->|"sends REST requests"| node_gateway
node_adminui -->|"sends REST requests"| node_gateway
node_gateway -->|"validates tokens"| node_jwt
node_jwt -->|"validates JWT"| node_users
node_gateway -->|"routes requests"| node_users
node_gateway -->|"routes requests"| node_products
node_gateway -->|"routes requests"| node_inventory
node_gateway -->|"routes requests"| node_orders
node_gateway -->|"routes requests"| node_payments
node_gateway -->|"routes requests"| node_notifications
node_productapi -->|"delegates to"| node_products
node_orderapi -->|"delegates to"| node_orders
node_users -->|"persists users"| node_userdb
node_products -->|"persists catalog"| node_productdb
node_inventory -->|"persists stock"| node_inventorydb
node_orders -->|"persists carts and orders"| node_orderdb
node_payments -->|"persists payments"| node_paymentdb
node_notifications -->|"persists notifications"| node_notificationdb
node_orders -->|"publishes order events"| node_kafka
node_payments -->|"publishes payment events"| node_kafka
node_inventory -->|"publishes stock events"| node_kafka
node_kafka -->|"dispatches order events"| node_inventory
node_kafka -->|"dispatches payment events"| node_orders
node_kafka -->|"dispatches service events"| node_notifications

click node_frontend "https://github.com/jhansimahanthi/e-commerce/tree/main/frontend/src/app/components"
click node_adminui "https://github.com/jhansimahanthi/e-commerce/tree/main/frontend/src/app/components/admin"
click node_routes "https://github.com/jhansimahanthi/e-commerce/blob/main/frontend/src/app/app.routes.ts"
click node_gateway "https://github.com/jhansimahanthi/e-commerce/blob/main/api-gateway/src/main/java/com/ecommerce/gateway/ApiGatewayApplication.java"
click node_jwt "https://github.com/jhansimahanthi/e-commerce/blob/main/api-gateway/src/main/java/com/ecommerce/gateway/JwtAuthenticationFilter.java"
click node_users "https://github.com/jhansimahanthi/e-commerce/blob/main/user-service/src/main/java/com/ecommerce/user/service/UserService.java"
click node_products "https://github.com/jhansimahanthi/e-commerce/blob/main/product-service/src/main/java/com/ecommerce/product/service/ProductService.java"
click node_productapi "https://github.com/jhansimahanthi/e-commerce/blob/main/product-service/src/main/java/com/ecommerce/product/controller/ProductController.java"
click node_inventory "https://github.com/jhansimahanthi/e-commerce/blob/main/inventory-service/src/main/java/com/ecommerce/inventory/service/InventoryService.java"
click node_orders "https://github.com/jhansimahanthi/e-commerce/blob/main/order-service/src/main/java/com/ecommerce/order/service/OrderService.java"
click node_orderapi "https://github.com/jhansimahanthi/e-commerce/blob/main/order-service/src/main/java/com/ecommerce/order/controller/OrderController.java"
click node_payments "https://github.com/jhansimahanthi/e-commerce/blob/main/payment-service/src/main/java/com/ecommerce/payment/service/PaymentService.java"
click node_notifications "https://github.com/jhansimahanthi/e-commerce/blob/main/notification-service/src/main/java/com/ecommerce/notification/service/NotificationService.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_frontend,node_adminui,node_routes toneBlue
class node_gateway,node_jwt toneAmber
class node_users,node_products,node_productapi,node_inventory,node_orders,node_orderapi,node_payments,node_notifications toneMint
class node_kafka toneRose
class node_userdb,node_productdb,node_inventorydb,node_orderdb,node_paymentdb,node_notificationdb,node_customer,node_admin toneIndigo
```

## Components

### Customer and Admin UI

- [Angular storefront](https://github.com/jhansimahanthi/e-commerce/tree/main/frontend/src/app/components): `frontend/src/app/components`
- [Admin dashboard](https://github.com/jhansimahanthi/e-commerce/tree/main/frontend/src/app/components/admin): `frontend/src/app/components/admin`
- [Route configuration](https://github.com/jhansimahanthi/e-commerce/blob/main/frontend/src/app/app.routes.ts): `frontend/src/app/app.routes.ts`

### Gateway and Identity

- [API gateway](https://github.com/jhansimahanthi/e-commerce/blob/main/api-gateway/src/main/java/com/ecommerce/gateway/ApiGatewayApplication.java): `api-gateway/src/main/java/com/ecommerce/gateway/ApiGatewayApplication.java`
- [JWT filter](https://github.com/jhansimahanthi/e-commerce/blob/main/api-gateway/src/main/java/com/ecommerce/gateway/JwtAuthenticationFilter.java): `api-gateway/src/main/java/com/ecommerce/gateway/JwtAuthenticationFilter.java`

### Commerce Services

- [User and auth](https://github.com/jhansimahanthi/e-commerce/blob/main/user-service/src/main/java/com/ecommerce/user/service/UserService.java): `user-service/src/main/java/com/ecommerce/user/service/UserService.java`
- [Products and categories](https://github.com/jhansimahanthi/e-commerce/blob/main/product-service/src/main/java/com/ecommerce/product/service/ProductService.java): `product-service/src/main/java/com/ecommerce/product/service/ProductService.java`
- [Product endpoints](https://github.com/jhansimahanthi/e-commerce/blob/main/product-service/src/main/java/com/ecommerce/product/controller/ProductController.java): `product-service/src/main/java/com/ecommerce/product/controller/ProductController.java`
- [Inventory management](https://github.com/jhansimahanthi/e-commerce/blob/main/inventory-service/src/main/java/com/ecommerce/inventory/service/InventoryService.java): `inventory-service/src/main/java/com/ecommerce/inventory/service/InventoryService.java`
- [Cart and order lifecycle](https://github.com/jhansimahanthi/e-commerce/blob/main/order-service/src/main/java/com/ecommerce/order/service/OrderService.java): `order-service/src/main/java/com/ecommerce/order/service/OrderService.java`
- [Order endpoints](https://github.com/jhansimahanthi/e-commerce/blob/main/order-service/src/main/java/com/ecommerce/order/controller/OrderController.java): `order-service/src/main/java/com/ecommerce/order/controller/OrderController.java`
- [Payment processing](https://github.com/jhansimahanthi/e-commerce/blob/main/payment-service/src/main/java/com/ecommerce/payment/service/PaymentService.java): `payment-service/src/main/java/com/ecommerce/payment/service/PaymentService.java`
- [Notifications](https://github.com/jhansimahanthi/e-commerce/blob/main/notification-service/src/main/java/com/ecommerce/notification/service/NotificationService.java): `notification-service/src/main/java/com/ecommerce/notification/service/NotificationService.java`

### Event Messaging

- **Kafka topics**

### Service Persistence

- **User database**
- **Product database**
- **Inventory database**
- **Order database**
- **Payment database**
- **Notification database**

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Angular storefront: shops through
- Administrator → Admin dashboard: manages through
- Angular storefront → Route configuration: uses routes (evidence: `frontend/src/app/app.routes.ts`)
- Admin dashboard → Route configuration: uses routes (evidence: `frontend/src/app/app.routes.ts`)
- Angular storefront → API gateway: sends REST requests
- Admin dashboard → API gateway: sends REST requests
- API gateway → JWT filter: validates tokens
- JWT filter → User and auth: validates JWT
- API gateway → User and auth: routes requests
- API gateway → Products and categories: routes requests
- API gateway → Inventory management: routes requests
- API gateway → Cart and order lifecycle: routes requests
- API gateway → Payment processing: routes requests
- API gateway → Notifications: routes requests
- Product endpoints → Products and categories: delegates to (evidence: `product-service/src/main/java/com/ecommerce/product/controller/ProductController.java`)
- Order endpoints → Cart and order lifecycle: delegates to (evidence: `order-service/src/main/java/com/ecommerce/order/controller/OrderController.java`)
- User and auth → User database: persists users
- Products and categories → Product database: persists catalog
- Inventory management → Inventory database: persists stock
- Cart and order lifecycle → Order database: persists carts and orders
- Payment processing → Payment database: persists payments
- Notifications → Notification database: persists notifications
- Cart and order lifecycle → Kafka topics: publishes order events
- Payment processing → Kafka topics: publishes payment events
- Inventory management → Kafka topics: publishes stock events
- Kafka topics → Inventory management: dispatches order events
- Kafka topics → Cart and order lifecycle: dispatches payment events
- Kafka topics → Notifications: dispatches service events
