# devkaushik2112/e--fash architecture

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

- Interactive diagram: https://gitdiagram.com/devkaushik2112/e--fash
- Repository: https://github.com/devkaushik2112/e--fash

## Overview

E-Fash is a fashion e-commerce application: customers browse and review products, manage a cart or wishlist, check out, and track orders; administrators manage inventory and orders. The frontend routes pages and keeps client state in Redux slices, which call the Express API; backend controllers use Mongoose models for persistent product, user, and order data. The README documents the major capabilities and API, while source excerpts confirm key routing, state, and controller behavior. Some page-to-API and route-to-controller details are documented or indexed rather than shown in excerpts.

Main entry points: [`backend/app.js`](https://github.com/devkaushik2112/e--fash/blob/main/backend/app.js) (Express API routing), [`frontend/src/App.tsx`](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/App.tsx) (App routing), [`backend/models/User.js`](https://github.com/devkaushik2112/e--fash/blob/main/backend/models/User.js) (User records), [`frontend/src/pages/ProductDetail.tsx`](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/ProductDetail.tsx) (Product detail)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Customer storefront"]
  node_app["App routing<br/>[App.tsx]"]
  node_catalog_pages["Product discovery<br/>[Products.tsx]"]
  node_detail_page["Product detail<br/>[ProductDetail.tsx]"]
  node_cart_page["Cart and checkout<br/>[Checkout.tsx]"]
  node_orders_page["Orders and profile<br/>[Orders.tsx]"]
  node_admin_pages["Admin workspace<br/>[AdminProducts.tsx]"]
end

subgraph group_state["Client state and experience"]
  node_auth_state["Authentication state<br/>[authSlice.ts]"]
  node_product_state["Product state<br/>[productSlice.ts]"]
  node_cart_state["Cart state<br/>[cartSlice.ts]"]
  node_wishlist_state["Wishlist state<br/>[wishlistSlice.ts]"]
  node_checkout_state["Checkout state<br/>[checkoutSlice.ts]"]
  node_theme_i18n["Theme and language<br/>[ThemeContext.tsx]"]
end

subgraph group_api["Backend API"]
  node_api_app["Express API routing<br/>[app.js]"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_product_controller["Catalog and reviews"]
  node_cart_controller["Cart operations<br/>[cartController.js]"]
  node_wishlist_controller["Wishlist operations"]
  node_order_controller["Order operations<br/>[orderController.js]"]
  node_user_controller["User profile<br/>[userController.js]"]
  node_admin_controller["Admin operations<br/>[adminController.js]"]
  node_auth_middleware["JWT authorization<br/>[auth.js]"]
end

subgraph group_data["Commerce data"]
  node_product_model[("Product records<br/>[Product.js]")]
  node_user_model[("User records<br/>[User.js]")]
  node_order_model[("Order records<br/>[Order.js]")]
end

node_customer(("Customer"))

node_customer -->|"uses"| node_app
node_app -->|"routes to"| node_catalog_pages
node_app -->|"routes to"| node_detail_page
node_app -->|"routes to"| node_cart_page
node_app -->|"routes to"| node_orders_page
node_app -->|"routes to"| node_admin_pages
node_app -->|"loads session"| node_auth_state
node_app -->|"loads cart"| node_cart_state
node_app -->|"loads wishlist"| node_wishlist_state
node_detail_page -->|"dispatches"| node_product_state
node_detail_page -->|"dispatches"| node_cart_state
node_detail_page -->|"dispatches"| node_wishlist_state
node_detail_page -->|"dispatches"| node_checkout_state
node_cart_page -->|"uses"| node_cart_state
node_cart_page -->|"uses"| node_checkout_state
node_auth_state -->|"calls auth API"| node_api_app
node_cart_state -->|"calls cart API"| node_api_app
node_catalog_pages -.->|"uses"| node_product_state
node_product_state -.->|"calls catalog API"| node_api_app
node_wishlist_state -.->|"calls wishlist API"| node_api_app
node_checkout_state -.->|"submits orders"| node_api_app
node_orders_page -.->|"requests orders"| node_api_app
node_admin_pages -.->|"requests admin API"| node_api_app
node_theme_i18n -.->|"localizes display"| node_customer
node_api_app -->|"mounts auth routes"| node_auth_controller
node_api_app -->|"mounts catalog routes"| node_product_controller
node_api_app -->|"mounts cart routes"| node_cart_controller
node_api_app -->|"mounts wishlist routes"| node_wishlist_controller
node_api_app -->|"mounts order routes"| node_order_controller
node_api_app -->|"mounts user routes"| node_user_controller
node_api_app -->|"mounts admin routes"| node_admin_controller
node_auth_controller -->|"reads and writes"| node_user_model
node_cart_controller -->|"updates cart"| node_user_model
node_cart_controller -->|"looks up products"| node_product_model
node_product_controller -->|"reads and writes"| node_product_model
node_wishlist_controller -->|"updates wishlist"| node_user_model
node_wishlist_controller -->|"looks up products"| node_product_model
node_order_controller -->|"creates and reads"| node_order_model
node_order_controller -->|"checks stock"| node_product_model
node_order_controller -->|"clears cart"| node_user_model
node_admin_controller -->|"manages inventory"| node_product_model
node_admin_controller -->|"counts users"| node_user_model
node_admin_controller -->|"reads order metrics"| node_order_model
node_auth_middleware -->|"loads identity"| node_user_model
node_auth_middleware -->|"protects admin routes"| node_admin_controller

click node_app "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/App.tsx"
click node_catalog_pages "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/Products.tsx"
click node_detail_page "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/ProductDetail.tsx"
click node_cart_page "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/Checkout.tsx"
click node_orders_page "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/Orders.tsx"
click node_admin_pages "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/AdminProducts.tsx"
click node_auth_state "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/authSlice.ts"
click node_product_state "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/productSlice.ts"
click node_cart_state "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/cartSlice.ts"
click node_wishlist_state "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/wishlistSlice.ts"
click node_checkout_state "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/checkoutSlice.ts"
click node_theme_i18n "https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/contexts/ThemeContext.tsx"
click node_api_app "https://github.com/devkaushik2112/e--fash/blob/main/backend/app.js"
click node_auth_controller "https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/authController.js"
click node_product_controller "https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/productController.js"
click node_cart_controller "https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/cartController.js"
click node_wishlist_controller "https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/wishlistController.js"
click node_order_controller "https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/orderController.js"
click node_user_controller "https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/userController.js"
click node_admin_controller "https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/adminController.js"
click node_auth_middleware "https://github.com/devkaushik2112/e--fash/blob/main/backend/middleware/auth.js"
click node_product_model "https://github.com/devkaushik2112/e--fash/blob/main/backend/models/Product.js"
click node_user_model "https://github.com/devkaushik2112/e--fash/blob/main/backend/models/User.js"
click node_order_model "https://github.com/devkaushik2112/e--fash/blob/main/backend/models/Order.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_catalog_pages,node_detail_page,node_cart_page,node_orders_page,node_admin_pages toneBlue
class node_auth_state,node_product_state,node_cart_state,node_wishlist_state,node_checkout_state,node_theme_i18n toneAmber
class node_api_app,node_auth_controller,node_product_controller,node_cart_controller,node_wishlist_controller,node_order_controller,node_user_controller,node_admin_controller,node_auth_middleware toneMint
class node_product_model,node_user_model,node_order_model toneRose
class node_customer toneIndigo
```

## Components

### Customer storefront

- [App routing](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Product discovery](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/Products.tsx): `frontend/src/pages/Products.tsx`
- [Product detail](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/ProductDetail.tsx): `frontend/src/pages/ProductDetail.tsx`
- [Cart and checkout](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/Checkout.tsx): `frontend/src/pages/Checkout.tsx`
- [Orders and profile](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/Orders.tsx): `frontend/src/pages/Orders.tsx`
- [Admin workspace](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/pages/AdminProducts.tsx): `frontend/src/pages/AdminProducts.tsx`

### Client state and experience

- [Authentication state](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/authSlice.ts): `frontend/src/store/slices/authSlice.ts`
- [Product state](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/productSlice.ts): `frontend/src/store/slices/productSlice.ts`
- [Cart state](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/cartSlice.ts): `frontend/src/store/slices/cartSlice.ts`
- [Wishlist state](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/wishlistSlice.ts): `frontend/src/store/slices/wishlistSlice.ts`
- [Checkout state](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/store/slices/checkoutSlice.ts): `frontend/src/store/slices/checkoutSlice.ts`
- [Theme and language](https://github.com/devkaushik2112/e--fash/blob/main/frontend/src/contexts/ThemeContext.tsx): `frontend/src/contexts/ThemeContext.tsx`

### Backend API

- [Express API routing](https://github.com/devkaushik2112/e--fash/blob/main/backend/app.js): `backend/app.js`
- [Authentication](https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Catalog and reviews](https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Cart operations](https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/cartController.js): `backend/controllers/cartController.js`
- [Wishlist operations](https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/wishlistController.js): `backend/controllers/wishlistController.js`
- [Order operations](https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [User profile](https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Admin operations](https://github.com/devkaushik2112/e--fash/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`
- [JWT authorization](https://github.com/devkaushik2112/e--fash/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Commerce data

- [Product records](https://github.com/devkaushik2112/e--fash/blob/main/backend/models/Product.js): `backend/models/Product.js`
- [User records](https://github.com/devkaushik2112/e--fash/blob/main/backend/models/User.js): `backend/models/User.js`
- [Order records](https://github.com/devkaushik2112/e--fash/blob/main/backend/models/Order.js): `backend/models/Order.js`

### Other components

- **Customer**

## Connections

- Customer → App routing: uses (evidence: `README.md`)
- App routing → Product discovery: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Product detail: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Cart and checkout: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Orders and profile: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Admin workspace: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Authentication state: loads session (evidence: `frontend/src/App.tsx`)
- App routing → Cart state: loads cart (evidence: `frontend/src/App.tsx`)
- App routing → Wishlist state: loads wishlist (evidence: `frontend/src/App.tsx`)
- Product detail → Product state: dispatches (evidence: `frontend/src/pages/ProductDetail.tsx`)
- Product detail → Cart state: dispatches (evidence: `frontend/src/pages/ProductDetail.tsx`)
- Product detail → Wishlist state: dispatches (evidence: `frontend/src/pages/ProductDetail.tsx`)
- Product detail → Checkout state: dispatches (evidence: `frontend/src/pages/ProductDetail.tsx`)
- Cart and checkout → Cart state: uses
- Cart and checkout → Checkout state: uses (evidence: `frontend/src/pages/Checkout.tsx`)
- Authentication state → Express API routing: calls auth API (evidence: `frontend/src/store/slices/authSlice.ts`)
- Cart state → Express API routing: calls cart API (evidence: `frontend/src/store/slices/cartSlice.ts`)
- Product discovery → Product state: uses
- Product state → Express API routing: calls catalog API
- Wishlist state → Express API routing: calls wishlist API
- Checkout state → Express API routing: submits orders
- Orders and profile → Express API routing: requests orders
- Admin workspace → Express API routing: requests admin API
- Theme and language → Customer: localizes display
- Express API routing → Authentication: mounts auth routes (evidence: `backend/app.js`)
- Express API routing → Catalog and reviews: mounts catalog routes (evidence: `backend/app.js`)
- Express API routing → Cart operations: mounts cart routes (evidence: `backend/app.js`)
- Express API routing → Wishlist operations: mounts wishlist routes (evidence: `backend/app.js`)
- Express API routing → Order operations: mounts order routes (evidence: `backend/app.js`)
- Express API routing → User profile: mounts user routes (evidence: `backend/app.js`)
- Express API routing → Admin operations: mounts admin routes (evidence: `backend/app.js`)
- Authentication → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Cart operations → User records: updates cart (evidence: `backend/controllers/cartController.js`)
- Cart operations → Product records: looks up products (evidence: `backend/controllers/cartController.js`)
- Catalog and reviews → Product records: reads and writes (evidence: `backend/controllers/productController.js`)
- Wishlist operations → User records: updates wishlist (evidence: `backend/controllers/wishlistController.js`)
- Wishlist operations → Product records: looks up products (evidence: `backend/controllers/wishlistController.js`)
- Order operations → Order records: creates and reads (evidence: `backend/controllers/orderController.js`)
- Order operations → Product records: checks stock (evidence: `backend/controllers/orderController.js`)
- Order operations → User records: clears cart (evidence: `backend/controllers/orderController.js`)
- Admin operations → Product records: manages inventory (evidence: `backend/controllers/adminController.js`)
- Admin operations → User records: counts users (evidence: `backend/controllers/adminController.js`)
- Admin operations → Order records: reads order metrics (evidence: `backend/controllers/adminController.js`)
- JWT authorization → User records: loads identity (evidence: `backend/middleware/auth.js`)
- JWT authorization → Admin operations: protects admin routes (evidence: `backend/routes/adminRoutes.js`)
