# sudharshank-git/react-day4 architecture

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

- Interactive diagram: https://gitdiagram.com/sudharshank-git/react-day4
- Repository: https://github.com/sudharshank-git/react-day4

## Overview

Minion is a small e-commerce storefront with an Express API. The main shopper flow is routed through the React app to the home page, where category and product views fetch product data and render cards; the backend validates requests and reads or changes database records. Registration and login are a separate API workflow, while cart and wishlist pages are present in the client. The README is empty, so capability coverage comes from the source tree and available excerpts; some unsampled connections are left out.

Main entry points: [`client/src/Routing/Route.jsx`](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Routing/Route.jsx) (Page Router), [`client/src/Pages/Home.jsx`](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Home.jsx) (Home Page), [`backend/controllers/authController.js`](https://github.com/sudharshank-git/react-day4/blob/master/backend/controllers/authController.js) (Auth Controller), [`backend/controllers/productController.js`](https://github.com/sudharshank-git/react-day4/blob/master/backend/controllers/productController.js) (Product Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Storefront"]
  node_router["Page Router<br/>[Route.jsx]"]
  node_home["Home Page<br/>[Home.jsx]"]
  node_header["Store Header<br/>[Header.jsx]"]
  node_categories["Category List<br/>[CategoryList.jsx]"]
  node_productlist["Product List<br/>[ProductList.jsx]"]
  node_productcard["Product Card<br/>[ProductCard.jsx]"]
  node_producthook["Product Fetch Hook<br/>[useProducts.js]"]
  node_loginpage["Login Page<br/>[Login.jsx]"]
  node_cartpage["Cart Page<br/>[Cart.jsx]"]
  node_wishlistpage["Wishlist Page<br/>[Wishlist.jsx]"]
  node_dashboard["Dashboard Page<br/>[Dashboard.jsx]"]
end

subgraph group_api["API Runtime"]
  node_apiapp["Express App<br/>[app.js]"]
  node_database[("PostgreSQL<br/>[db.js]")]
  node_validator["Request Validator<br/>[validate.js]"]
  node_httperror["HTTP Error<br/>[httpError.js]"]
  node_errorhandler["Error Handler<br/>[errorHandler.js]"]
end

subgraph group_identity["Authentication"]
  node_authroutes["Auth Routes<br/>[authRoute.js]"]
  node_authcontroller["Auth Controller<br/>[authController.js]"]
  node_authschema["Auth Schemas<br/>[authSchema.js]"]
  node_authmodel["Auth Model<br/>[authModel.js]"]
end

subgraph group_catalog["Product Catalog"]
  node_productroutes["Product Routes<br/>[productRoute.js]"]
  node_productcontroller["Product Controller"]
  node_productschema["Product Schemas<br/>[productSchema.js]"]
  node_productmodel["Product Model<br/>[productModel.js]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses storefront"| node_router
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_loginpage
node_router -->|"guards route"| node_cartpage
node_router -->|"routes to"| node_wishlistpage
node_router -->|"guards route"| node_dashboard
node_home -->|"renders"| node_header
node_home -->|"renders"| node_categories
node_home -->|"renders"| node_productlist
node_header -.->|"accepts search"| node_shopper
node_categories -->|"fetches products"| node_producthook
node_productlist -->|"fetches products"| node_producthook
node_productlist -->|"renders"| node_productcard
node_producthook -.->|"requests products"| node_productroutes
node_apiapp -->|"mounts at auth"| node_authroutes
node_apiapp -->|"mounts at products"| node_productroutes
node_apiapp -->|"handles errors"| node_errorhandler
node_authroutes -->|"dispatches to"| node_authcontroller
node_authcontroller -->|"validates with"| node_authschema
node_authcontroller -->|"validates input"| node_validator
node_authcontroller -->|"reads and creates"| node_authmodel
node_authmodel -->|"queries"| node_database
node_productroutes -->|"dispatches to"| node_productcontroller
node_productcontroller -->|"validates with"| node_productschema
node_productcontroller -->|"validates input"| node_validator
node_productcontroller -->|"reads and writes"| node_productmodel
node_productmodel -->|"queries"| node_database
node_validator -->|"throws"| node_httperror

click node_router "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Routing/Route.jsx"
click node_home "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Home.jsx"
click node_header "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/Header.jsx"
click node_categories "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/CategoryList.jsx"
click node_productlist "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/ProductList.jsx"
click node_productcard "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/ProductCard.jsx"
click node_producthook "https://github.com/sudharshank-git/react-day4/blob/master/client/src/hooks/useProducts.js"
click node_loginpage "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Login.jsx"
click node_cartpage "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Cart.jsx"
click node_wishlistpage "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Wishlist.jsx"
click node_dashboard "https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Dashboard.jsx"
click node_apiapp "https://github.com/sudharshank-git/react-day4/blob/master/backend/app.js"
click node_authroutes "https://github.com/sudharshank-git/react-day4/blob/master/backend/routes/authRoute.js"
click node_authcontroller "https://github.com/sudharshank-git/react-day4/blob/master/backend/controllers/authController.js"
click node_authschema "https://github.com/sudharshank-git/react-day4/blob/master/backend/schemas/authSchema.js"
click node_authmodel "https://github.com/sudharshank-git/react-day4/blob/master/backend/models/authModel.js"
click node_productroutes "https://github.com/sudharshank-git/react-day4/blob/master/backend/routes/productRoute.js"
click node_productcontroller "https://github.com/sudharshank-git/react-day4/blob/master/backend/controllers/productController.js"
click node_productschema "https://github.com/sudharshank-git/react-day4/blob/master/backend/schemas/productSchema.js"
click node_productmodel "https://github.com/sudharshank-git/react-day4/blob/master/backend/models/productModel.js"
click node_database "https://github.com/sudharshank-git/react-day4/blob/master/backend/db.js"
click node_validator "https://github.com/sudharshank-git/react-day4/blob/master/backend/utils/validate.js"
click node_httperror "https://github.com/sudharshank-git/react-day4/blob/master/backend/utils/httpError.js"
click node_errorhandler "https://github.com/sudharshank-git/react-day4/blob/master/backend/middlewares/errorHandler.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_router,node_home,node_header,node_categories,node_productlist,node_productcard,node_producthook,node_loginpage,node_cartpage,node_wishlistpage,node_dashboard toneBlue
class node_apiapp,node_database,node_validator,node_httperror,node_errorhandler toneAmber
class node_authroutes,node_authcontroller,node_authschema,node_authmodel toneMint
class node_productroutes,node_productcontroller,node_productschema,node_productmodel toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Page Router](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Routing/Route.jsx): `client/src/Routing/Route.jsx`
- [Home Page](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Home.jsx): `client/src/Pages/Home.jsx`
- [Store Header](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/Header.jsx): `client/src/Components/Header.jsx`
- [Category List](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/CategoryList.jsx): `client/src/Components/CategoryList.jsx`
- [Product List](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/ProductList.jsx): `client/src/Components/ProductList.jsx`
- [Product Card](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Components/ProductCard.jsx): `client/src/Components/ProductCard.jsx`
- [Product Fetch Hook](https://github.com/sudharshank-git/react-day4/blob/master/client/src/hooks/useProducts.js): `client/src/hooks/useProducts.js`
- [Login Page](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Login.jsx): `client/src/Pages/Login.jsx`
- [Cart Page](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Cart.jsx): `client/src/Pages/Cart.jsx`
- [Wishlist Page](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Wishlist.jsx): `client/src/Pages/Wishlist.jsx`
- [Dashboard Page](https://github.com/sudharshank-git/react-day4/blob/master/client/src/Pages/Dashboard.jsx): `client/src/Pages/Dashboard.jsx`

### API Runtime

- [Express App](https://github.com/sudharshank-git/react-day4/blob/master/backend/app.js): `backend/app.js`
- [PostgreSQL](https://github.com/sudharshank-git/react-day4/blob/master/backend/db.js): `backend/db.js`
- [Request Validator](https://github.com/sudharshank-git/react-day4/blob/master/backend/utils/validate.js): `backend/utils/validate.js`
- [HTTP Error](https://github.com/sudharshank-git/react-day4/blob/master/backend/utils/httpError.js): `backend/utils/httpError.js`
- [Error Handler](https://github.com/sudharshank-git/react-day4/blob/master/backend/middlewares/errorHandler.js): `backend/middlewares/errorHandler.js`

### Authentication

- [Auth Routes](https://github.com/sudharshank-git/react-day4/blob/master/backend/routes/authRoute.js): `backend/routes/authRoute.js`
- [Auth Controller](https://github.com/sudharshank-git/react-day4/blob/master/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Auth Schemas](https://github.com/sudharshank-git/react-day4/blob/master/backend/schemas/authSchema.js): `backend/schemas/authSchema.js`
- [Auth Model](https://github.com/sudharshank-git/react-day4/blob/master/backend/models/authModel.js): `backend/models/authModel.js`

### Product Catalog

- [Product Routes](https://github.com/sudharshank-git/react-day4/blob/master/backend/routes/productRoute.js): `backend/routes/productRoute.js`
- [Product Controller](https://github.com/sudharshank-git/react-day4/blob/master/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Product Schemas](https://github.com/sudharshank-git/react-day4/blob/master/backend/schemas/productSchema.js): `backend/schemas/productSchema.js`
- [Product Model](https://github.com/sudharshank-git/react-day4/blob/master/backend/models/productModel.js): `backend/models/productModel.js`

### Other components

- **Shopper**

## Connections

- Shopper → Page Router: uses storefront (evidence: `client/src/Routing/Route.jsx`)
- Page Router → Home Page: routes to (evidence: `client/src/Routing/Route.jsx`)
- Page Router → Login Page: routes to (evidence: `client/src/Routing/Route.jsx`)
- Page Router → Cart Page: guards route (evidence: `client/src/Routing/Route.jsx`)
- Page Router → Wishlist Page: routes to (evidence: `client/src/Routing/Route.jsx`)
- Page Router → Dashboard Page: guards route (evidence: `client/src/Routing/Route.jsx`)
- Home Page → Store Header: renders (evidence: `client/src/Pages/Home.jsx`)
- Home Page → Category List: renders (evidence: `client/src/Pages/Home.jsx`)
- Home Page → Product List: renders (evidence: `client/src/Pages/Home.jsx`)
- Store Header → Shopper: accepts search
- Category List → Product Fetch Hook: fetches products (evidence: `client/src/Components/CategoryList.jsx`)
- Product List → Product Fetch Hook: fetches products (evidence: `client/src/Components/ProductList.jsx`)
- Product List → Product Card: renders (evidence: `client/src/Components/ProductList.jsx`)
- Product Fetch Hook → Product Routes: requests products
- Express App → Auth Routes: mounts at auth (evidence: `backend/app.js`)
- Express App → Product Routes: mounts at products (evidence: `backend/app.js`)
- Express App → Error Handler: handles errors (evidence: `backend/app.js`)
- Auth Routes → Auth Controller: dispatches to (evidence: `backend/routes/authRoute.js`)
- Auth Controller → Auth Schemas: validates with (evidence: `backend/controllers/authController.js`)
- Auth Controller → Request Validator: validates input (evidence: `backend/controllers/authController.js`)
- Auth Controller → Auth Model: reads and creates (evidence: `backend/controllers/authController.js`)
- Auth Model → PostgreSQL: queries (evidence: `backend/models/authModel.js`)
- Product Routes → Product Controller: dispatches to (evidence: `backend/routes/productRoute.js`)
- Product Controller → Product Schemas: validates with (evidence: `backend/controllers/productController.js`)
- Product Controller → Request Validator: validates input (evidence: `backend/controllers/productController.js`)
- Product Controller → Product Model: reads and writes (evidence: `backend/controllers/productController.js`)
- Product Model → PostgreSQL: queries (evidence: `backend/models/productModel.js`)
- Request Validator → HTTP Error: throws (evidence: `backend/utils/validate.js`)
