# rafeysyed/ecom-springb architecture

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

- Interactive diagram: https://gitdiagram.com/rafeysyed/ecom-springb
- Repository: https://github.com/rafeysyed/ecom-springb

## Overview

This repository is an event-driven e-commerce system with a React storefront and Spring microservices. A customer browses products, authenticates, builds a cart, and places an order; the order service validates product and user data, reserves inventory, and starts payment through Kafka. Payment outcomes return asynchronously to update order status, with notifications dispatched from order-status events. The graph also preserves administration, recommendations, OAuth, and service discovery. README documentation establishes the broader architecture; sampled source confirms selected service calls and processing details, so uncertain internal wiring is omitted.

Main entry points: [`gatewayservice/src/main/java/com/project/gatewayservice/filter/JwtAuthenticationFilter.java`](https://github.com/rafeysyed/ecom-springb/blob/main/gatewayservice/src/main/java/com/project/gatewayservice/filter/JwtAuthenticationFilter.java) (API Gateway), [`orderservice/src/main/java/com/project/orderservice/service/OrderService.java`](https://github.com/rafeysyed/ecom-springb/blob/main/orderservice/src/main/java/com/project/orderservice/service/OrderService.java) (Order Management), [`userservice/src/main/java/com/project/userservice/service/UserService.java`](https://github.com/rafeysyed/ecom-springb/blob/main/userservice/src/main/java/com/project/userservice/service/UserService.java) (User And Cart), [`frontend/src/App.tsx`](https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/App.tsx) (React Storefront)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_frontend["React Storefront<br/>[App.tsx]"]
  node_frontend_api["API Client<br/>[client.ts]"]
  node_catalog_ui["Catalog And Cart<br/>[useProducts.ts]"]
  node_checkout_ui["Checkout And Orders<br/>[usePlaceOrder.ts]"]
  node_auth_ui["Login And Profile<br/>[useLogin.ts]"]
  node_admin_ui["Admin Tools<br/>[admin.ts]"]
end

subgraph group_edge_identity["Edge And Identity"]
  node_gateway["API Gateway"]
  node_auth["Authentication<br/>[AuthService.java]"]
end

subgraph group_commerce["Commerce Services"]
  node_user["User And Cart<br/>[UserService.java]"]
  node_product["Product Catalog"]
  node_inventory["Stock Reservations"]
  node_order["Order Management<br/>[OrderService.java]"]
  node_payment["Payment Processing"]
  node_notifications["Notifications"]
end

subgraph group_events_state["Events And State"]
  node_kafka["Kafka"]
  node_outbox["Payment Outbox"]
  node_databases[("PostgreSQL Data")]
  node_redis[("Redis Cache")]
end

subgraph group_discovery_recommendations["Discovery And Recommendations"]
  node_discovery["Service Discovery"]
  node_recommendations["Recommendations"]
end

node_shopper(("Shopper"))
node_google_github(("OAuth Providers"))

node_shopper -->|"uses"| node_frontend
node_frontend -->|"requests"| node_frontend_api
node_frontend_api -->|"routes API"| node_gateway
node_frontend -->|"browses"| node_catalog_ui
node_frontend -->|"checks out"| node_checkout_ui
node_frontend -->|"signs in"| node_auth_ui
node_frontend -->|"administers"| node_admin_ui
node_gateway -->|"routes auth"| node_auth
node_gateway -->|"routes user"| node_user
node_gateway -->|"routes catalog"| node_product
node_gateway -->|"routes orders"| node_order
node_gateway -->|"routes payments"| node_payment
node_gateway -->|"routes stock"| node_inventory
node_gateway -.->|"routes recommendations"| node_recommendations
node_auth -->|"looks up user"| node_user
node_user -->|"creates credentials"| node_auth
node_auth -->|"stores credentials"| node_databases
node_order -->|"fetches product"| node_product
node_order -->|"validates user"| node_user
node_order -->|"reserves stock"| node_inventory
node_order -->|"stores orders"| node_databases
node_order -->|"publishes order event"| node_kafka
node_kafka -->|"delivers order event"| node_payment
node_payment -->|"stores payment"| node_databases
node_payment -->|"records event"| node_outbox
node_outbox -->|"publishes outcome"| node_kafka
node_kafka -->|"delivers payment outcome"| node_order
node_order -->|"publishes status event"| node_kafka
node_kafka -->|"delivers status event"| node_user
node_user -->|"creates notification"| node_notifications
node_notifications -->|"stores notification"| node_databases
node_notifications -->|"reads user details"| node_user
node_product -->|"caches catalog"| node_redis
node_recommendations -->|"fetches products"| node_product
node_recommendations -->|"caches recommendations"| node_redis
node_auth_ui -.->|"authenticates with"| node_google_github
node_auth -.->|"exchanges OAuth code"| node_google_github
node_gateway -.->|"resolves services"| node_discovery

click node_frontend "https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/App.tsx"
click node_frontend_api "https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/api/client.ts"
click node_catalog_ui "https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/products/hooks/useProducts.ts"
click node_checkout_ui "https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/orders/hooks/usePlaceOrder.ts"
click node_auth_ui "https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/auth/hooks/useLogin.ts"
click node_admin_ui "https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/admin/api/admin.ts"
click node_gateway "https://github.com/rafeysyed/ecom-springb/blob/main/gatewayservice/src/main/java/com/project/gatewayservice/filter/JwtAuthenticationFilter.java"
click node_auth "https://github.com/rafeysyed/ecom-springb/blob/main/authservice/src/main/java/com/project/authservice/service/AuthService.java"
click node_user "https://github.com/rafeysyed/ecom-springb/blob/main/userservice/src/main/java/com/project/userservice/service/UserService.java"
click node_product "https://github.com/rafeysyed/ecom-springb/blob/main/productservice/src/main/java/com/project/productservice/service/ProductService.java"
click node_inventory "https://github.com/rafeysyed/ecom-springb/blob/main/inventoryservice/src/main/java/com/project/inventoryservice/service/InventoryService.java"
click node_order "https://github.com/rafeysyed/ecom-springb/blob/main/orderservice/src/main/java/com/project/orderservice/service/OrderService.java"
click node_payment "https://github.com/rafeysyed/ecom-springb/blob/main/paymentservice/src/main/java/com/project/paymentservice/service/PaymentService.java"
click node_notifications "https://github.com/rafeysyed/ecom-springb/blob/main/userservice/src/main/java/com/project/userservice/service/NotificationService.java"
click node_outbox "https://github.com/rafeysyed/ecom-springb/blob/main/paymentservice/src/main/java/com/project/paymentservice/service/OutboxPublisher.java"
click node_discovery "https://github.com/rafeysyed/ecom-springb/blob/main/servicediscovery/src/main/java/com/project/servicediscovery/ServicediscoveryApplication.java"
click node_recommendations "https://github.com/rafeysyed/ecom-springb/blob/main/recommendationservice/src/main/java/com/project/recommendationservice/service/RecommendationService.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_frontend_api,node_catalog_ui,node_checkout_ui,node_auth_ui,node_admin_ui toneBlue
class node_gateway,node_auth toneAmber
class node_user,node_product,node_inventory,node_order,node_payment,node_notifications toneMint
class node_kafka,node_outbox,node_databases,node_redis toneRose
class node_discovery,node_recommendations,node_shopper,node_google_github toneIndigo
```

## Components

### Storefront

- [React Storefront](https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Catalog And Cart](https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/products/hooks/useProducts.ts): `frontend/src/features/products/hooks/useProducts.ts`
- [Checkout And Orders](https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/orders/hooks/usePlaceOrder.ts): `frontend/src/features/orders/hooks/usePlaceOrder.ts`
- [Login And Profile](https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/auth/hooks/useLogin.ts): `frontend/src/features/auth/hooks/useLogin.ts`
- [Admin Tools](https://github.com/rafeysyed/ecom-springb/blob/main/frontend/src/features/admin/api/admin.ts): `frontend/src/features/admin/api/admin.ts`

### Edge And Identity

- [API Gateway](https://github.com/rafeysyed/ecom-springb/blob/main/gatewayservice/src/main/java/com/project/gatewayservice/filter/JwtAuthenticationFilter.java): `gatewayservice/src/main/java/com/project/gatewayservice/filter/JwtAuthenticationFilter.java`
- [Authentication](https://github.com/rafeysyed/ecom-springb/blob/main/authservice/src/main/java/com/project/authservice/service/AuthService.java): `authservice/src/main/java/com/project/authservice/service/AuthService.java`

### Commerce Services

- [User And Cart](https://github.com/rafeysyed/ecom-springb/blob/main/userservice/src/main/java/com/project/userservice/service/UserService.java): `userservice/src/main/java/com/project/userservice/service/UserService.java`
- [Product Catalog](https://github.com/rafeysyed/ecom-springb/blob/main/productservice/src/main/java/com/project/productservice/service/ProductService.java): `productservice/src/main/java/com/project/productservice/service/ProductService.java`
- [Stock Reservations](https://github.com/rafeysyed/ecom-springb/blob/main/inventoryservice/src/main/java/com/project/inventoryservice/service/InventoryService.java): `inventoryservice/src/main/java/com/project/inventoryservice/service/InventoryService.java`
- [Order Management](https://github.com/rafeysyed/ecom-springb/blob/main/orderservice/src/main/java/com/project/orderservice/service/OrderService.java): `orderservice/src/main/java/com/project/orderservice/service/OrderService.java`
- [Payment Processing](https://github.com/rafeysyed/ecom-springb/blob/main/paymentservice/src/main/java/com/project/paymentservice/service/PaymentService.java): `paymentservice/src/main/java/com/project/paymentservice/service/PaymentService.java`
- [Notifications](https://github.com/rafeysyed/ecom-springb/blob/main/userservice/src/main/java/com/project/userservice/service/NotificationService.java): `userservice/src/main/java/com/project/userservice/service/NotificationService.java`

### Events And State

- **Kafka**
- [Payment Outbox](https://github.com/rafeysyed/ecom-springb/blob/main/paymentservice/src/main/java/com/project/paymentservice/service/OutboxPublisher.java): `paymentservice/src/main/java/com/project/paymentservice/service/OutboxPublisher.java`
- **PostgreSQL Data**
- **Redis Cache**

### Discovery And Recommendations

- [Service Discovery](https://github.com/rafeysyed/ecom-springb/blob/main/servicediscovery/src/main/java/com/project/servicediscovery/ServicediscoveryApplication.java): `servicediscovery/src/main/java/com/project/servicediscovery/ServicediscoveryApplication.java`
- [Recommendations](https://github.com/rafeysyed/ecom-springb/blob/main/recommendationservice/src/main/java/com/project/recommendationservice/service/RecommendationService.java): `recommendationservice/src/main/java/com/project/recommendationservice/service/RecommendationService.java`

### Other components

- **Shopper**
- **OAuth Providers**

## Connections

- Shopper → React Storefront: uses
- React Storefront → API Client: requests
- API Client → API Gateway: routes API
- React Storefront → Catalog And Cart: browses
- React Storefront → Checkout And Orders: checks out
- React Storefront → Login And Profile: signs in
- React Storefront → Admin Tools: administers
- API Gateway → Authentication: routes auth
- API Gateway → User And Cart: routes user
- API Gateway → Product Catalog: routes catalog
- API Gateway → Order Management: routes orders
- API Gateway → Payment Processing: routes payments
- API Gateway → Stock Reservations: routes stock
- API Gateway → Recommendations: routes recommendations
- Authentication → User And Cart: looks up user
- User And Cart → Authentication: creates credentials
- Authentication → PostgreSQL Data: stores credentials
- Order Management → Product Catalog: fetches product
- Order Management → User And Cart: validates user
- Order Management → Stock Reservations: reserves stock
- Order Management → PostgreSQL Data: stores orders
- Order Management → Kafka: publishes order event
- Kafka → Payment Processing: delivers order event
- Payment Processing → PostgreSQL Data: stores payment
- Payment Processing → Payment Outbox: records event
- Payment Outbox → Kafka: publishes outcome
- Kafka → Order Management: delivers payment outcome
- Order Management → Kafka: publishes status event
- Kafka → User And Cart: delivers status event
- User And Cart → Notifications: creates notification
- Notifications → PostgreSQL Data: stores notification
- Notifications → User And Cart: reads user details
- Product Catalog → Redis Cache: caches catalog
- Recommendations → Product Catalog: fetches products
- Recommendations → Redis Cache: caches recommendations
- Login And Profile → OAuth Providers: authenticates with
- Authentication → OAuth Providers: exchanges OAuth code
- API Gateway → Service Discovery: resolves services
