How vinayak2006tech/shopsphere works
ShopSphere is a distributed e-commerce platform. A customer uses the React storefront to browse products, authenticate, manage a cart, and submit an order; the gateway routes requests to independent services. Order creation starts an asynchronous inventory-and-payment saga, while events also support notifications, search, recommendations, and review-driven catalog updates. The graph preserves README-documented capabilities where implementation excerpts are absent; dashed edges mark documented event relationships not directly shown in sampled caller code.
Main entry points: rabbitmq.ts RabbitMQ events · index.ts API gateway · product.controller.ts Product catalog · order.controller.ts Order handling
Components 20
Storefront
- React storefront
frontend/src/App.tsx - Auth state & UI
frontend/src/context/AuthContext.tsx - Storefront API
frontend/src/api.ts
Gateway
- API gateway
gateway/src/index.ts
Commerce Services
- Authentication
services/auth-service/src/auth.service.ts - Auth PostgreSQL
services/auth-service/src/db.ts - Product catalog
services/product-service/src/product.controller.ts - Product records
services/product-service/src/product.model.ts - Order handling
services/order-service/src/order.controller.ts - Order PostgreSQL
services/order-service/src/db.ts - Payment processing
services/payment-service/src/payment.service.ts - Payment ledger
services/payment-service/src/db.ts - Notifications & mail
services/notification-service/src/index.ts - SMTP mailer
services/notification-service/src/mailer.ts
Discovery & Trust
- Reviews & ratings
services/review-service/src/review.model.ts - Typo-tolerant search
services/search-service/src/search-index.ts - Recommendations
services/recommendation-service/main.py
Events & State
- Redis cache
services/product-service/src/redis.ts - RabbitMQ events
services/order-service/src/rabbitmq.ts
Other components
- Customer
Connections 30
- Customer → React storefront: browses and orders
- React storefront → Storefront API: requests data
frontend/src/App.tsx - React storefront → Auth state & UI: renders
frontend/src/App.tsx - Auth state & UI → Storefront API: authenticates via
frontend/src/context/AuthContext.tsx - Storefront API → API gateway: calls API
- API gateway → Authentication: proxies auth
gateway/src/index.ts - API gateway → Product catalog: proxies catalog
- API gateway → Order handling: proxies orders
gateway/src/index.ts - API gateway → Payment processing: proxies payments
- API gateway → Notifications & mail: proxies notifications
gateway/src/index.ts - API gateway → Reviews & ratings: proxies reviews
gateway/src/index.ts - API gateway → Typo-tolerant search: proxies search
- API gateway → Recommendations: proxies recommendations
- Authentication → Auth PostgreSQL: reads and writes
services/auth-service/src/auth.service.ts - Order handling → Order PostgreSQL: persists orders
services/order-service/src/order.controller.ts - Order handling → RabbitMQ events: publishes order.created
services/order-service/src/order.controller.ts - RabbitMQ events → Product catalog: delivers order events
- Product catalog → Product records: reads and updates
services/product-service/src/product.controller.ts - Product catalog → Redis cache: caches and invalidates
services/product-service/src/product.controller.ts - Product catalog → RabbitMQ events: publishes stock events
services/product-service/src/product.controller.ts - RabbitMQ events → Payment processing: delivers inventory events
- Payment processing → Payment ledger: records payments
services/payment-service/src/payment.service.ts - Payment processing → RabbitMQ events: publishes payment outcomes
services/payment-service/src/payment.service.ts - RabbitMQ events → Order handling: delivers payment outcomes
services/order-service/src/order.controller.ts - RabbitMQ events → Notifications & mail: delivers commerce events
- Notifications & mail → SMTP mailer: sends email
services/notification-service/src/index.ts - Reviews & ratings → RabbitMQ events: publishes review.created
- RabbitMQ events → Product catalog: delivers review events
- RabbitMQ events → Typo-tolerant search: delivers stock events
- RabbitMQ events → Recommendations: delivers order events