# puneet987720-creator/snapcart architecture

> Architecture diagram of the GitHub repository puneet987720-creator/snapcart, 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/puneet987720-creator/snapcart
- Repository: https://github.com/puneet987720-creator/snapcart

## Overview

Snapcart is a MERN shopping application. Shoppers browse and filter products, manage a cart, check out with a delivery address, pay through Razorpay, and view orders; account registration and email verification support that flow. The graph preserves the documented payment and order-confirmation capabilities, but the excerpts do not show the complete checkout wiring or email-confirmation delivery mechanism, so those links are marked unverified or omitted.

Main entry points: [`Backend/script.js`](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/script.js) (Express server), [`frontend/src/router/App.jsx`](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/App.jsx) (Application shell), [`Backend/controler/ordercontroler.js`](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/ordercontroler.js) (Order operations), [`frontend/src/router/cartRoutes.jsx`](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/cartRoutes.jsx) (Cart and order routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Shopping experience"]
  node_app["Application shell<br/>[App.jsx]"]
  node_product_routes["Product routes<br/>[productRoutes.jsx]"]
  node_product_browse["Browse and filter<br/>[filterProduct.jsx]"]
  node_product_service["Product API client<br/>[poducts.jsx]"]
  node_cart_state["Cart state"]
  node_cart_routes["Cart and order routes<br/>[cartRoutes.jsx]"]
  node_checkout["Checkout and payment<br/>[OrderCheckout.jsx]"]
  node_order_views["Order views<br/>[AllPlacedOrder.jsx]"]
  node_order_service["Order API client<br/>[order.jsx]"]
  node_auth_routes["Authentication routes<br/>[auth-routes.jsx]"]
  node_auth_views["Signup and login<br/>[Signup.jsx]"]
  node_auth_service["Authorization client<br/>[authorization.jsx]"]
  node_api_config["API configuration<br/>[apiConfig.js]"]
end

subgraph group_backend["Application services"]
  node_server["Express server<br/>[script.js]"]
  node_product_routes_api["Product endpoints<br/>[productroutes.js]"]
  node_product_controller["Product operations"]
  node_cart_controller["Cart operations<br/>[cartControler.js]"]
  node_auth_routes_api["Authentication endpoints<br/>[authroutes.js]"]
  node_auth_controller["Account operations<br/>[authcontroler.js]"]
  node_order_routes_api["Order and payment endpoints<br/>[orderRoutes.js]"]
  node_order_controller["Order operations<br/>[ordercontroler.js]"]
end

subgraph group_data["Persistent data"]
  node_auth_model[("Account records<br/>[auth.js]")]
  node_product_model[("Product records<br/>[products.js]")]
  node_cart_model[("Cart records<br/>[cart.js]")]
  node_order_model[("Order records<br/>[order.js]")]
end

subgraph group_integrations["External integrations"]
  node_email_verify["Email verification<br/>[EmailVerify.js]"]
  node_payment_verify["Payment verification"]
  node_razorpay["Razorpay"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_product_routes
node_app -->|"routes to"| node_cart_routes
node_app -->|"routes to"| node_auth_routes
node_product_routes -->|"renders"| node_product_browse
node_product_browse -->|"requests products"| node_product_service
node_cart_routes -->|"renders"| node_checkout
node_cart_routes -->|"renders"| node_order_views
node_order_views -->|"requests orders"| node_order_service
node_auth_routes -->|"renders"| node_auth_views
node_auth_views -->|"calls"| node_auth_service
node_auth_service -->|"uses base URL"| node_api_config
node_product_service -->|"uses base URL"| node_api_config
node_cart_state -->|"uses"| node_product_service
node_server -->|"mounts"| node_product_routes_api
node_server -.->|"mounts routes"| node_cart_controller
node_server -->|"mounts"| node_auth_routes_api
node_server -->|"mounts"| node_order_routes_api
node_product_routes_api -->|"dispatches"| node_product_controller
node_auth_routes_api -->|"dispatches"| node_auth_controller
node_order_routes_api -->|"dispatches"| node_order_controller
node_product_controller -->|"reads and writes"| node_product_model
node_product_controller -->|"uses"| node_auth_model
node_cart_controller -->|"reads and writes"| node_cart_model
node_cart_controller -->|"reads"| node_product_model
node_auth_controller -->|"reads and writes"| node_auth_model
node_auth_controller -->|"uses"| node_email_verify
node_order_controller -->|"reads and writes"| node_order_model
node_order_controller -->|"verifies payment"| node_payment_verify
node_checkout -.->|"submits orders"| node_order_service
node_checkout -.->|"pays through"| node_razorpay
node_order_controller -.->|"integrates payments"| node_razorpay

click node_app "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/App.jsx"
click node_product_routes "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/productRoutes.jsx"
click node_product_browse "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Products.jsx/filterProduct.jsx"
click node_product_service "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/poducts.jsx"
click node_cart_state "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/Store/addToCart-Store.jsx"
click node_cart_routes "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/cartRoutes.jsx"
click node_checkout "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Order/OrderCheckout.jsx"
click node_order_views "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Order/AllPlacedOrder.jsx"
click node_order_service "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/order.jsx"
click node_auth_routes "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/auth-routes.jsx"
click node_auth_views "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Auth/Signup.jsx"
click node_auth_service "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/authorization.jsx"
click node_api_config "https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/apiConfig.js"
click node_server "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/script.js"
click node_product_routes_api "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/routes/productroutes.js"
click node_product_controller "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/productControler.js"
click node_cart_controller "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/cartControler.js"
click node_auth_routes_api "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/routes/authroutes.js"
click node_auth_controller "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/authcontroler.js"
click node_order_routes_api "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/routes/orderRoutes.js"
click node_order_controller "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/ordercontroler.js"
click node_auth_model "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/auth.js"
click node_product_model "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/products.js"
click node_cart_model "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/cart.js"
click node_order_model "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/order.js"
click node_email_verify "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/VerifyEmail/EmailVerify.js"
click node_payment_verify "https://github.com/puneet987720-creator/snapcart/blob/main/Backend/utils/paymentVerification.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_product_routes,node_product_browse,node_product_service,node_cart_state,node_cart_routes,node_checkout,node_order_views,node_order_service,node_auth_routes,node_auth_views,node_auth_service,node_api_config toneBlue
class node_server,node_product_routes_api,node_product_controller,node_cart_controller,node_auth_routes_api,node_auth_controller,node_order_routes_api,node_order_controller toneAmber
class node_auth_model,node_product_model,node_cart_model,node_order_model toneMint
class node_email_verify,node_payment_verify,node_razorpay toneRose
class node_shopper toneIndigo
```

## Components

### Shopping experience

- [Application shell](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/App.jsx): `frontend/src/router/App.jsx`
- [Product routes](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/productRoutes.jsx): `frontend/src/router/productRoutes.jsx`
- [Browse and filter](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Products.jsx/filterProduct.jsx): `frontend/src/components/Products.jsx/filterProduct.jsx`
- [Product API client](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/poducts.jsx): `frontend/src/services/poducts.jsx`
- [Cart state](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/Store/addToCart-Store.jsx): `frontend/src/Store/addToCart-Store.jsx`
- [Cart and order routes](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/cartRoutes.jsx): `frontend/src/router/cartRoutes.jsx`
- [Checkout and payment](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Order/OrderCheckout.jsx): `frontend/src/components/Order/OrderCheckout.jsx`
- [Order views](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Order/AllPlacedOrder.jsx): `frontend/src/components/Order/AllPlacedOrder.jsx`
- [Order API client](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/order.jsx): `frontend/src/services/order.jsx`
- [Authentication routes](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/router/auth-routes.jsx): `frontend/src/router/auth-routes.jsx`
- [Signup and login](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/components/Auth/Signup.jsx): `frontend/src/components/Auth/Signup.jsx`
- [Authorization client](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/authorization.jsx): `frontend/src/services/authorization.jsx`
- [API configuration](https://github.com/puneet987720-creator/snapcart/blob/main/frontend/src/services/apiConfig.js): `frontend/src/services/apiConfig.js`

### Application services

- [Express server](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/script.js): `Backend/script.js`
- [Product endpoints](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/routes/productroutes.js): `Backend/routes/productroutes.js`
- [Product operations](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/productControler.js): `Backend/controler/productControler.js`
- [Cart operations](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/cartControler.js): `Backend/controler/cartControler.js`
- [Authentication endpoints](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/routes/authroutes.js): `Backend/routes/authroutes.js`
- [Account operations](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/authcontroler.js): `Backend/controler/authcontroler.js`
- [Order and payment endpoints](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/routes/orderRoutes.js): `Backend/routes/orderRoutes.js`
- [Order operations](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/controler/ordercontroler.js): `Backend/controler/ordercontroler.js`

### Persistent data

- [Account records](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/auth.js): `Backend/models/auth.js`
- [Product records](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/products.js): `Backend/models/products.js`
- [Cart records](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/cart.js): `Backend/models/cart.js`
- [Order records](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/models/order.js): `Backend/models/order.js`

### External integrations

- [Email verification](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/VerifyEmail/EmailVerify.js): `Backend/VerifyEmail/EmailVerify.js`
- [Payment verification](https://github.com/puneet987720-creator/snapcart/blob/main/Backend/utils/paymentVerification.js): `Backend/utils/paymentVerification.js`
- **Razorpay**

### Other components

- **Shopper**

## Connections

- Shopper → Application shell: uses
- Application shell → Product routes: routes to (evidence: `frontend/src/main.jsx`)
- Application shell → Cart and order routes: routes to (evidence: `frontend/src/main.jsx`)
- Application shell → Authentication routes: routes to (evidence: `frontend/src/main.jsx`)
- Product routes → Browse and filter: renders (evidence: `frontend/src/router/productRoutes.jsx`)
- Browse and filter → Product API client: requests products (evidence: `frontend/src/components/Products.jsx/filterProduct.jsx`)
- Cart and order routes → Checkout and payment: renders (evidence: `frontend/src/router/cartRoutes.jsx`)
- Cart and order routes → Order views: renders (evidence: `frontend/src/router/cartRoutes.jsx`)
- Order views → Order API client: requests orders (evidence: `frontend/src/components/Order/AllPlacedOrder.jsx`)
- Authentication routes → Signup and login: renders (evidence: `frontend/src/router/auth-routes.jsx`)
- Signup and login → Authorization client: calls (evidence: `frontend/src/components/Auth/Signup.jsx`)
- Authorization client → API configuration: uses base URL (evidence: `frontend/src/services/authorization.jsx`)
- Product API client → API configuration: uses base URL (evidence: `frontend/src/services/poducts.jsx`)
- Cart state → Product API client: uses (evidence: `frontend/src/Store/addToCart-Store.jsx`)
- Express server → Product endpoints: mounts (evidence: `Backend/script.js`)
- Express server → Cart operations: mounts routes
- Express server → Authentication endpoints: mounts (evidence: `Backend/script.js`)
- Express server → Order and payment endpoints: mounts (evidence: `Backend/script.js`)
- Product endpoints → Product operations: dispatches (evidence: `Backend/routes/productroutes.js`)
- Authentication endpoints → Account operations: dispatches (evidence: `Backend/routes/authroutes.js`)
- Order and payment endpoints → Order operations: dispatches (evidence: `Backend/routes/orderRoutes.js`)
- Product operations → Product records: reads and writes (evidence: `Backend/controler/productControler.js`)
- Product operations → Account records: uses (evidence: `Backend/controler/productControler.js`)
- Cart operations → Cart records: reads and writes (evidence: `Backend/controler/cartControler.js`)
- Cart operations → Product records: reads (evidence: `Backend/controler/cartControler.js`)
- Account operations → Account records: reads and writes (evidence: `Backend/controler/authcontroler.js`)
- Account operations → Email verification: uses (evidence: `Backend/controler/authcontroler.js`)
- Order operations → Order records: reads and writes (evidence: `Backend/controler/ordercontroler.js`)
- Order operations → Payment verification: verifies payment (evidence: `Backend/controler/ordercontroler.js`)
- Checkout and payment → Order API client: submits orders
- Checkout and payment → Razorpay: pays through (evidence: `README.md`)
- Order operations → Razorpay: integrates payments (evidence: `README.md`)
