# zeekygeekfreelance/nmpl_ecom architecture

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

- Interactive diagram: https://gitdiagram.com/zeekygeekfreelance/nmpl_ecom
- Repository: https://github.com/zeekygeekfreelance/nmpl_ecom

## Overview

NMPL Ecom is a role-based ecommerce platform with a Next.js storefront and administration client backed by an Express/Apollo API. The main customer journey is browsing and filtering products, adding items to a cart, checking out, paying, and viewing orders; dealers and administrators have separate account and management workflows. The tree also documents catalog, inventory, analytics, reporting, and payment operations. Edges are limited to relationships evidenced by README statements or shown imports/calls; unsampled server wiring is not inferred.

Main entry points: [`src/server/src/app.ts`](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/app.ts) (REST and GraphQL API), [`src/client/app/(public)/shop/ShopPageClient.tsx`](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/shop/ShopPageClient.tsx) (Product browsing), [`src/client/app/(private)/dashboard/products/page.tsx`](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/dashboard/products/page.tsx) (Catalog management), [`src/client/app/(public)/(home)/index.tsx`](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/(home)/index.tsx) (Storefront)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_storefront["Storefront<br/>[index.tsx]"]
  node_shop["Product browsing<br/>[ShopPageClient.tsx]"]
  node_filters["Product filters<br/>[ProductFilters.tsx]"]
  node_productcard["Product cards<br/>[ProductCard.tsx]"]
  node_productdetail["Product details"]
  node_userauth["Accounts and roles<br/>[auth.service.ts]"]
  node_profile["Customer orders<br/>[page.tsx]"]
  node_clientruntime["Client data layer<br/>[apolloClient.ts]"]
end

subgraph group_commerce["Commerce operations"]
  node_cart["Shopping cart<br/>[page.tsx]"]
  node_checkout["Checkout"]
  node_payment["Payments"]
  node_orders["Orders<br/>[order.service.ts]"]
  node_transactions["Transactions"]
end

subgraph group_management["Management and insights"]
  node_dealer["Dealer workflows<br/>[page.tsx]"]
  node_admincatalog["Catalog management<br/>[page.tsx]"]
  node_inventory["Inventory and restock<br/>[page.tsx]"]
  node_analytics["Analytics"]
  node_reports["Reports and exports<br/>[reports.service.ts]"]
end

subgraph group_platform["API and infrastructure"]
  node_api["REST and GraphQL API<br/>[app.ts]"]
  node_database[("PostgreSQL<br/>[database.config.ts]")]
  node_redis[("Redis cache<br/>[redis.ts]")]
end

node_shopper(("Shopper"))
node_razorpay["Razorpay"]
node_cloudinary["Cloudinary"]

node_shopper -->|"browses"| node_storefront
node_storefront -.->|"opens catalog"| node_shop
node_shop -->|"renders"| node_filters
node_shop -->|"renders"| node_productcard
node_shopper -.->|"adds products"| node_cart
node_cart -.->|"starts checkout"| node_checkout
node_checkout -.->|"processes payment"| node_payment
node_payment -->|"creates payment"| node_razorpay
node_shopper -.->|"registers or signs in"| node_userauth
node_shopper -.->|"views orders"| node_profile
node_dealer -->|"requests dealer access"| node_userauth
node_admincatalog -.->|"manages catalog"| node_api
node_inventory -.->|"manages stock"| node_api
node_analytics -.->|"serves analytics"| node_api
node_reports -->|"serves reports"| node_api
node_transactions -.->|"serves transactions"| node_api
node_shop -.->|"loads data"| node_clientruntime
node_clientruntime -->|"calls API"| node_api
node_api -.->|"uses database"| node_database
node_api -.->|"uses cache"| node_redis
node_admincatalog -->|"uploads images"| node_cloudinary
node_orders -.->|"persists orders"| node_database

click node_storefront "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/(home)/index.tsx"
click node_shop "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/shop/ShopPageClient.tsx"
click node_filters "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/shop/ProductFilters.tsx"
click node_productcard "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/product/ProductCard.tsx"
click node_productdetail "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/product/%5Bslug%5D/ProductDetailsClient.tsx"
click node_cart "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/cart/page.tsx"
click node_checkout "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/checkout/checkout.service.ts"
click node_payment "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/payment/comprehensivePayment.service.ts"
click node_orders "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/order/order.service.ts"
click node_userauth "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/auth/auth.service.ts"
click node_profile "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/(user)/orders/page.tsx"
click node_dealer "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/dashboard/dealers/page.tsx"
click node_admincatalog "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/dashboard/products/page.tsx"
click node_inventory "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/dashboard/inventory/page.tsx"
click node_analytics "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/analytics/analytics.service.ts"
click node_reports "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/reports/reports.service.ts"
click node_transactions "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/transaction/transaction.service.ts"
click node_clientruntime "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/lib/apolloClient.ts"
click node_api "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/app.ts"
click node_database "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/infra/database/database.config.ts"
click node_redis "https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/infra/cache/redis.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_shop,node_filters,node_productcard,node_productdetail,node_userauth,node_profile,node_clientruntime toneBlue
class node_cart,node_checkout,node_payment,node_orders,node_transactions toneAmber
class node_dealer,node_admincatalog,node_inventory,node_analytics,node_reports toneMint
class node_api,node_database,node_redis toneRose
class node_shopper,node_razorpay,node_cloudinary toneIndigo
```

## Components

### Client experience

- [Storefront](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/(home)/index.tsx): `src/client/app/(public)/(home)/index.tsx`
- [Product browsing](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/shop/ShopPageClient.tsx): `src/client/app/(public)/shop/ShopPageClient.tsx`
- [Product filters](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/shop/ProductFilters.tsx): `src/client/app/(public)/shop/ProductFilters.tsx`
- [Product cards](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/product/ProductCard.tsx): `src/client/app/(public)/product/ProductCard.tsx`
- [Product details](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/product/%5Bslug%5D/ProductDetailsClient.tsx): `src/client/app/(public)/product/[slug]/ProductDetailsClient.tsx`
- [Accounts and roles](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/auth/auth.service.ts): `src/server/src/modules/auth/auth.service.ts`
- [Customer orders](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/(user)/orders/page.tsx): `src/client/app/(private)/(user)/orders/page.tsx`
- [Client data layer](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/lib/apolloClient.ts): `src/client/app/lib/apolloClient.ts`

### Commerce operations

- [Shopping cart](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(public)/cart/page.tsx): `src/client/app/(public)/cart/page.tsx`
- [Checkout](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/checkout/checkout.service.ts): `src/server/src/modules/checkout/checkout.service.ts`
- [Payments](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/payment/comprehensivePayment.service.ts): `src/server/src/modules/payment/comprehensivePayment.service.ts`
- [Orders](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/order/order.service.ts): `src/server/src/modules/order/order.service.ts`
- [Transactions](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/transaction/transaction.service.ts): `src/server/src/modules/transaction/transaction.service.ts`

### Management and insights

- [Dealer workflows](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/dashboard/dealers/page.tsx): `src/client/app/(private)/dashboard/dealers/page.tsx`
- [Catalog management](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/dashboard/products/page.tsx): `src/client/app/(private)/dashboard/products/page.tsx`
- [Inventory and restock](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/client/app/(private)/dashboard/inventory/page.tsx): `src/client/app/(private)/dashboard/inventory/page.tsx`
- [Analytics](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/analytics/analytics.service.ts): `src/server/src/modules/analytics/analytics.service.ts`
- [Reports and exports](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/modules/reports/reports.service.ts): `src/server/src/modules/reports/reports.service.ts`

### API and infrastructure

- [REST and GraphQL API](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/app.ts): `src/server/src/app.ts`
- [PostgreSQL](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/infra/database/database.config.ts): `src/server/src/infra/database/database.config.ts`
- [Redis cache](https://github.com/zeekygeekfreelance/nmpl_ecom/blob/main/src/server/src/infra/cache/redis.ts): `src/server/src/infra/cache/redis.ts`

### Other components

- **Shopper**
- **Razorpay**
- **Cloudinary**

## Connections

- Shopper → Storefront: browses (evidence: `README.md`)
- Storefront → Product browsing: opens catalog
- Product browsing → Product filters: renders (evidence: `src/client/app/(public)/shop/ShopPageClient.tsx`)
- Product browsing → Product cards: renders (evidence: `src/client/app/(public)/shop/ShopPageClient.tsx`)
- Shopper → Shopping cart: adds products
- Shopping cart → Checkout: starts checkout
- Checkout → Payments: processes payment
- Payments → Razorpay: creates payment
- Shopper → Accounts and roles: registers or signs in
- Shopper → Customer orders: views orders
- Dealer workflows → Accounts and roles: requests dealer access (evidence: `src/server/src/modules/auth/auth.service.ts`)
- Catalog management → REST and GraphQL API: manages catalog
- Inventory and restock → REST and GraphQL API: manages stock
- Analytics → REST and GraphQL API: serves analytics
- Reports and exports → REST and GraphQL API: serves reports
- Transactions → REST and GraphQL API: serves transactions
- Product browsing → Client data layer: loads data
- Client data layer → REST and GraphQL API: calls API (evidence: `README.md`)
- REST and GraphQL API → PostgreSQL: uses database (evidence: `README.md`)
- REST and GraphQL API → Redis cache: uses cache (evidence: `README.md`)
- Catalog management → Cloudinary: uploads images
- Orders → PostgreSQL: persists orders
