# mahesh09s/ecommerce-platform architecture

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

- Interactive diagram: https://gitdiagram.com/mahesh09s/ecommerce-platform
- Repository: https://github.com/mahesh09s/ecommerce-platform

## Overview

ShopSphere is a full-stack commerce platform. A customer browses and searches products, manages a cart and wishlist, checks out, pays, and tracks orders; customers can also review products. Admins manage catalog, orders, users, coupons, and analytics. The README documents the React client, Spring service/repository layers, MySQL transactions, MongoDB reviews and analytics, and Razorpay. Some subsystem implementations were not sampled, so their internal links are documented at the product level rather than inferred from filenames.

Main entry points: [`frontend/src/services/api.js`](https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/services/api.js) (API client), [`backend/src/main/java/com/shopsphere/service/ReviewService.java`](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/ReviewService.java) (Reviews and ratings), [`backend/src/main/java/com/shopsphere/service/OrderService.java`](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/OrderService.java) (Checkout and orders), [`backend/src/main/java/com/shopsphere/service/AuthService.java`](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/AuthService.java) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer experience"]
  node_storefront["Storefront pages"]
  node_app["Route composition<br/>[App.jsx]"]
  node_api["API client<br/>[api.js]"]
  node_authui["Auth pages"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_cartstate["Cart state<br/>[CartContext.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_authcontroller["Auth endpoints"]
  node_authservice["Authentication<br/>[AuthService.java]"]
  node_security["JWT security"]
end

subgraph group_catalog["Catalog and discovery"]
  node_products["Product discovery"]
  node_productservice["Product services"]
  node_productstore[("Product data<br/>[Product.java]")]
  node_reviews["Reviews and ratings<br/>[ReviewService.java]"]
  node_reviewstore[("Review documents<br/>[Review.java]")]
end

subgraph group_commerce["Commerce operations"]
  node_cart["Cart management<br/>[CartService.java]"]
  node_orders["Checkout and orders<br/>[OrderService.java]"]
  node_payments["Payment processing"]
  node_adminops["Admin operations<br/>[AdminService.java]"]
end

subgraph group_platform["Backend and data"]
  node_mysql[("Transactional store")]
  node_mongodb[("Analytics store")]
  node_mail["Email delivery<br/>[EmailService.java]"]
end

node_shopper(("Shopper"))
node_admin(("Administrator"))
node_razorpay["Razorpay"]

node_shopper -->|"browses and shops"| node_storefront
node_admin -->|"manages commerce"| node_adminops
node_storefront -->|"uses routes"| node_app
node_authui -.->|"authenticates through"| node_authstate
node_authstate -.->|"requests API"| node_api
node_cartstate -.->|"requests API"| node_api
node_api -.->|"calls REST API"| node_authcontroller
node_api -.->|"calls REST API"| node_products
node_products -->|"delegates to"| node_productservice
node_productservice -.->|"reads products"| node_productstore
node_authcontroller -.->|"delegates to"| node_authservice
node_authservice -->|"issues tokens"| node_security
node_authservice -->|"sends account email"| node_mail
node_reviews -->|"stores reviews"| node_reviewstore
node_reviews -->|"updates ratings"| node_productstore
node_cart -->|"checks stock"| node_productstore
node_orders -->|"uses cart"| node_cart
node_orders -.->|"coordinates payment"| node_payments
node_payments -.->|"processes payment"| node_razorpay
node_productservice -.->|"persists catalog"| node_mysql
node_orders -.->|"persists transactions"| node_mysql
node_reviews -.->|"stores review data"| node_mongodb
node_adminops -.->|"manages records"| node_mysql

click node_storefront "https://github.com/mahesh09s/ecommerce-platform/tree/main/frontend/src/pages"
click node_app "https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/services/api.js"
click node_authui "https://github.com/mahesh09s/ecommerce-platform/tree/main/frontend/src/pages/auth"
click node_authstate "https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/context/AuthContext.jsx"
click node_cartstate "https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/context/CartContext.jsx"
click node_authcontroller "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/controller/AuthController.java"
click node_authservice "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/AuthService.java"
click node_security "https://github.com/mahesh09s/ecommerce-platform/tree/main/backend/src/main/java/com/shopsphere/security"
click node_products "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/controller/ProductController.java"
click node_productservice "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/ProductService.java"
click node_productstore "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/entity/Product.java"
click node_reviews "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/ReviewService.java"
click node_reviewstore "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/document/Review.java"
click node_cart "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/CartService.java"
click node_orders "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/OrderService.java"
click node_payments "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/PaymentService.java"
click node_adminops "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/AdminService.java"
click node_mail "https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/EmailService.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_storefront,node_app,node_api,node_authui,node_authstate,node_cartstate toneBlue
class node_authcontroller,node_authservice,node_security toneAmber
class node_products,node_productservice,node_productstore,node_reviews,node_reviewstore toneMint
class node_cart,node_orders,node_payments,node_adminops toneRose
class node_mysql,node_mongodb,node_mail,node_shopper,node_admin,node_razorpay toneIndigo
```

## Components

### Customer experience

- [Storefront pages](https://github.com/mahesh09s/ecommerce-platform/tree/main/frontend/src/pages): `frontend/src/pages`
- [Route composition](https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Auth pages](https://github.com/mahesh09s/ecommerce-platform/tree/main/frontend/src/pages/auth): `frontend/src/pages/auth`
- [Auth state](https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Cart state](https://github.com/mahesh09s/ecommerce-platform/blob/main/frontend/src/context/CartContext.jsx): `frontend/src/context/CartContext.jsx`

### Identity and access

- [Auth endpoints](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/controller/AuthController.java): `backend/src/main/java/com/shopsphere/controller/AuthController.java`
- [Authentication](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/AuthService.java): `backend/src/main/java/com/shopsphere/service/AuthService.java`
- [JWT security](https://github.com/mahesh09s/ecommerce-platform/tree/main/backend/src/main/java/com/shopsphere/security): `backend/src/main/java/com/shopsphere/security`

### Catalog and discovery

- [Product discovery](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/controller/ProductController.java): `backend/src/main/java/com/shopsphere/controller/ProductController.java`
- [Product services](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/ProductService.java): `backend/src/main/java/com/shopsphere/service/ProductService.java`
- [Product data](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/entity/Product.java): `backend/src/main/java/com/shopsphere/entity/Product.java`
- [Reviews and ratings](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/ReviewService.java): `backend/src/main/java/com/shopsphere/service/ReviewService.java`
- [Review documents](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/document/Review.java): `backend/src/main/java/com/shopsphere/document/Review.java`

### Commerce operations

- [Cart management](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/CartService.java): `backend/src/main/java/com/shopsphere/service/CartService.java`
- [Checkout and orders](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/OrderService.java): `backend/src/main/java/com/shopsphere/service/OrderService.java`
- [Payment processing](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/PaymentService.java): `backend/src/main/java/com/shopsphere/service/PaymentService.java`
- [Admin operations](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/AdminService.java): `backend/src/main/java/com/shopsphere/service/AdminService.java`

### Backend and data

- **Transactional store**
- **Analytics store**
- [Email delivery](https://github.com/mahesh09s/ecommerce-platform/blob/main/backend/src/main/java/com/shopsphere/service/EmailService.java): `backend/src/main/java/com/shopsphere/service/EmailService.java`

### Other components

- **Shopper**
- **Administrator**
- **Razorpay**

## Connections

- Shopper → Storefront pages: browses and shops
- Administrator → Admin operations: manages commerce
- Storefront pages → Route composition: uses routes (evidence: `frontend/src/App.jsx`)
- Auth pages → Auth state: authenticates through
- Auth state → API client: requests API
- Cart state → API client: requests API
- API client → Auth endpoints: calls REST API
- API client → Product discovery: calls REST API
- Product discovery → Product services: delegates to (evidence: `backend/src/main/java/com/shopsphere/controller/ProductController.java`)
- Product services → Product data: reads products (evidence: `backend/src/main/java/com/shopsphere/service/ProductService.java`)
- Auth endpoints → Authentication: delegates to
- Authentication → JWT security: issues tokens (evidence: `backend/src/main/java/com/shopsphere/service/AuthService.java`)
- Authentication → Email delivery: sends account email (evidence: `backend/src/main/java/com/shopsphere/service/AuthService.java`)
- Reviews and ratings → Review documents: stores reviews (evidence: `backend/src/main/java/com/shopsphere/service/ReviewService.java`)
- Reviews and ratings → Product data: updates ratings (evidence: `backend/src/main/java/com/shopsphere/service/ReviewService.java`)
- Cart management → Product data: checks stock (evidence: `backend/src/main/java/com/shopsphere/service/CartService.java`)
- Checkout and orders → Cart management: uses cart (evidence: `backend/src/main/java/com/shopsphere/service/OrderService.java`)
- Checkout and orders → Payment processing: coordinates payment
- Payment processing → Razorpay: processes payment
- Product services → Transactional store: persists catalog
- Checkout and orders → Transactional store: persists transactions
- Reviews and ratings → Analytics store: stores review data
- Admin operations → Transactional store: manages records
