# saurabhsharma2004/blinkit_clone architecture

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

- Interactive diagram: https://gitdiagram.com/saurabhsharma2004/blinkit_clone
- Repository: https://github.com/saurabhsharma2004/blinkit_clone

## Overview

This is a full-stack commerce application: shoppers browse and search products, manage a cart, check out, and review orders; administrators manage catalog content. The React client uses routed pages and Redux-backed API operations, while an Express server exposes authentication, catalog, cart, order, and payment endpoints backed by MongoDB and external services. The graph reflects the excerpts and SOURCE INDEX; several client-page and server-controller details were not sampled, so their internal call paths are not asserted.

Main entry points: [`server/index.js`](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/index.js) (HTTP server), [`client/src/routes/index.jsx`](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/routes/index.jsx) (Page routing), [`client/src/hooks/useCategoryData.jsx`](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/hooks/useCategoryData.jsx) (Category cache), [`server/controllers/Payment.js`](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Payment.js) (Payment processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Storefront client"]
  node_app["Storefront shell<br/>[App.jsx]"]
  node_routes["Page routing<br/>[index.jsx]"]
  node_search["Product search<br/>[SearchPage.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_orders_ui["Order history<br/>[MyOrders.jsx]"]
  node_upload_ui["Product upload<br/>[UploadProducts.jsx]"]
  node_category_cache["Category cache"]
  node_category_api["Category API operations<br/>[categoryApi.js]"]
  node_subcategory_api["Subcategory API operations<br/>[subCategoryApi.js]"]
  node_product_api["Product API operations<br/>[productApi.js]"]
end

subgraph group_catalog["Catalog management"]
  node_category_routes["Category routes<br/>[categoryRoutes.js]"]
  node_category_controller["Category management<br/>[Category.js]"]
  node_subcategory_routes["Subcategory routes"]
  node_subcategory_controller["Subcategory management<br/>[SubCategory.js]"]
  node_product_routes["Product routes<br/>[ProductRoutes.js]"]
  node_product_controller["Product catalog<br/>[Product.js]"]
  node_product_model[("Product records<br/>[Product.js]")]
end

subgraph group_identity["Identity and profiles"]
  node_auth_api["Authentication operations<br/>[authApi.js]"]
  node_user_routes["User routes<br/>[userRoutes.js]"]
  node_auth_controller["Authentication<br/>[Auth.js]"]
  node_user_model[("User records<br/>[User.js]")]
end

subgraph group_commerce["Cart and orders"]
  node_cart_api["Cart operations<br/>[cartApi.js]"]
  node_order_api["Order operations<br/>[orderApi.js]"]
  node_payment_api["Payment operations<br/>[paymentApi.js]"]
  node_cart_routes["Cart routes<br/>[cartRoutes.js]"]
  node_cart_controller["Cart management<br/>[Cart.js]"]
  node_payment_routes["Payment routes<br/>[paymentRoutes.js]"]
  node_payment_controller["Payment processing<br/>[Payment.js]"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
  node_order_controller["Order history<br/>[OrderController.js]"]
  node_order_model[("Order records<br/>[Order.js]")]
end

subgraph group_platform["Server platform"]
  node_server["HTTP server<br/>[index.js]"]
end

node_shopper(("Shopper"))
node_admin(("Administrator"))

node_shopper -.->|"opens pages"| node_routes
node_admin -.->|"opens pages"| node_routes
node_routes -->|"renders shell"| node_app
node_app -->|"loads categories"| node_category_cache
node_category_cache -->|"fetches categories"| node_category_api
node_category_cache -->|"fetches subcategories"| node_subcategory_api
node_routes -->|"routes to"| node_search
node_routes -->|"routes to"| node_checkout
node_routes -->|"routes to"| node_orders_ui
node_routes -->|"routes to"| node_upload_ui
node_search -->|"searches products"| node_product_api
node_server -->|"mounts routes"| node_user_routes
node_server -->|"mounts routes"| node_category_routes
node_server -->|"mounts routes"| node_subcategory_routes
node_server -->|"mounts routes"| node_product_routes
node_server -->|"mounts routes"| node_cart_routes
node_server -->|"mounts routes"| node_payment_routes
node_server -->|"mounts routes"| node_order_routes
node_user_routes -->|"dispatches auth"| node_auth_controller
node_auth_controller -->|"reads and writes"| node_user_model
node_category_routes -->|"dispatches catalog"| node_category_controller
node_category_controller -->|"reads products"| node_product_model
node_subcategory_routes -->|"dispatches catalog"| node_subcategory_controller
node_product_routes -->|"dispatches product"| node_product_controller
node_product_controller -->|"reads and writes"| node_product_model
node_cart_routes -->|"dispatches cart"| node_cart_controller
node_payment_routes -->|"dispatches payment"| node_payment_controller
node_payment_controller -->|"reads and writes"| node_order_model
node_payment_controller -->|"uses cart logic"| node_cart_controller
node_order_routes -->|"dispatches orders"| node_order_controller
node_order_controller -->|"reads orders"| node_order_model
node_checkout -.->|"submits payment"| node_payment_api
node_product_api -.->|"HTTP requests"| node_product_routes
node_category_api -.->|"HTTP requests"| node_category_routes
node_subcategory_api -.->|"HTTP requests"| node_subcategory_routes
node_cart_api -.->|"HTTP requests"| node_cart_routes
node_order_api -.->|"HTTP requests"| node_order_routes
node_payment_api -.->|"HTTP requests"| node_payment_routes
node_auth_api -.->|"HTTP requests"| node_user_routes

click node_app "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/App.jsx"
click node_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/routes/index.jsx"
click node_search "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/SearchPage.jsx"
click node_checkout "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/Checkout.jsx"
click node_orders_ui "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/MyOrders.jsx"
click node_upload_ui "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/UploadProducts.jsx"
click node_category_cache "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/hooks/useCategoryData.jsx"
click node_category_api "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/categoryApi.js"
click node_subcategory_api "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/subCategoryApi.js"
click node_product_api "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/productApi.js"
click node_auth_api "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/authApi.js"
click node_cart_api "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/cartApi.js"
click node_order_api "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/orderApi.js"
click node_payment_api "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/paymentApi.js"
click node_server "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/index.js"
click node_user_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/userRoutes.js"
click node_auth_controller "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Auth.js"
click node_user_model "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/models/User.js"
click node_category_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/categoryRoutes.js"
click node_category_controller "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Category.js"
click node_subcategory_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/subCategoryRoutes.js"
click node_subcategory_controller "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/SubCategory.js"
click node_product_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/ProductRoutes.js"
click node_product_controller "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Product.js"
click node_product_model "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/models/Product.js"
click node_cart_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/cartRoutes.js"
click node_cart_controller "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Cart.js"
click node_payment_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/paymentRoutes.js"
click node_payment_controller "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Payment.js"
click node_order_routes "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/orderRoutes.js"
click node_order_controller "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/OrderController.js"
click node_order_model "https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/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_routes,node_search,node_checkout,node_orders_ui,node_upload_ui,node_category_cache,node_category_api,node_subcategory_api,node_product_api toneBlue
class node_category_routes,node_category_controller,node_subcategory_routes,node_subcategory_controller,node_product_routes,node_product_controller,node_product_model toneAmber
class node_auth_api,node_user_routes,node_auth_controller,node_user_model toneMint
class node_cart_api,node_order_api,node_payment_api,node_cart_routes,node_cart_controller,node_payment_routes,node_payment_controller,node_order_routes,node_order_controller,node_order_model toneRose
class node_server,node_shopper,node_admin toneIndigo
```

## Components

### Storefront client

- [Storefront shell](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Page routing](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/routes/index.jsx): `client/src/routes/index.jsx`
- [Product search](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/SearchPage.jsx): `client/src/pages/SearchPage.jsx`
- [Checkout](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/Checkout.jsx): `client/src/pages/Checkout.jsx`
- [Order history](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/MyOrders.jsx): `client/src/pages/MyOrders.jsx`
- [Product upload](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/pages/UploadProducts.jsx): `client/src/pages/UploadProducts.jsx`
- [Category cache](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/hooks/useCategoryData.jsx): `client/src/hooks/useCategoryData.jsx`
- [Category API operations](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/categoryApi.js): `client/src/services/operations/categoryApi.js`
- [Subcategory API operations](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/subCategoryApi.js): `client/src/services/operations/subCategoryApi.js`
- [Product API operations](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/productApi.js): `client/src/services/operations/productApi.js`

### Catalog management

- [Category routes](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/categoryRoutes.js): `server/routes/categoryRoutes.js`
- [Category management](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Category.js): `server/controllers/Category.js`
- [Subcategory routes](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/subCategoryRoutes.js): `server/routes/subCategoryRoutes.js`
- [Subcategory management](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/SubCategory.js): `server/controllers/SubCategory.js`
- [Product routes](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/ProductRoutes.js): `server/routes/ProductRoutes.js`
- [Product catalog](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Product.js): `server/controllers/Product.js`
- [Product records](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/models/Product.js): `server/models/Product.js`

### Identity and profiles

- [Authentication operations](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/authApi.js): `client/src/services/operations/authApi.js`
- [User routes](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/userRoutes.js): `server/routes/userRoutes.js`
- [Authentication](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Auth.js): `server/controllers/Auth.js`
- [User records](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/models/User.js): `server/models/User.js`

### Cart and orders

- [Cart operations](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/cartApi.js): `client/src/services/operations/cartApi.js`
- [Order operations](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/orderApi.js): `client/src/services/operations/orderApi.js`
- [Payment operations](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/client/src/services/operations/paymentApi.js): `client/src/services/operations/paymentApi.js`
- [Cart routes](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/cartRoutes.js): `server/routes/cartRoutes.js`
- [Cart management](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Cart.js): `server/controllers/Cart.js`
- [Payment routes](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/paymentRoutes.js): `server/routes/paymentRoutes.js`
- [Payment processing](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/Payment.js): `server/controllers/Payment.js`
- [Order routes](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/routes/orderRoutes.js): `server/routes/orderRoutes.js`
- [Order history](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/controllers/OrderController.js): `server/controllers/OrderController.js`
- [Order records](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/models/Order.js): `server/models/Order.js`

### Server platform

- [HTTP server](https://github.com/saurabhsharma2004/blinkit_clone/blob/main/server/index.js): `server/index.js`

### Other components

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

## Connections

- Shopper → Page routing: opens pages
- Administrator → Page routing: opens pages
- Page routing → Storefront shell: renders shell (evidence: `client/src/routes/index.jsx`)
- Storefront shell → Category cache: loads categories (evidence: `client/src/App.jsx`)
- Category cache → Category API operations: fetches categories (evidence: `client/src/hooks/useCategoryData.jsx`)
- Category cache → Subcategory API operations: fetches subcategories (evidence: `client/src/hooks/useCategoryData.jsx`)
- Page routing → Product search: routes to (evidence: `client/src/routes/index.jsx`)
- Page routing → Checkout: routes to (evidence: `client/src/routes/index.jsx`)
- Page routing → Order history: routes to (evidence: `client/src/routes/index.jsx`)
- Page routing → Product upload: routes to (evidence: `client/src/routes/index.jsx`)
- Product search → Product API operations: searches products (evidence: `client/src/pages/SearchPage.jsx`)
- HTTP server → User routes: mounts routes (evidence: `server/index.js`)
- HTTP server → Category routes: mounts routes (evidence: `server/index.js`)
- HTTP server → Subcategory routes: mounts routes (evidence: `server/index.js`)
- HTTP server → Product routes: mounts routes (evidence: `server/index.js`)
- HTTP server → Cart routes: mounts routes (evidence: `server/index.js`)
- HTTP server → Payment routes: mounts routes (evidence: `server/index.js`)
- HTTP server → Order routes: mounts routes (evidence: `server/index.js`)
- User routes → Authentication: dispatches auth (evidence: `server/routes/userRoutes.js`)
- Authentication → User records: reads and writes (evidence: `server/controllers/Auth.js`)
- Category routes → Category management: dispatches catalog (evidence: `server/routes/categoryRoutes.js`)
- Category management → Product records: reads products (evidence: `server/controllers/Category.js`)
- Subcategory routes → Subcategory management: dispatches catalog (evidence: `server/routes/subCategoryRoutes.js`)
- Product routes → Product catalog: dispatches product (evidence: `server/routes/ProductRoutes.js`)
- Product catalog → Product records: reads and writes (evidence: `server/controllers/Product.js`)
- Cart routes → Cart management: dispatches cart (evidence: `server/routes/cartRoutes.js`)
- Payment routes → Payment processing: dispatches payment (evidence: `server/routes/paymentRoutes.js`)
- Payment processing → Order records: reads and writes (evidence: `server/controllers/Payment.js`)
- Payment processing → Cart management: uses cart logic (evidence: `server/controllers/Payment.js`)
- Order routes → Order history: dispatches orders (evidence: `server/routes/orderRoutes.js`)
- Order history → Order records: reads orders (evidence: `server/controllers/OrderController.js`)
- Checkout → Payment operations: submits payment
- Product API operations → Product routes: HTTP requests
- Category API operations → Category routes: HTTP requests
- Subcategory API operations → Subcategory routes: HTTP requests
- Cart operations → Cart routes: HTTP requests
- Order operations → Order routes: HTTP requests
- Payment operations → Payment routes: HTTP requests
- Authentication operations → User routes: HTTP requests
