# akshithreddy89/nxt-trendz architecture

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

- Interactive diagram: https://gitdiagram.com/akshithreddy89/nxt-trendz
- Repository: https://github.com/akshithreddy89/nxt-trendz

## Overview

Nxt Trendz is a customer-facing shopping app: shoppers register or sign in, browse/search/filter products, inspect details and similar items, then manage a cart. React routes these screens to an Express API; authentication protects catalog and cart operations, while PostgreSQL stores users, products, and cart items. The frontend also maintains a local demo-cart fallback. Major branches are represented from the README and tree; some frontend request behavior and backend startup are documented or indexed rather than excerpted, so uncertain links are omitted.

Main entry points: [`nxtrend-fd/src/App.jsx`](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/App.jsx) (React routes), [`ecommerce-bk/routes/cartRoutes.js`](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/cartRoutes.js) (Cart routes), [`ecommerce-bk/routes/productRoutes.js`](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/productRoutes.js) (Product routes), [`nxtrend-fd/src/components/ProtectedRoute/index.jsx`](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/ProtectedRoute/index.jsx) (Route guard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Shopping interface"]
  node_app["React routes<br/>[App.jsx]"]
  node_navbar["Navigation and count<br/>[index.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_register["Registration<br/>[index.jsx]"]
  node_login["Sign in<br/>[index.jsx]"]
  node_guard["Route guard<br/>[index.jsx]"]
  node_authcontroller["Auth service<br/>[authController.js]"]
  node_tokencheck["JWT middleware<br/>[authMiddleware.js]"]
end

subgraph group_catalog["Product discovery"]
  node_home["Catalog browsing<br/>[index.jsx]"]
  node_details["Product details<br/>[index.jsx]"]
  node_productcontroller["Catalog service"]
end

subgraph group_cart["Cart management"]
  node_cartview["Cart screen<br/>[index.jsx]"]
  node_cartutils["Cart client<br/>[cartUtils.js]"]
  node_cartcontroller["Cart service<br/>[cartController.js]"]
end

subgraph group_backend["API and persistence"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_productroutes["Product routes<br/>[productRoutes.js]"]
  node_cartroutes["Cart routes<br/>[cartRoutes.js]"]
  node_api["Express API<br/>[app.js]"]
  node_dbpool[("PostgreSQL pool<br/>[db.js]")]
  node_postgres[("PostgreSQL")]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_login
node_app -->|"guards pages"| node_guard
node_guard -.->|"renders"| node_home
node_guard -.->|"renders"| node_details
node_guard -.->|"renders"| node_cartview
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_cartview
node_register -.->|"submits account"| node_authroutes
node_login -.->|"submits credentials"| node_authroutes
node_api -->|"mounts at"| node_authroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authcontroller -->|"queries"| node_dbpool
node_dbpool -.->|"connects"| node_postgres
node_home -.->|"requests catalog"| node_productroutes
node_details -->|"fetches details"| node_productroutes
node_api -->|"mounts at"| node_productroutes
node_productroutes -->|"authenticates"| node_tokencheck
node_productroutes -->|"dispatches"| node_productcontroller
node_productcontroller -->|"queries catalog"| node_dbpool
node_navbar -->|"loads cart count"| node_cartroutes
node_cartview -.->|"manages cart"| node_cartroutes
node_details -->|"adds product"| node_cartutils
node_cartutils -->|"updates cart"| node_cartroutes
node_api -->|"mounts at"| node_cartroutes
node_cartroutes -->|"authenticates"| node_tokencheck
node_cartroutes -->|"dispatches"| node_cartcontroller
node_cartcontroller -->|"queries cart"| node_dbpool
node_navbar -->|"reads fallback"| node_cartutils

click node_app "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/App.jsx"
click node_register "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Register/index.jsx"
click node_login "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Login/index.jsx"
click node_guard "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/ProtectedRoute/index.jsx"
click node_authroutes "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/authRoutes.js"
click node_authcontroller "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/controllers/authController.js"
click node_tokencheck "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/middleware/authMiddleware.js"
click node_home "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Home/index.jsx"
click node_details "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/ProductDetails/index.jsx"
click node_productroutes "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/productRoutes.js"
click node_productcontroller "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/controllers/productController.js"
click node_navbar "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Navbar/index.jsx"
click node_cartview "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Cart/index.jsx"
click node_cartutils "https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/utils/cartUtils.js"
click node_cartroutes "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/cartRoutes.js"
click node_cartcontroller "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/controllers/cartController.js"
click node_api "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/app.js"
click node_dbpool "https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/config/db.js"

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_app,node_navbar toneBlue
class node_register,node_login,node_guard,node_authcontroller,node_tokencheck toneAmber
class node_home,node_details,node_productcontroller toneMint
class node_cartview,node_cartutils,node_cartcontroller toneRose
class node_authroutes,node_productroutes,node_cartroutes,node_api,node_dbpool,node_postgres,node_shopper toneIndigo
```

## Components

### Shopping interface

- [React routes](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/App.jsx): `nxtrend-fd/src/App.jsx`
- [Navigation and count](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Navbar/index.jsx): `nxtrend-fd/src/components/Navbar/index.jsx`

### Identity and access

- [Registration](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Register/index.jsx): `nxtrend-fd/src/components/Register/index.jsx`
- [Sign in](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Login/index.jsx): `nxtrend-fd/src/components/Login/index.jsx`
- [Route guard](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/ProtectedRoute/index.jsx): `nxtrend-fd/src/components/ProtectedRoute/index.jsx`
- [Auth service](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/controllers/authController.js): `ecommerce-bk/controllers/authController.js`
- [JWT middleware](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/middleware/authMiddleware.js): `ecommerce-bk/middleware/authMiddleware.js`

### Product discovery

- [Catalog browsing](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Home/index.jsx): `nxtrend-fd/src/components/Home/index.jsx`
- [Product details](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/ProductDetails/index.jsx): `nxtrend-fd/src/components/ProductDetails/index.jsx`
- [Catalog service](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/controllers/productController.js): `ecommerce-bk/controllers/productController.js`

### Cart management

- [Cart screen](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/components/Cart/index.jsx): `nxtrend-fd/src/components/Cart/index.jsx`
- [Cart client](https://github.com/akshithreddy89/nxt-trendz/blob/master/nxtrend-fd/src/utils/cartUtils.js): `nxtrend-fd/src/utils/cartUtils.js`
- [Cart service](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/controllers/cartController.js): `ecommerce-bk/controllers/cartController.js`

### API and persistence

- [Auth routes](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/authRoutes.js): `ecommerce-bk/routes/authRoutes.js`
- [Product routes](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/productRoutes.js): `ecommerce-bk/routes/productRoutes.js`
- [Cart routes](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/routes/cartRoutes.js): `ecommerce-bk/routes/cartRoutes.js`
- [Express API](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/app.js): `ecommerce-bk/app.js`
- [PostgreSQL pool](https://github.com/akshithreddy89/nxt-trendz/blob/master/ecommerce-bk/config/db.js): `ecommerce-bk/config/db.js`
- **PostgreSQL**

### Other components

- **Shopper**

## Connections

- Shopper → React routes: uses (evidence: `nxtrend-fd/src/App.jsx`)
- React routes → Registration: routes to (evidence: `nxtrend-fd/src/App.jsx`)
- React routes → Sign in: routes to (evidence: `nxtrend-fd/src/App.jsx`)
- React routes → Route guard: guards pages (evidence: `nxtrend-fd/src/App.jsx`)
- Route guard → Catalog browsing: renders
- Route guard → Product details: renders
- Route guard → Cart screen: renders
- React routes → Catalog browsing: routes to (evidence: `nxtrend-fd/src/App.jsx`)
- React routes → Product details: routes to (evidence: `nxtrend-fd/src/App.jsx`)
- React routes → Cart screen: routes to (evidence: `nxtrend-fd/src/App.jsx`)
- Registration → Auth routes: submits account
- Sign in → Auth routes: submits credentials
- Express API → Auth routes: mounts at (evidence: `ecommerce-bk/app.js`)
- Auth routes → Auth service: dispatches (evidence: `ecommerce-bk/routes/authRoutes.js`)
- Auth service → PostgreSQL pool: queries (evidence: `ecommerce-bk/controllers/authController.js`)
- PostgreSQL pool → PostgreSQL: connects
- Catalog browsing → Product routes: requests catalog
- Product details → Product routes: fetches details (evidence: `nxtrend-fd/src/components/ProductDetails/index.jsx`)
- Express API → Product routes: mounts at (evidence: `ecommerce-bk/app.js`)
- Product routes → JWT middleware: authenticates (evidence: `ecommerce-bk/routes/productRoutes.js`)
- Product routes → Catalog service: dispatches (evidence: `ecommerce-bk/routes/productRoutes.js`)
- Catalog service → PostgreSQL pool: queries catalog (evidence: `ecommerce-bk/controllers/productController.js`)
- Navigation and count → Cart routes: loads cart count (evidence: `nxtrend-fd/src/components/Navbar/index.jsx`)
- Cart screen → Cart routes: manages cart
- Product details → Cart client: adds product (evidence: `nxtrend-fd/src/components/ProductDetails/index.jsx`)
- Cart client → Cart routes: updates cart (evidence: `nxtrend-fd/src/utils/cartUtils.js`)
- Express API → Cart routes: mounts at (evidence: `ecommerce-bk/app.js`)
- Cart routes → JWT middleware: authenticates (evidence: `ecommerce-bk/routes/cartRoutes.js`)
- Cart routes → Cart service: dispatches (evidence: `ecommerce-bk/routes/cartRoutes.js`)
- Cart service → PostgreSQL pool: queries cart (evidence: `ecommerce-bk/controllers/cartController.js`)
- Navigation and count → Cart client: reads fallback (evidence: `nxtrend-fd/src/components/Navbar/index.jsx`)
