# abdelrahmanmohy98/e-commerce-microservices architecture

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

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

## Overview

This repository is an ASP.NET Core e-commerce microservices system. Its principal workflow routes a shopper’s API request through the gateway to a service that performs a domain operation and returns a response; order, inventory, and payment capabilities also support asynchronous processing. The graph preserves the major documented service areas and shared messaging/cross-cutting layer. Several service interactions are described only in the README, so those links are dashed; sampled source confirms selected query, persistence, and HTTP call paths.

Main entry points: [`src/ApiGateWay/ApiGateWay.Api/Program.cs`](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/ApiGateWay/ApiGateWay.Api/Program.cs) (API Gateway), [`src/InventoryService/InventoryService.Api/Controllers/InventoryController.cs`](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/InventoryService/InventoryService.Api/Controllers/InventoryController.cs) (Stock management), [`src/PaymentService/Payment.Api/Controllers/PaymentsController.cs`](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/PaymentService/Payment.Api/Controllers/PaymentsController.cs) (Payments), [`src/SharedService/Shared/Bases/ResponseHandler.cs`](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/Bases/ResponseHandler.cs) (Shared responses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_gateway["API Gateway<br/>[Program.cs]"]
end

subgraph group_commerce["Commerce services"]
  node_product["Product catalog"]
  node_product_app["Product queries"]
  node_inventory["Stock management"]
  node_inventory_app["Stock queries"]
  node_cart["Shopping cart<br/>[CartsController.cs]"]
  node_cart_app["Cart queries"]
  node_order["Order processing"]
  node_payment["Payments"]
  node_wishlist["Wishlists"]
  node_wishlist_app["Wishlist queries"]
end

subgraph group_identity["Identity service"]
  node_auth["Authentication"]
  node_auth_app["Identity workflows<br/>[AuthHandler.cs]"]
  node_auth_infra["Auth integrations<br/>[JwtService.cs]"]
end

subgraph group_platform["Shared platform"]
  node_messaging["Message broker"]
  node_shared["Shared responses<br/>[ResponseHandler.cs]"]
  node_redis[("Redis cache<br/>[CacheService.cs]")]
  node_sql[("Service databases<br/>[BaseDbContext.cs]")]
end

node_shopper(("Client"))
node_google(("Google login"))
node_email["Email service"]
node_payment_gateway["Payment provider"]

node_shopper -.->|"sends requests"| node_gateway
node_gateway -.->|"routes requests"| node_product
node_gateway -.->|"routes requests"| node_cart
node_gateway -.->|"routes requests"| node_order
node_gateway -.->|"routes requests"| node_inventory
node_gateway -.->|"routes requests"| node_payment
node_gateway -.->|"routes requests"| node_wishlist
node_gateway -.->|"routes requests"| node_auth
node_product -.->|"dispatches queries"| node_product_app
node_product_app -->|"requests stock"| node_inventory
node_inventory -.->|"dispatches queries"| node_inventory_app
node_inventory_app -.->|"reads stock"| node_sql
node_cart -.->|"dispatches queries"| node_cart_app
node_cart_app -.->|"reads carts"| node_sql
node_order -.->|"validates payment"| node_payment
node_order -.->|"publishes events"| node_messaging
node_payment -.->|"publishes results"| node_messaging
node_payment -.->|"processes transactions"| node_payment_gateway
node_inventory -.->|"subscribes events"| node_messaging
node_wishlist -->|"dispatches queries"| node_wishlist_app
node_wishlist_app -.->|"reads wishlists"| node_sql
node_wishlist -.->|"uses cache"| node_redis
node_auth -->|"dispatches commands"| node_auth_app
node_auth_app -.->|"uses auth services"| node_auth_infra
node_auth_app -.->|"sends email"| node_email
node_google -.->|"authenticates"| node_auth
node_shared -.->|"formats responses"| node_product_app
node_shared -.->|"formats responses"| node_inventory_app
node_shared -.->|"formats responses"| node_wishlist_app

click node_gateway "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/ApiGateWay/ApiGateWay.Api/Program.cs"
click node_product "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/ProductService/ProductService.Api/Controllers/ProductsController.cs"
click node_product_app "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/ProductService/ProductService.Application/Handlers/ProductQueryHandler.cs"
click node_inventory "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/InventoryService/InventoryService.Api/Controllers/InventoryController.cs"
click node_inventory_app "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/InventoryService/InventoryService.Application/Handlers/InventoryQueryHandler.cs"
click node_cart "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/CartService/CartService.Api/Controllers/CartsController.cs"
click node_cart_app "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/CartService/CartService.Application/Handlers/CartQueryHandler.cs"
click node_order "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/OrderService/OrderService.Api/Controllers/OrdersController.cs"
click node_payment "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/PaymentService/Payment.Api/Controllers/PaymentsController.cs"
click node_wishlist "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/WishListService/WishlistService.Api/Controllers/WishlistsController.cs"
click node_wishlist_app "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/WishListService/WishlistService.Application/Handlers/WishlistQueryHandler.cs"
click node_auth "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/AuthService/Auth.Api/Controllers/AccountController.cs"
click node_auth_app "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/AuthService/Auth.Application/Handlers/AuthHandler.cs"
click node_auth_infra "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/AuthService/Auth.Infrastructure/Services/JwtService.cs"
click node_messaging "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/Messaging/RabbitMQMessageBroker.cs"
click node_shared "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/Bases/ResponseHandler.cs"
click node_redis "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/RedisCache/CacheService.cs"
click node_sql "https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/BaseDbContext.cs"

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_shopper toneBlue
class node_product,node_product_app,node_inventory,node_inventory_app,node_cart,node_cart_app,node_order,node_payment,node_wishlist,node_wishlist_app toneAmber
class node_auth,node_auth_app,node_auth_infra toneMint
class node_messaging,node_shared,node_redis,node_sql toneRose
class node_google,node_email,node_payment_gateway toneIndigo
```

## Components

### API entry

- [API Gateway](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/ApiGateWay/ApiGateWay.Api/Program.cs): `src/ApiGateWay/ApiGateWay.Api/Program.cs`

### Commerce services

- [Product catalog](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/ProductService/ProductService.Api/Controllers/ProductsController.cs): `src/ProductService/ProductService.Api/Controllers/ProductsController.cs`
- [Product queries](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/ProductService/ProductService.Application/Handlers/ProductQueryHandler.cs): `src/ProductService/ProductService.Application/Handlers/ProductQueryHandler.cs`
- [Stock management](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/InventoryService/InventoryService.Api/Controllers/InventoryController.cs): `src/InventoryService/InventoryService.Api/Controllers/InventoryController.cs`
- [Stock queries](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/InventoryService/InventoryService.Application/Handlers/InventoryQueryHandler.cs): `src/InventoryService/InventoryService.Application/Handlers/InventoryQueryHandler.cs`
- [Shopping cart](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/CartService/CartService.Api/Controllers/CartsController.cs): `src/CartService/CartService.Api/Controllers/CartsController.cs`
- [Cart queries](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/CartService/CartService.Application/Handlers/CartQueryHandler.cs): `src/CartService/CartService.Application/Handlers/CartQueryHandler.cs`
- [Order processing](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/OrderService/OrderService.Api/Controllers/OrdersController.cs): `src/OrderService/OrderService.Api/Controllers/OrdersController.cs`
- [Payments](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/PaymentService/Payment.Api/Controllers/PaymentsController.cs): `src/PaymentService/Payment.Api/Controllers/PaymentsController.cs`
- [Wishlists](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/WishListService/WishlistService.Api/Controllers/WishlistsController.cs): `src/WishListService/WishlistService.Api/Controllers/WishlistsController.cs`
- [Wishlist queries](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/WishListService/WishlistService.Application/Handlers/WishlistQueryHandler.cs): `src/WishListService/WishlistService.Application/Handlers/WishlistQueryHandler.cs`

### Identity service

- [Authentication](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/AuthService/Auth.Api/Controllers/AccountController.cs): `src/AuthService/Auth.Api/Controllers/AccountController.cs`
- [Identity workflows](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/AuthService/Auth.Application/Handlers/AuthHandler.cs): `src/AuthService/Auth.Application/Handlers/AuthHandler.cs`
- [Auth integrations](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/AuthService/Auth.Infrastructure/Services/JwtService.cs): `src/AuthService/Auth.Infrastructure/Services/JwtService.cs`

### Shared platform

- [Message broker](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/Messaging/RabbitMQMessageBroker.cs): `src/SharedService/Shared/Messaging/RabbitMQMessageBroker.cs`
- [Shared responses](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/Bases/ResponseHandler.cs): `src/SharedService/Shared/Bases/ResponseHandler.cs`
- [Redis cache](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/RedisCache/CacheService.cs): `src/SharedService/Shared/RedisCache/CacheService.cs`
- [Service databases](https://github.com/abdelrahmanmohy98/e-commerce-microservices/blob/main/src/SharedService/Shared/BaseDbContext.cs): `src/SharedService/Shared/BaseDbContext.cs`

### Other components

- **Client**
- **Google login**
- **Email service**
- **Payment provider**

## Connections

- Client → API Gateway: sends requests
- API Gateway → Product catalog: routes requests
- API Gateway → Shopping cart: routes requests
- API Gateway → Order processing: routes requests
- API Gateway → Stock management: routes requests
- API Gateway → Payments: routes requests
- API Gateway → Wishlists: routes requests
- API Gateway → Authentication: routes requests
- Product catalog → Product queries: dispatches queries
- Product queries → Stock management: requests stock (evidence: `src/ProductService/ProductService.Application/Handlers/ProductQueryHandler.cs`)
- Stock management → Stock queries: dispatches queries
- Stock queries → Service databases: reads stock
- Shopping cart → Cart queries: dispatches queries
- Cart queries → Service databases: reads carts
- Order processing → Payments: validates payment
- Order processing → Message broker: publishes events
- Payments → Message broker: publishes results
- Payments → Payment provider: processes transactions
- Stock management → Message broker: subscribes events
- Wishlists → Wishlist queries: dispatches queries (evidence: `src/WishListService/WishlistService.Api/Controllers/WishlistsController.cs`)
- Wishlist queries → Service databases: reads wishlists
- Wishlists → Redis cache: uses cache
- Authentication → Identity workflows: dispatches commands (evidence: `src/AuthService/Auth.Api/Controllers/AccountController.cs`)
- Identity workflows → Auth integrations: uses auth services
- Identity workflows → Email service: sends email
- Google login → Authentication: authenticates
- Shared responses → Product queries: formats responses (evidence: `src/ProductService/ProductService.Application/Handlers/ProductQueryHandler.cs`)
- Shared responses → Stock queries: formats responses (evidence: `src/InventoryService/InventoryService.Application/Handlers/InventoryQueryHandler.cs`)
- Shared responses → Wishlist queries: formats responses (evidence: `src/WishListService/WishlistService.Application/Handlers/WishlistQueryHandler.cs`)
