# subhadeep0608/nexus---e_commerce architecture

> Architecture diagram of the GitHub repository subhadeep0608/nexus---e_commerce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/subhadeep0608/nexus---e_commerce
- Repository: https://github.com/subhadeep0608/nexus---e_commerce

## Overview

#### Purpose and Entry Points
Nexus is a separated full-stack e-commerce application for product management, cart/checkout, and order handling. The Java backend starts through `E_commerce/src/main/java/com/deep/E_Commerce/ECommerceApplication.java`; the React/Vite client starts from `frontend/src/main.jsx` and mounts `frontend/src/App.jsx`.

#### Backend HTTP Layer
Spring MVC controllers expose the backend REST boundary:
- Product operations: `E_commerce/src/main/java/com/deep/E_Commerce/Controller/ProductController.java`
- Order operations: `E_commerce/src/main/java/com/deep/E_Commerce/Controller/OrderController.java`
- A basic endpoint is isolated in `E_commerce/src/main/java/com/deep/E_Commerce/Controller/HelloController.java`

Controllers should remain transport-facing: receive requests, delegate business work, and return API responses.

#### Product Domain and Persistence
Products are represented by the JPA/Hibernate model at `E_commerce/src/main/java/com/deep/E_Commerce/model/Product.java`. Product business operations flow through `E_commerce/src/main/java/com/deep/E_Commerce/service/ProductService.java` into Spring Data persistence at `E_commerce/src/main/java/com/deep/E_Commerce/repo/ProductRepo.java`.

This establishes the product lifecycle: React request → product controller → service → repository → MySQL.

#### Order Assembly and Transaction Boundary
Orders use an aggregate-like model comprising:
- `E_commerce/src/main/java/com/deep/E_Commerce/model/Order.java`
- `E_commerce/src/main/java/com/deep/E_Commerce/model/OrderItem.java`
- `E_commerce/src/main/java/com/deep/E_Commerce/service/OrderService.java`

Order input/output DTOs—especially `E_commerce/src/main/java/com/deep/E_Commerce/model/DTO/OrderRequest.java` and `E_commerce/src/main/java/com/deep/E_Commerce/model/DTO/OrderResponse.java`—separate external order payloads from persistence entities. `OrderRepo.java` owns order database access.

#### Frontend State and API Boundary
The React application centralizes shared client state in `frontend/src/Context/Context.jsx`. Backend communication is encapsulated in `frontend/src/axios.jsx`, creating the client/server boundary rather than embedding HTTP concerns in every UI component.

The runtime flow is UI interaction → context/state update or Axios request → Spring REST API → response → rerendered React view.

#### User Workflows
Product browsing and management are represented by `frontend/src/components/Home.jsx`, `frontend/src/components/Product.jsx`, `frontend/src/components/AddProduct.jsx`, and `frontend/src/components/UpdateProduct.jsx`. Cart and purchase flow are handled by `frontend/src/components/Cart.jsx`, `frontend/src/components/CheckoutModal.jsx`, and `frontend/src/components/Order.jsx`.

Search is a distinct UI stage in `frontend/src/components/SearchResults.jsx`; navigation and application-level composition are anchored in `frontend/src/components/Navbar.jsx` and `frontend/src/App.jsx`.

#### Runtime and Infrastructure
Backend runtime is Spring Boot, built with Maven (`E_commerce/pom.xml`), using Spring Data JPA/Hibernate and JDBC against MySQL; connection/runtime settings reside in `E_commerce/src/main/resources/application.properties`. Frontend runtime is React with Vite (`frontend/package.json`, `frontend/vite.config.js`), and Axios provides REST connectivity. Client environment values are supplied through `frontend/.env`.

Main entry points: [`frontend/src/App.jsx`](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/App.jsx) (App composition), [`frontend/src/axios.jsx`](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/axios.jsx) (Axios API client), [`E_commerce/src/main/java/com/deep/E_Commerce/Controller/OrderController.java`](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/Controller/OrderController.java) (Order REST API), [`frontend/src/components/Home.jsx`](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/components/Home.jsx) (Product & cart UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React client"]
  node_vite{{"Vite runtime<br/>frontend runtime<br/>[vite.config.js]"}}
  node_main["React entry<br/>entry point<br/>[main.jsx]"]
  node_app["App composition<br/>React shell<br/>[App.jsx]"]
  node_context["Shared state<br/>React context<br/>[Context.jsx]"]
  node_ui["Product &amp; cart UI<br/>React components<br/>[Home.jsx]"]
  node_search["Search results<br/>React view<br/>[SearchResults.jsx]"]
  node_api["Axios API client<br/>HTTP client<br/>[axios.jsx]"]
end

subgraph group_backend["Spring backend"]
  node_boot{{"Spring Boot app<br/>backend entry point"}}
  node_product_controller["Product REST API<br/>MVC controller"]
  node_order_controller["Order REST API<br/>MVC controller"]
  node_product_service["Product service<br/>business service"]
  node_order_service["Order service<br/>transaction service<br/>[OrderService.java]"]
  node_order_dtos["Order DTOs<br/>API contracts<br/>[OrderRequest.java]"]
end

subgraph group_data["Persistence"]
  node_product_repo["Product repository<br/>Spring Data repository<br/>[ProductRepo.java]"]
  node_order_repo["Order repository<br/>Spring Data repository"]
  node_entities["Product &amp; order entities<br/>JPA models<br/>[Product.java]"]
  node_mysql[("MySQL<br/>database")]
end

node_vite -->|"starts"| node_main
node_main -->|"mounts"| node_app
node_app -->|"provides state"| node_context
node_app -->|"composes"| node_ui
node_app -->|"routes to"| node_search
node_ui -->|"updates cart/state"| node_context
node_ui -->|"requests"| node_api
node_search -->|"queries"| node_api
node_api -->|"product REST"| node_product_controller
node_api -->|"order REST"| node_order_controller
node_boot -->|"hosts"| node_product_controller
node_boot -->|"hosts"| node_order_controller
node_product_controller -->|"delegates"| node_product_service
node_order_controller -->|"maps payloads"| node_order_dtos
node_order_controller -->|"delegates"| node_order_service
node_product_service -->|"persists products"| node_product_repo
node_order_service -->|"persists orders"| node_order_repo
node_order_service -->|"assembles aggregate"| node_entities
node_product_repo -->|"JPA/JDBC"| node_mysql
node_order_repo -->|"JPA/JDBC"| node_mysql

click node_vite "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/vite.config.js"
click node_main "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/App.jsx"
click node_context "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/Context/Context.jsx"
click node_ui "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/components/Home.jsx"
click node_search "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/components/SearchResults.jsx"
click node_api "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/axios.jsx"
click node_boot "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/ECommerceApplication.java"
click node_product_controller "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/Controller/ProductController.java"
click node_order_controller "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/Controller/OrderController.java"
click node_product_service "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/service/ProductService.java"
click node_order_service "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/service/OrderService.java"
click node_order_dtos "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/model/DTO/OrderRequest.java"
click node_product_repo "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/repo/ProductRepo.java"
click node_entities "https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/model/Product.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_vite,node_main,node_app,node_context,node_ui,node_search,node_api toneBlue
class node_boot,node_product_controller,node_order_controller,node_product_service,node_order_service,node_order_dtos toneAmber
class node_product_repo,node_order_repo,node_entities,node_mysql toneMint
```

## Components

### React client

- [Vite runtime](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/vite.config.js): frontend runtime · `frontend/vite.config.js`
- [React entry](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/main.jsx): entry point · `frontend/src/main.jsx`
- [App composition](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/App.jsx): React shell · `frontend/src/App.jsx`
- [Shared state](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/Context/Context.jsx): React context · `frontend/src/Context/Context.jsx`
- [Product & cart UI](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/components/Home.jsx): React components · Browsing, management, cart, checkout, and orders. · `frontend/src/components/Home.jsx`
- [Search results](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/components/SearchResults.jsx): React view · `frontend/src/components/SearchResults.jsx`
- [Axios API client](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/frontend/src/axios.jsx): HTTP client · `frontend/src/axios.jsx`

### Spring backend

- [Spring Boot app](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/ECommerceApplication.java): backend entry point · `E_commerce/src/main/java/com/deep/E_Commerce/ECommerceApplication.java`
- [Product REST API](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/Controller/ProductController.java): MVC controller · `E_commerce/src/main/java/com/deep/E_Commerce/Controller/ProductController.java`
- [Order REST API](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/Controller/OrderController.java): MVC controller · `E_commerce/src/main/java/com/deep/E_Commerce/Controller/OrderController.java`
- [Product service](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/service/ProductService.java): business service · `E_commerce/src/main/java/com/deep/E_Commerce/service/ProductService.java`
- [Order service](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/service/OrderService.java): transaction service · Assembles the order aggregate. · `E_commerce/src/main/java/com/deep/E_Commerce/service/OrderService.java`
- [Order DTOs](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/model/DTO/OrderRequest.java): API contracts · Separate order payloads from entities. · `E_commerce/src/main/java/com/deep/E_Commerce/model/DTO/OrderRequest.java`

### Persistence

- [Product repository](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/repo/ProductRepo.java): Spring Data repository · `E_commerce/src/main/java/com/deep/E_Commerce/repo/ProductRepo.java`
- **Order repository**: Spring Data repository
- [Product & order entities](https://github.com/subhadeep0608/nexus---e_commerce/blob/main/E_commerce/src/main/java/com/deep/E_Commerce/model/Product.java): JPA models · Product, Order, and OrderItem persistence models. · `E_commerce/src/main/java/com/deep/E_Commerce/model/Product.java`
- **MySQL**: database

## Connections

- Vite runtime → React entry: starts
- React entry → App composition: mounts
- App composition → Shared state: provides state
- App composition → Product & cart UI: composes
- App composition → Search results: routes to
- Product & cart UI → Shared state: updates cart/state
- Product & cart UI → Axios API client: requests
- Search results → Axios API client: queries
- Axios API client → Product REST API: product REST
- Axios API client → Order REST API: order REST
- Spring Boot app → Product REST API: hosts
- Spring Boot app → Order REST API: hosts
- Product REST API → Product service: delegates
- Order REST API → Order DTOs: maps payloads
- Order REST API → Order service: delegates
- Product service → Product repository: persists products
- Order service → Order repository: persists orders
- Order service → Product & order entities: assembles aggregate
- Product repository → MySQL: JPA/JDBC
- Order repository → MySQL: JPA/JDBC
