How dhruv-techdev/shopsphere-microservices-e-commerce works
ShopSphere is a Java microservices e-commerce backend. A client enters through the API gateway, registers or logs in for a JWT, browses the catalog, manages a cart, and submits an order. Order creation validates cart and product data, checks inventory, persists a pending order, and clears the cart; Kafka then supports payment, stock updates, and notifications. The README documents discovery, centralized configuration, PostgreSQL, and Redis. Sampled excerpts confirm several service-level calls and event handlers; unsampled wiring is represented only where the README explicitly describes it.
Main entry points: ApiGatewayApplication.java API gateway · OrderService.java Order lifecycle · Topics.java Kafka events · InventoryService.java Stock management
Components 21
API and Identity
- API gateway
shopsphere/api-gateway/src/main/java/com/shopsphere/gateway/ApiGatewayApplication.java - JWT filter
shopsphere/api-gateway/src/main/java/com/shopsphere/gateway/filter/JwtAuthenticationFilter.java - User and auth
shopsphere/user-service/src/main/java/com/shopsphere/userservice/service/AuthService.java
Commerce Services
- Catalog and search
shopsphere/product-service/src/main/java/com/shopsphere/productservice/service/ProductService.java - Categories
shopsphere/product-service/src/main/java/com/shopsphere/productservice/service/CategoryService.java - Cart operations
shopsphere/cart-service/src/main/java/com/shopsphere/cartservice/service/CartService.java - Order lifecycle
shopsphere/order-service/src/main/java/com/shopsphere/orderservice/service/OrderService.java
Fulfillment Events
- Stock management
shopsphere/inventory-service/src/main/java/com/shopsphere/inventoryservice/service/InventoryService.java - Payment simulation
shopsphere/payment-service/src/main/java/com/shopsphere/paymentservice/service/PaymentService.java - Notifications
shopsphere/notification-service/src/main/java/com/shopsphere/notificationservice/service/NotificationService.java
Platform Infrastructure
- Cart store
shopsphere/cart-service/src/main/java/com/shopsphere/cartservice/repository/CartRepository.java - Order store
shopsphere/order-service/src/main/java/com/shopsphere/orderservice/repository/OrderRepository.java - Inventory store
shopsphere/inventory-service/src/main/java/com/shopsphere/inventoryservice/repository/InventoryRepository.java - Payment store
shopsphere/payment-service/src/main/java/com/shopsphere/paymentservice/repository/PaymentRepository.java - Notification store
shopsphere/notification-service/src/main/java/com/shopsphere/notificationservice/repository/NotificationRepository.java - Kafka events
shopsphere/common-lib/src/main/java/com/shopsphere/common/events/Topics.java - Eureka registry
shopsphere/service-registry/src/main/java/com/shopsphere/registry/ServiceRegistryApplication.java - Config server
shopsphere/config-service/src/main/java/com/shopsphere/configservice/ConfigServiceApplication.java - Catalog store
shopsphere/product-service/src/main/java/com/shopsphere/productservice/repository/ProductRepository.java - User store
shopsphere/user-service/src/main/java/com/shopsphere/userservice/repository/UserRepository.java
Other components
- Frontend client
Connections 29
- Frontend client → API gateway: sends requests
- API gateway → JWT filter: validates protected routes
- API gateway → User and auth: routes auth requests
- API gateway → Catalog and search: routes catalog requests
- API gateway → Cart operations: routes cart requests
- API gateway → Order lifecycle: routes order requests
- API gateway → Stock management: routes stock requests
- API gateway → Payment simulation: routes payment requests
- API gateway → Notifications: routes notification requests
- User and auth → User store: reads and writes users
- Catalog and search → Catalog store: reads and writes catalog
- Categories → Catalog and search: supports catalog categories
- Cart operations → Catalog and search: fetches product details
- Cart operations → Cart store: reads and writes carts
- Order lifecycle → Cart operations: fetches and clears cart
- Order lifecycle → Catalog and search: fetches product details
- Order lifecycle → Stock management: checks availability
- Order lifecycle → Order store: persists and reads orders
- Order lifecycle → Kafka events: publishes order events
- Kafka events → Stock management: delivers order and payment events
- Kafka events → Payment simulation: delivers order events
- Payment simulation → Payment store: reads and writes payments
- Payment simulation → Kafka events: publishes payment outcomes
- Kafka events → Notifications: delivers order and payment events
- Notifications → Notification store: checks and stores notifications
- Stock management → Inventory store: reads and writes stock
- Stock management → Kafka events: publishes stock events
- Eureka registry → API gateway: supports service discovery
- Config server → API gateway: provides configuration