# bhavya-jaiswal-hub/marketplace architecture

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

- Interactive diagram: https://gitdiagram.com/bhavya-jaiswal-hub/marketplace
- Repository: https://github.com/bhavya-jaiswal-hub/marketplace

## Overview

This is a multi-vendor marketplace: shoppers browse products, manage a cart, check out, and track orders; sellers manage profiles and products; administrators oversee categories, returns, settlements, and reporting. The frontend is a Next.js application and the backend is a NestJS API, with Prisma-backed persistence. The excerpts establish selected controller-to-service calls and authentication behavior; several business services and frontend integrations are indexed but not shown, so their unverified connections are omitted.

Main entry points: [`backend/src/prisma.service.ts`](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/prisma.service.ts) (Database), [`backend/src/seller/seller.service.ts`](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/seller/seller.service.ts) (Seller Management), [`backend/src/category/category.service.ts`](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/category/category.service.ts) (Categories), [`backend/src/product/product.service.ts`](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/product/product.service.ts) (Product Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Shopping"]
  node_storefront["Storefront<br/>[page.tsx]"]
  node_product_pages["Product Pages"]
  node_cart_checkout["Cart &amp; Checkout<br/>[page.tsx]"]
  node_order_pages["Order Pages"]
  node_product_api["Product API"]
  node_product_logic["Product Catalog<br/>[product.service.ts]"]
  node_cart_logic["Cart<br/>[cart.service.ts]"]
  node_order_api["Order API"]
  node_order_logic["Orders<br/>[order.service.ts]"]
  node_payment_logic["Payments<br/>[payment.service.ts]"]
  node_returns["Returns &amp; Refunds"]
end

subgraph group_seller["Seller Operations"]
  node_seller_api["Seller API"]
  node_seller_logic["Seller Management<br/>[seller.service.ts]"]
  node_storage["Document Storage<br/>[storage.service.ts]"]
end

subgraph group_admin["Marketplace Administration"]
  node_category_api["Category API"]
  node_category_logic["Categories"]
  node_inventory["Inventory"]
  node_settlements["Settlements"]
  node_reporting["Reporting"]
end

subgraph group_platform["Platform Services"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_auth_guard["Session Guard<br/>[auth.guard.ts]"]
  node_roles_guard["Role Guard<br/>[roles.guard.ts]"]
  node_email["Email<br/>[email.service.ts]"]
  node_notifications["Notifications"]
  node_audit["Audit<br/>[audit.service.ts]"]
  node_database[("Database<br/>[prisma.service.ts]")]
end

node_shopper(("Shopper"))

node_shopper -.->|"browses"| node_storefront
node_shopper -.->|"views products"| node_product_pages
node_shopper -.->|"checks out"| node_cart_checkout
node_shopper -.->|"tracks orders"| node_order_pages
node_product_api -->|"calls"| node_product_logic
node_order_api -->|"calls"| node_order_logic
node_seller_api -->|"calls"| node_seller_logic
node_seller_logic -->|"uses"| node_storage
node_category_api -->|"calls"| node_category_logic
node_auth -->|"sends reset email"| node_email
node_auth_guard -->|"checks session"| node_database
node_product_logic -.->|"persists catalog"| node_database
node_order_logic -.->|"persists orders"| node_database
node_category_logic -->|"reads and writes"| node_database
node_seller_logic -->|"reads and writes"| node_database
node_inventory -.->|"reads and writes"| node_database
node_notifications -.->|"sends email"| node_email
node_category_logic -.->|"records actions"| node_audit

click node_storefront "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/frontend/src/app/page.tsx"
click node_product_pages "https://github.com/bhavya-jaiswal-hub/marketplace/tree/main/frontend/src/app/products"
click node_cart_checkout "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/frontend/src/app/checkout/page.tsx"
click node_order_pages "https://github.com/bhavya-jaiswal-hub/marketplace/tree/main/frontend/src/app/orders"
click node_product_api "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/product/product.controller.ts"
click node_product_logic "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/product/product.service.ts"
click node_cart_logic "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/cart/cart.service.ts"
click node_order_api "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/order/order.controller.ts"
click node_order_logic "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/order/order.service.ts"
click node_payment_logic "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/payment/payment.service.ts"
click node_returns "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/return-refund/return-refund.service.ts"
click node_seller_api "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/seller/seller.controller.ts"
click node_seller_logic "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/seller/seller.service.ts"
click node_storage "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/storage/storage.service.ts"
click node_category_api "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/category/category.controller.ts"
click node_category_logic "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/category/category.service.ts"
click node_inventory "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/inventory/inventory.service.ts"
click node_settlements "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/settlement/settlement.service.ts"
click node_reporting "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/reporting/reporting.service.ts"
click node_auth "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/auth/auth.service.ts"
click node_auth_guard "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/auth/auth.guard.ts"
click node_roles_guard "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/auth/roles.guard.ts"
click node_email "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/email/email.service.ts"
click node_notifications "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/notification/notification.service.ts"
click node_audit "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/audit/audit.service.ts"
click node_database "https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/prisma.service.ts"

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_storefront,node_product_pages,node_cart_checkout,node_order_pages,node_product_api,node_product_logic,node_cart_logic,node_order_api,node_order_logic,node_payment_logic,node_returns toneBlue
class node_seller_api,node_seller_logic,node_storage toneAmber
class node_category_api,node_category_logic,node_inventory,node_settlements,node_reporting toneMint
class node_auth,node_auth_guard,node_roles_guard,node_email,node_notifications,node_audit,node_database toneRose
class node_shopper toneIndigo
```

## Components

### Shopping

- [Storefront](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Product Pages](https://github.com/bhavya-jaiswal-hub/marketplace/tree/main/frontend/src/app/products): `frontend/src/app/products`
- [Cart & Checkout](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/frontend/src/app/checkout/page.tsx): `frontend/src/app/checkout/page.tsx`
- [Order Pages](https://github.com/bhavya-jaiswal-hub/marketplace/tree/main/frontend/src/app/orders): `frontend/src/app/orders`
- [Product API](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/product/product.controller.ts): `backend/src/product/product.controller.ts`
- [Product Catalog](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/product/product.service.ts): `backend/src/product/product.service.ts`
- [Cart](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/cart/cart.service.ts): `backend/src/cart/cart.service.ts`
- [Order API](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/order/order.controller.ts): `backend/src/order/order.controller.ts`
- [Orders](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/order/order.service.ts): `backend/src/order/order.service.ts`
- [Payments](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/payment/payment.service.ts): `backend/src/payment/payment.service.ts`
- [Returns & Refunds](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/return-refund/return-refund.service.ts): `backend/src/return-refund/return-refund.service.ts`

### Seller Operations

- [Seller API](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/seller/seller.controller.ts): `backend/src/seller/seller.controller.ts`
- [Seller Management](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/seller/seller.service.ts): `backend/src/seller/seller.service.ts`
- [Document Storage](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/storage/storage.service.ts): `backend/src/storage/storage.service.ts`

### Marketplace Administration

- [Category API](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/category/category.controller.ts): `backend/src/category/category.controller.ts`
- [Categories](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/category/category.service.ts): `backend/src/category/category.service.ts`
- [Inventory](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/inventory/inventory.service.ts): `backend/src/inventory/inventory.service.ts`
- [Settlements](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/settlement/settlement.service.ts): `backend/src/settlement/settlement.service.ts`
- [Reporting](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/reporting/reporting.service.ts): `backend/src/reporting/reporting.service.ts`

### Platform Services

- [Authentication](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [Session Guard](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/auth/auth.guard.ts): `backend/src/auth/auth.guard.ts`
- [Role Guard](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/auth/roles.guard.ts): `backend/src/auth/roles.guard.ts`
- [Email](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/email/email.service.ts): `backend/src/email/email.service.ts`
- [Notifications](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/notification/notification.service.ts): `backend/src/notification/notification.service.ts`
- [Audit](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/audit/audit.service.ts): `backend/src/audit/audit.service.ts`
- [Database](https://github.com/bhavya-jaiswal-hub/marketplace/blob/main/backend/src/prisma.service.ts): `backend/src/prisma.service.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Storefront: browses
- Shopper → Product Pages: views products
- Shopper → Cart & Checkout: checks out
- Shopper → Order Pages: tracks orders
- Product API → Product Catalog: calls (evidence: `backend/src/product/product.controller.ts`)
- Order API → Orders: calls (evidence: `backend/src/order/order.controller.ts`)
- Seller API → Seller Management: calls (evidence: `backend/src/seller/seller.controller.ts`)
- Seller Management → Document Storage: uses (evidence: `backend/src/seller/seller.service.ts`)
- Category API → Categories: calls (evidence: `backend/src/category/category.controller.ts`)
- Authentication → Email: sends reset email (evidence: `backend/src/auth/auth.service.ts`)
- Session Guard → Database: checks session (evidence: `backend/src/auth/auth.guard.ts`)
- Product Catalog → Database: persists catalog
- Orders → Database: persists orders
- Categories → Database: reads and writes (evidence: `backend/src/category/category.service.ts`)
- Seller Management → Database: reads and writes (evidence: `backend/src/seller/seller.service.ts`)
- Inventory → Database: reads and writes (evidence: `backend/src/inventory/inventory.service.ts`)
- Notifications → Email: sends email (evidence: `backend/src/notification/notification.service.ts`)
- Categories → Audit: records actions (evidence: `backend/src/category/category.service.ts`)
