# linganand-04/forever_full_stack architecture

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

- Interactive diagram: https://gitdiagram.com/linganand-04/forever_full_stack
- Repository: https://github.com/linganand-04/forever_full_stack

## Overview

Forever is a MERN e-commerce application with a shopper storefront, a separate admin dashboard, and an Express API. Shoppers browse/search products, manage a cart, authenticate, and place orders; administrators manage products and order status. The backend routes requests through authentication middleware to controllers and MongoDB models, with Cloudinary used for product images and payment providers supported by the order controller. Several UI capabilities are documented but their implementation was not sampled, so those links are shown only where the source index or README supports them.

Main entry points: [`frontend/src/App.jsx`](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/App.jsx) (Store routes), [`backend/routes/orderRoute.js`](https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/orderRoute.js) (Order routes), [`backend/server.js`](https://github.com/linganand-04/forever_full_stack/blob/main/backend/server.js) (API server), [`frontend/src/context/ShopContext.jsx`](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/context/ShopContext.jsx) (Shop context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopper["Shopper storefront"]
  node_store_app["Store routes<br/>[App.jsx]"]
  node_shop_context["Shop context<br/>[ShopContext.jsx]"]
  node_catalog_ui["Browse catalog<br/>[Collection.jsx]"]
  node_product_ui["Product details<br/>[Product.jsx]"]
  node_cart_ui["Shopping cart<br/>[Cart.jsx]"]
  node_checkout_ui["Checkout<br/>[PlaceOrder.jsx]"]
  node_history_ui["Order history<br/>[Orders.jsx]"]
  node_search_ui["Product search<br/>[SearchBar.jsx]"]
end

subgraph group_admin["Admin dashboard"]
  node_admin_app["Admin routes<br/>[App.jsx]"]
  node_admin_products["Product management<br/>[Add.jsx]"]
  node_admin_orders["Order management<br/>[Orders.jsx]"]
end

subgraph group_api["Backend API"]
  node_server["API server<br/>[server.js]"]
  node_user_routes["User routes<br/>[userRoute.js]"]
  node_product_routes["Product routes<br/>[productRoute.js]"]
  node_cart_routes["Cart routes<br/>[cartRoute.js]"]
  node_order_routes["Order routes<br/>[orderRoute.js]"]
  node_user_controller["Accounts and auth<br/>[userController.js]"]
  node_product_controller["Catalog operations"]
  node_cart_controller["Cart operations<br/>[cartController.js]"]
  node_order_controller["Order and payment<br/>[orderController.js]"]
  node_auth_middleware["User authorization<br/>[auth.js]"]
  node_admin_middleware["Admin authorization<br/>[adminAuth.js]"]
end

subgraph group_data["Data and services"]
  node_user_model[("User records<br/>[userModel.js]")]
  node_product_model[("Product records<br/>[productModel.js]")]
  node_order_model[("Order records<br/>[orderModel.js]")]
  node_mongo[("MongoDB<br/>[mongodb.js]")]
  node_cloudinary["Cloudinary images<br/>[cloudnary.js]"]
  node_email["Email delivery<br/>[sendEmail.js]"]
end

node_shopper(("Shopper"))
node_admin_actor(("Administrator"))
node_payments["Payment gateways"]

node_shopper -->|"uses"| node_store_app
node_store_app -->|"renders within"| node_shop_context
node_store_app -->|"routes to"| node_catalog_ui
node_store_app -->|"routes to"| node_cart_ui
node_store_app -->|"routes to"| node_product_ui
node_store_app -->|"routes to"| node_checkout_ui
node_store_app -->|"routes to"| node_history_ui
node_store_app -->|"renders"| node_search_ui
node_catalog_ui -->|"reads catalog"| node_shop_context
node_search_ui -->|"uses search state"| node_shop_context
node_shop_context -->|"requests catalog"| node_product_routes
node_shop_context -->|"requests cart"| node_cart_routes
node_checkout_ui -.->|"submits order"| node_order_routes
node_history_ui -.->|"requests orders"| node_order_routes
node_admin_actor -->|"uses"| node_admin_app
node_admin_app -->|"routes to"| node_admin_products
node_admin_app -->|"routes to"| node_admin_orders
node_admin_products -.->|"manages products"| node_product_routes
node_admin_orders -.->|"manages orders"| node_order_routes
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_product_routes
node_server -->|"mounts"| node_cart_routes
node_server -->|"mounts"| node_order_routes
node_user_routes -->|"dispatches"| node_user_controller
node_product_routes -->|"dispatches"| node_product_controller
node_cart_routes -->|"dispatches"| node_cart_controller
node_order_routes -->|"dispatches"| node_order_controller
node_order_routes -->|"protects user routes"| node_auth_middleware
node_order_routes -->|"protects admin routes"| node_admin_middleware
node_user_controller -->|"reads and writes"| node_user_model
node_user_controller -->|"sends reset mail"| node_email
node_product_controller -->|"reads and writes"| node_product_model
node_product_controller -->|"uploads images"| node_cloudinary
node_cart_controller -->|"updates cart"| node_user_model
node_order_controller -->|"reads and writes"| node_order_model
node_order_controller -->|"updates user cart"| node_user_model
node_order_controller -->|"creates and verifies payments"| node_payments
node_server -->|"connects on startup"| node_mongo
node_server -->|"initializes on startup"| node_cloudinary

click node_store_app "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/App.jsx"
click node_shop_context "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/context/ShopContext.jsx"
click node_catalog_ui "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Collection.jsx"
click node_product_ui "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Product.jsx"
click node_cart_ui "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Cart.jsx"
click node_checkout_ui "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/PlaceOrder.jsx"
click node_history_ui "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Orders.jsx"
click node_search_ui "https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/components/SearchBar.jsx"
click node_admin_app "https://github.com/linganand-04/forever_full_stack/blob/main/admin/src/App.jsx"
click node_admin_products "https://github.com/linganand-04/forever_full_stack/blob/main/admin/src/pages/Add.jsx"
click node_admin_orders "https://github.com/linganand-04/forever_full_stack/blob/main/admin/src/pages/Orders.jsx"
click node_server "https://github.com/linganand-04/forever_full_stack/blob/main/backend/server.js"
click node_user_routes "https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/userRoute.js"
click node_product_routes "https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/productRoute.js"
click node_cart_routes "https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/cartRoute.js"
click node_order_routes "https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/orderRoute.js"
click node_user_controller "https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/userController.js"
click node_product_controller "https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/productController.js"
click node_cart_controller "https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/cartController.js"
click node_order_controller "https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/orderController.js"
click node_auth_middleware "https://github.com/linganand-04/forever_full_stack/blob/main/backend/middleware/auth.js"
click node_admin_middleware "https://github.com/linganand-04/forever_full_stack/blob/main/backend/middleware/adminAuth.js"
click node_user_model "https://github.com/linganand-04/forever_full_stack/blob/main/backend/models/userModel.js"
click node_product_model "https://github.com/linganand-04/forever_full_stack/blob/main/backend/models/productModel.js"
click node_order_model "https://github.com/linganand-04/forever_full_stack/blob/main/backend/models/orderModel.js"
click node_mongo "https://github.com/linganand-04/forever_full_stack/blob/main/backend/config/mongodb.js"
click node_cloudinary "https://github.com/linganand-04/forever_full_stack/blob/main/backend/config/cloudnary.js"
click node_email "https://github.com/linganand-04/forever_full_stack/blob/main/backend/utils/sendEmail.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_store_app,node_shop_context,node_catalog_ui,node_product_ui,node_cart_ui,node_checkout_ui,node_history_ui,node_search_ui toneBlue
class node_admin_app,node_admin_products,node_admin_orders toneAmber
class node_server,node_user_routes,node_product_routes,node_cart_routes,node_order_routes,node_user_controller,node_product_controller,node_cart_controller,node_order_controller,node_auth_middleware,node_admin_middleware toneMint
class node_user_model,node_product_model,node_order_model,node_mongo,node_cloudinary,node_email toneRose
class node_shopper,node_admin_actor,node_payments toneIndigo
```

## Components

### Shopper storefront

- [Store routes](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Shop context](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/context/ShopContext.jsx): `frontend/src/context/ShopContext.jsx`
- [Browse catalog](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Collection.jsx): `frontend/src/pages/Collection.jsx`
- [Product details](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Product.jsx): `frontend/src/pages/Product.jsx`
- [Shopping cart](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Cart.jsx): `frontend/src/pages/Cart.jsx`
- [Checkout](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/PlaceOrder.jsx): `frontend/src/pages/PlaceOrder.jsx`
- [Order history](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/pages/Orders.jsx): `frontend/src/pages/Orders.jsx`
- [Product search](https://github.com/linganand-04/forever_full_stack/blob/main/frontend/src/components/SearchBar.jsx): `frontend/src/components/SearchBar.jsx`

### Admin dashboard

- [Admin routes](https://github.com/linganand-04/forever_full_stack/blob/main/admin/src/App.jsx): `admin/src/App.jsx`
- [Product management](https://github.com/linganand-04/forever_full_stack/blob/main/admin/src/pages/Add.jsx): `admin/src/pages/Add.jsx`
- [Order management](https://github.com/linganand-04/forever_full_stack/blob/main/admin/src/pages/Orders.jsx): `admin/src/pages/Orders.jsx`

### Backend API

- [API server](https://github.com/linganand-04/forever_full_stack/blob/main/backend/server.js): `backend/server.js`
- [User routes](https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/userRoute.js): `backend/routes/userRoute.js`
- [Product routes](https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/productRoute.js): `backend/routes/productRoute.js`
- [Cart routes](https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/cartRoute.js): `backend/routes/cartRoute.js`
- [Order routes](https://github.com/linganand-04/forever_full_stack/blob/main/backend/routes/orderRoute.js): `backend/routes/orderRoute.js`
- [Accounts and auth](https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Catalog operations](https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Cart operations](https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/cartController.js): `backend/controllers/cartController.js`
- [Order and payment](https://github.com/linganand-04/forever_full_stack/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [User authorization](https://github.com/linganand-04/forever_full_stack/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Admin authorization](https://github.com/linganand-04/forever_full_stack/blob/main/backend/middleware/adminAuth.js): `backend/middleware/adminAuth.js`

### Data and services

- [User records](https://github.com/linganand-04/forever_full_stack/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Product records](https://github.com/linganand-04/forever_full_stack/blob/main/backend/models/productModel.js): `backend/models/productModel.js`
- [Order records](https://github.com/linganand-04/forever_full_stack/blob/main/backend/models/orderModel.js): `backend/models/orderModel.js`
- [MongoDB](https://github.com/linganand-04/forever_full_stack/blob/main/backend/config/mongodb.js): `backend/config/mongodb.js`
- [Cloudinary images](https://github.com/linganand-04/forever_full_stack/blob/main/backend/config/cloudnary.js): `backend/config/cloudnary.js`
- [Email delivery](https://github.com/linganand-04/forever_full_stack/blob/main/backend/utils/sendEmail.js): `backend/utils/sendEmail.js`

### Other components

- **Shopper**
- **Administrator**
- **Payment gateways**

## Connections

- Shopper → Store routes: uses (evidence: `README.md`)
- Store routes → Shop context: renders within (evidence: `frontend/src/main.jsx`)
- Store routes → Browse catalog: routes to (evidence: `frontend/src/App.jsx`)
- Store routes → Shopping cart: routes to (evidence: `frontend/src/App.jsx`)
- Store routes → Product details: routes to (evidence: `frontend/src/App.jsx`)
- Store routes → Checkout: routes to (evidence: `frontend/src/App.jsx`)
- Store routes → Order history: routes to (evidence: `frontend/src/App.jsx`)
- Store routes → Product search: renders (evidence: `frontend/src/App.jsx`)
- Browse catalog → Shop context: reads catalog (evidence: `frontend/src/pages/Collection.jsx`)
- Product search → Shop context: uses search state (evidence: `frontend/src/components/SearchBar.jsx`)
- Shop context → Product routes: requests catalog (evidence: `frontend/src/context/ShopContext.jsx`)
- Shop context → Cart routes: requests cart (evidence: `frontend/src/context/ShopContext.jsx`)
- Checkout → Order routes: submits order
- Order history → Order routes: requests orders
- Administrator → Admin routes: uses (evidence: `README.md`)
- Admin routes → Product management: routes to (evidence: `admin/src/App.jsx`)
- Admin routes → Order management: routes to (evidence: `admin/src/App.jsx`)
- Product management → Product routes: manages products
- Order management → Order routes: manages orders
- API server → User routes: mounts (evidence: `backend/server.js`)
- API server → Product routes: mounts (evidence: `backend/server.js`)
- API server → Cart routes: mounts (evidence: `backend/server.js`)
- API server → Order routes: mounts (evidence: `backend/server.js`)
- User routes → Accounts and auth: dispatches (evidence: `backend/routes/userRoute.js`)
- Product routes → Catalog operations: dispatches (evidence: `backend/routes/productRoute.js`)
- Cart routes → Cart operations: dispatches (evidence: `backend/routes/cartRoute.js`)
- Order routes → Order and payment: dispatches (evidence: `backend/routes/orderRoute.js`)
- Order routes → User authorization: protects user routes (evidence: `backend/routes/orderRoute.js`)
- Order routes → Admin authorization: protects admin routes (evidence: `backend/routes/orderRoute.js`)
- Accounts and auth → User records: reads and writes (evidence: `backend/controllers/userController.js`)
- Accounts and auth → Email delivery: sends reset mail (evidence: `backend/controllers/userController.js`)
- Catalog operations → Product records: reads and writes (evidence: `backend/controllers/productController.js`)
- Catalog operations → Cloudinary images: uploads images (evidence: `backend/controllers/productController.js`)
- Cart operations → User records: updates cart (evidence: `backend/controllers/cartController.js`)
- Order and payment → Order records: reads and writes (evidence: `backend/controllers/orderController.js`)
- Order and payment → User records: updates user cart (evidence: `backend/controllers/orderController.js`)
- Order and payment → Payment gateways: creates and verifies payments (evidence: `backend/controllers/orderController.js`)
- API server → MongoDB: connects on startup (evidence: `backend/server.js`)
- API server → Cloudinary images: initializes on startup (evidence: `backend/server.js`)
