# blpk2005/marketsphere architecture

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

- Interactive diagram: https://gitdiagram.com/blpk2005/marketsphere
- Repository: https://github.com/blpk2005/marketsphere

## Overview

MarketSphere is a multi-vendor marketplace with a React client and an Express/MongoDB modular-monolith API. Buyers discover products, manage a multi-seller cart, check out, and track orders; sellers manage listings, inventory, fulfillment, plans, and analytics, while administrators moderate the platform and review marketplace analytics. The graph includes the documented feature areas and the sampled client/API entry layers. Source excerpts are partial, so unsampled internal calls are not inferred; documented API boundaries and explicitly shown imports/calls provide the relationships shown.

Main entry points: [`apps/server/src/app.js`](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/app.js) (HTTP application), [`apps/client/src/features/products`](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/products) (Product discovery), [`apps/client/src/services`](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/services) (Client services), [`apps/server/src/modules/index.js`](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/index.js) (MongoDB models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_client_router["Client routes<br/>[router.jsx]"]
  node_auth_ui["Authentication UI"]
  node_client_api["API client<br/>[api.js]"]
  node_services["Client services"]
end

subgraph group_commerce["Marketplace commerce"]
  node_catalog_ui["Product discovery"]
  node_cart_ui["Cart and checkout"]
  node_orders_ui["Buyer orders"]
  node_wishlist_ui["Wishlist"]
end

subgraph group_operations["Seller and admin operations"]
  node_seller_ui["Seller portal"]
  node_admin_ui["Admin console"]
  node_seller_api["Seller operations API"]
  node_admin_api["Admin API"]
end

subgraph group_backend["API and persistence"]
  node_server_app["HTTP application<br/>[app.js]"]
  node_auth_api["Auth API<br/>[auth.controller.js]"]
  node_catalog_api["Catalog API"]
  node_category_api["Category API"]
  node_cart_api["Cart API<br/>[cart.controller.js]"]
  node_wishlist_api["Wishlist API"]
  node_orders_api["Orders API"]
  node_analytics_api["Analytics"]
  node_uploads_api["Image uploads"]
  node_models[("MongoDB models<br/>[index.js]")]
end

node_buyer(("Buyer"))
node_cloudinary(("Cloudinary"))

node_buyer -->|"uses"| node_client_router
node_client_router -->|"routes to"| node_auth_ui
node_client_router -->|"routes to"| node_catalog_ui
node_buyer -->|"browses"| node_catalog_ui
node_catalog_ui -->|"requests catalog"| node_services
node_buyer -->|"manages cart"| node_cart_ui
node_buyer -->|"saves products"| node_wishlist_ui
node_buyer -->|"checks out"| node_orders_ui
node_cart_ui -->|"starts checkout"| node_orders_ui
node_services -->|"calls API"| node_client_api
node_client_api -->|"sends requests"| node_server_app
node_server_app -->|"mounts routes"| node_auth_api
node_server_app -->|"mounts routes"| node_catalog_api
node_server_app -->|"mounts routes"| node_category_api
node_server_app -->|"mounts routes"| node_cart_api
node_server_app -->|"mounts routes"| node_wishlist_api
node_server_app -->|"mounts routes"| node_orders_api
node_server_app -->|"mounts routes"| node_seller_api
node_server_app -->|"mounts routes"| node_admin_api
node_catalog_api -->|"uses models"| node_models
node_auth_api -->|"uses models"| node_models
node_seller_api -.->|"uses models"| node_models
node_admin_api -->|"reads and updates"| node_models
node_catalog_ui -->|"seller manages listings"| node_seller_ui
node_seller_ui -->|"uses portal services"| node_services
node_admin_ui -->|"uses admin services"| node_services
node_seller_api -.->|"provides seller metrics"| node_analytics_api
node_admin_api -.->|"provides platform metrics"| node_analytics_api
node_uploads_api -.->|"stores images"| node_cloudinary

click node_client_router "https://github.com/blpk2005/marketsphere/blob/main/apps/client/src/app/router.jsx"
click node_auth_ui "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/auth"
click node_catalog_ui "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/products"
click node_cart_ui "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/cart"
click node_orders_ui "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/orders"
click node_wishlist_ui "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/wishlist"
click node_client_api "https://github.com/blpk2005/marketsphere/blob/main/apps/client/src/lib/api.js"
click node_services "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/services"
click node_seller_ui "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/seller"
click node_admin_ui "https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/admin"
click node_server_app "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/app.js"
click node_auth_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/auth/auth.controller.js"
click node_catalog_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/products/product.controller.js"
click node_category_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/categories/category.controller.js"
click node_cart_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/cart/cart.controller.js"
click node_wishlist_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/wishlist/wishlist.controller.js"
click node_orders_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/orders/order.controller.js"
click node_seller_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/sellers/seller-portal.controller.js"
click node_admin_api "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/admin/admin.controller.js"
click node_analytics_api "https://github.com/blpk2005/marketsphere/tree/main/apps/server/src/modules/analytics"
click node_uploads_api "https://github.com/blpk2005/marketsphere/tree/main/apps/server/src/modules/uploads"
click node_models "https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/index.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_client_router,node_auth_ui,node_client_api,node_services toneBlue
class node_catalog_ui,node_cart_ui,node_orders_ui,node_wishlist_ui toneAmber
class node_seller_ui,node_admin_ui,node_seller_api,node_admin_api toneMint
class node_server_app,node_auth_api,node_catalog_api,node_category_api,node_cart_api,node_wishlist_api,node_orders_api,node_analytics_api,node_uploads_api,node_models toneRose
class node_buyer,node_cloudinary toneIndigo
```

## Components

### Client experience

- [Client routes](https://github.com/blpk2005/marketsphere/blob/main/apps/client/src/app/router.jsx): `apps/client/src/app/router.jsx`
- [Authentication UI](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/auth): `apps/client/src/features/auth`
- [API client](https://github.com/blpk2005/marketsphere/blob/main/apps/client/src/lib/api.js): `apps/client/src/lib/api.js`
- [Client services](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/services): `apps/client/src/services`

### Marketplace commerce

- [Product discovery](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/products): `apps/client/src/features/products`
- [Cart and checkout](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/cart): `apps/client/src/features/cart`
- [Buyer orders](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/orders): `apps/client/src/features/orders`
- [Wishlist](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/wishlist): `apps/client/src/features/wishlist`

### Seller and admin operations

- [Seller portal](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/seller): `apps/client/src/features/seller`
- [Admin console](https://github.com/blpk2005/marketsphere/tree/main/apps/client/src/features/admin): `apps/client/src/features/admin`
- [Seller operations API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/sellers/seller-portal.controller.js): `apps/server/src/modules/sellers/seller-portal.controller.js`
- [Admin API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/admin/admin.controller.js): `apps/server/src/modules/admin/admin.controller.js`

### API and persistence

- [HTTP application](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/app.js): `apps/server/src/app.js`
- [Auth API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/auth/auth.controller.js): `apps/server/src/modules/auth/auth.controller.js`
- [Catalog API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/products/product.controller.js): `apps/server/src/modules/products/product.controller.js`
- [Category API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/categories/category.controller.js): `apps/server/src/modules/categories/category.controller.js`
- [Cart API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/cart/cart.controller.js): `apps/server/src/modules/cart/cart.controller.js`
- [Wishlist API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/wishlist/wishlist.controller.js): `apps/server/src/modules/wishlist/wishlist.controller.js`
- [Orders API](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/orders/order.controller.js): `apps/server/src/modules/orders/order.controller.js`
- [Analytics](https://github.com/blpk2005/marketsphere/tree/main/apps/server/src/modules/analytics): `apps/server/src/modules/analytics`
- [Image uploads](https://github.com/blpk2005/marketsphere/tree/main/apps/server/src/modules/uploads): `apps/server/src/modules/uploads`
- [MongoDB models](https://github.com/blpk2005/marketsphere/blob/main/apps/server/src/modules/index.js): `apps/server/src/modules/index.js`

### Other components

- **Buyer**
- **Cloudinary**

## Connections

- Buyer → Client routes: uses (evidence: `README.md`)
- Client routes → Authentication UI: routes to (evidence: `apps/client/src/app/router.jsx`)
- Client routes → Product discovery: routes to (evidence: `apps/client/src/app/router.jsx`)
- Buyer → Product discovery: browses (evidence: `README.md`)
- Product discovery → Client services: requests catalog (evidence: `apps/client/src/features/products/useProducts.js`)
- Buyer → Cart and checkout: manages cart (evidence: `README.md`)
- Buyer → Wishlist: saves products (evidence: `README.md`)
- Buyer → Buyer orders: checks out (evidence: `README.md`)
- Cart and checkout → Buyer orders: starts checkout (evidence: `README.md`)
- Client services → API client: calls API (evidence: `apps/client/src/services/product.service.js`)
- API client → HTTP application: sends requests (evidence: `README.md`)
- HTTP application → Auth API: mounts routes (evidence: `apps/server/src/app.js`)
- HTTP application → Catalog API: mounts routes (evidence: `apps/server/src/app.js`)
- HTTP application → Category API: mounts routes (evidence: `apps/server/src/app.js`)
- HTTP application → Cart API: mounts routes (evidence: `apps/server/src/app.js`)
- HTTP application → Wishlist API: mounts routes (evidence: `apps/server/src/app.js`)
- HTTP application → Orders API: mounts routes (evidence: `apps/server/src/app.js`)
- HTTP application → Seller operations API: mounts routes (evidence: `apps/server/src/app.js`)
- HTTP application → Admin API: mounts routes (evidence: `apps/server/src/app.js`)
- Catalog API → MongoDB models: uses models
- Auth API → MongoDB models: uses models
- Seller operations API → MongoDB models: uses models
- Admin API → MongoDB models: reads and updates (evidence: `apps/server/src/modules/admin/admin.controller.js`)
- Product discovery → Seller portal: seller manages listings (evidence: `README.md`)
- Seller portal → Client services: uses portal services (evidence: `apps/client/src/features/seller/useSeller.js`)
- Admin console → Client services: uses admin services (evidence: `apps/client/src/features/admin/useAdmin.js`)
- Seller operations API → Analytics: provides seller metrics (evidence: `README.md`)
- Admin API → Analytics: provides platform metrics (evidence: `README.md`)
- Image uploads → Cloudinary: stores images (evidence: `README.md`)
