# hdng-ai/sales-portal architecture

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

- Interactive diagram: https://gitdiagram.com/hdng-ai/sales-portal
- Repository: https://github.com/hdng-ai/sales-portal

## Overview

Sales Portal is a multi-tenant Nuxt storefront: hostname and market context select a merchant’s configuration, then shoppers browse, search, configure products, and purchase; authenticated business users also manage portal data. The graph preserves the documented CMS, tenant, and commerce branches. It shows the search page’s observed API calls and otherwise uses the documented API/service architecture; unsampled route-to-service wiring is therefore represented only at the subsystem level.

Main entry points: [`server/services/index.ts`](https://github.com/hdng-ai/sales-portal/blob/main/server/services/index.ts) (Service Layer), [`app/components/checkout`](https://github.com/hdng-ai/sales-portal/tree/main/app/components/checkout) (Cart and Checkout UI), [`app/pages/s/[query].vue`](https://github.com/hdng-ai/sales-portal/blob/main/app/pages/s/%5Bquery%5D.vue) (Catalog and Search), [`app/pages/portal`](https://github.com/hdng-ai/sales-portal/tree/main/app/pages/portal) (Business Portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tenant["Tenant Platform"]
  node_tenant_middleware["Tenant Context"]
  node_tenant_plugins["Tenant Setup"]
  node_tenant_config["Tenant Configuration<br/>[tenant-config.ts]"]
  node_tenant_utils["Tenant Resolution<br/>[tenant.ts]"]
  node_service_layer["Service Layer<br/>[index.ts]"]
end

subgraph group_storefront["Storefront Experience"]
  node_pages["Storefront Routes"]
  node_catalog_pages["Catalog and Search<br/>[&#91;query&#93;.vue]"]
  node_product_api["Product APIs"]
  node_search_api["Search API<br/>[products.get.ts]"]
  node_product_services["Catalog Services<br/>[product-lists.ts]"]
  node_search_service["Search Service<br/>[search.ts]"]
end

subgraph group_commerce["Commerce Operations"]
  node_cart_checkout["Cart and Checkout UI"]
  node_cart_store["Cart State<br/>[cart.ts]"]
  node_cart_api["Cart APIs"]
  node_checkout_api["Checkout APIs"]
  node_commerce_services["Commerce Services<br/>[checkout.ts]"]
  node_auth["Authentication"]
end

subgraph group_content["Content and Business Portal"]
  node_cms["CMS Experience"]
  node_cms_api["CMS APIs"]
  node_cms_service["CMS Service<br/>[cms.ts]"]
  node_cms_preview["Preview Listener"]
  node_portal["Business Portal"]
  node_portal_api["Portal APIs<br/>[company.get.ts]"]
  node_orders_quotes["Orders and Quotes<br/>[orders.ts]"]
end

node_shopper(("Shopper"))
node_business_user(("Business User"))
node_cms_studio(("CMS Studio"))
node_geins{{"Geins Platform"}}

node_shopper -->|"browses"| node_pages
node_business_user -->|"manages account"| node_portal
node_cms_studio -.->|"sends preview events"| node_cms_preview
node_tenant_middleware -->|"resolves tenant"| node_tenant_utils
node_tenant_plugins -->|"loads settings"| node_tenant_config
node_tenant_utils -->|"reads configuration"| node_tenant_config
node_pages -->|"renders routes"| node_catalog_pages
node_catalog_pages -->|"fetches products"| node_search_api
node_catalog_pages -->|"fetches filters"| node_product_api
node_search_api -->|"dispatches search"| node_search_service
node_product_api -->|"dispatches listing"| node_product_services
node_cart_checkout -->|"updates cart"| node_cart_store
node_cart_checkout -->|"requests cart"| node_cart_api
node_cart_checkout -->|"submits checkout"| node_checkout_api
node_cart_api -->|"uses services"| node_service_layer
node_checkout_api -->|"uses services"| node_service_layer
node_service_layer -->|"exports checkout"| node_commerce_services
node_commerce_services -->|"uses commerce platform"| node_geins
node_auth -->|"uses services"| node_service_layer
node_cms -->|"requests content"| node_cms_api
node_cms_api -->|"dispatches content"| node_cms_service
node_cms_service -->|"loads CMS data"| node_geins
node_portal -->|"requests company data"| node_portal_api
node_portal -->|"supports order workflows"| node_orders_quotes
node_orders_quotes -->|"uses commerce platform"| node_geins

click node_tenant_middleware "https://github.com/hdng-ai/sales-portal/blob/main/server/middleware/00.locale-market.ts"
click node_tenant_plugins "https://github.com/hdng-ai/sales-portal/blob/main/server/plugins/02.tenant-context.ts"
click node_tenant_config "https://github.com/hdng-ai/sales-portal/blob/main/server/services/tenant-config.ts"
click node_tenant_utils "https://github.com/hdng-ai/sales-portal/blob/main/server/utils/tenant.ts"
click node_pages "https://github.com/hdng-ai/sales-portal/tree/main/app/pages"
click node_catalog_pages "https://github.com/hdng-ai/sales-portal/blob/main/app/pages/s/%5Bquery%5D.vue"
click node_product_api "https://github.com/hdng-ai/sales-portal/tree/main/server/api/product-lists"
click node_search_api "https://github.com/hdng-ai/sales-portal/blob/main/server/api/search/products.get.ts"
click node_product_services "https://github.com/hdng-ai/sales-portal/blob/main/server/services/product-lists.ts"
click node_search_service "https://github.com/hdng-ai/sales-portal/blob/main/server/services/search.ts"
click node_cart_checkout "https://github.com/hdng-ai/sales-portal/tree/main/app/components/checkout"
click node_cart_store "https://github.com/hdng-ai/sales-portal/blob/main/app/stores/cart.ts"
click node_cart_api "https://github.com/hdng-ai/sales-portal/tree/main/server/api/cart"
click node_checkout_api "https://github.com/hdng-ai/sales-portal/tree/main/server/api/checkout"
click node_commerce_services "https://github.com/hdng-ai/sales-portal/blob/main/server/services/checkout.ts"
click node_auth "https://github.com/hdng-ai/sales-portal/tree/main/server/api/auth"
click node_cms "https://github.com/hdng-ai/sales-portal/tree/main/app/components/cms"
click node_cms_api "https://github.com/hdng-ai/sales-portal/tree/main/server/api/cms"
click node_cms_service "https://github.com/hdng-ai/sales-portal/blob/main/server/services/cms.ts"
click node_cms_preview "https://github.com/hdng-ai/sales-portal/blob/main/app/plugins/cms-preview-listener.client.ts"
click node_portal "https://github.com/hdng-ai/sales-portal/tree/main/app/pages/portal"
click node_portal_api "https://github.com/hdng-ai/sales-portal/blob/main/server/api/portal/company.get.ts"
click node_orders_quotes "https://github.com/hdng-ai/sales-portal/blob/main/server/services/orders.ts"
click node_service_layer "https://github.com/hdng-ai/sales-portal/blob/main/server/services/index.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_tenant_middleware,node_tenant_plugins,node_tenant_config,node_tenant_utils,node_service_layer,node_business_user toneBlue
class node_pages,node_catalog_pages,node_product_api,node_search_api,node_product_services,node_search_service toneAmber
class node_cart_checkout,node_cart_store,node_cart_api,node_checkout_api,node_commerce_services,node_auth toneMint
class node_cms,node_cms_api,node_cms_service,node_cms_preview,node_portal,node_portal_api,node_orders_quotes toneRose
class node_shopper,node_cms_studio,node_geins toneIndigo
```

## Components

### Tenant Platform

- [Tenant Context](https://github.com/hdng-ai/sales-portal/blob/main/server/middleware/00.locale-market.ts): `server/middleware/00.locale-market.ts`
- [Tenant Setup](https://github.com/hdng-ai/sales-portal/blob/main/server/plugins/02.tenant-context.ts): `server/plugins/02.tenant-context.ts`
- [Tenant Configuration](https://github.com/hdng-ai/sales-portal/blob/main/server/services/tenant-config.ts): `server/services/tenant-config.ts`
- [Tenant Resolution](https://github.com/hdng-ai/sales-portal/blob/main/server/utils/tenant.ts): `server/utils/tenant.ts`
- [Service Layer](https://github.com/hdng-ai/sales-portal/blob/main/server/services/index.ts): `server/services/index.ts`

### Storefront Experience

- [Storefront Routes](https://github.com/hdng-ai/sales-portal/tree/main/app/pages): `app/pages`
- [Catalog and Search](https://github.com/hdng-ai/sales-portal/blob/main/app/pages/s/%5Bquery%5D.vue): `app/pages/s/[query].vue`
- [Product APIs](https://github.com/hdng-ai/sales-portal/tree/main/server/api/product-lists): `server/api/product-lists`
- [Search API](https://github.com/hdng-ai/sales-portal/blob/main/server/api/search/products.get.ts): `server/api/search/products.get.ts`
- [Catalog Services](https://github.com/hdng-ai/sales-portal/blob/main/server/services/product-lists.ts): `server/services/product-lists.ts`
- [Search Service](https://github.com/hdng-ai/sales-portal/blob/main/server/services/search.ts): `server/services/search.ts`

### Commerce Operations

- [Cart and Checkout UI](https://github.com/hdng-ai/sales-portal/tree/main/app/components/checkout): `app/components/checkout`
- [Cart State](https://github.com/hdng-ai/sales-portal/blob/main/app/stores/cart.ts): `app/stores/cart.ts`
- [Cart APIs](https://github.com/hdng-ai/sales-portal/tree/main/server/api/cart): `server/api/cart`
- [Checkout APIs](https://github.com/hdng-ai/sales-portal/tree/main/server/api/checkout): `server/api/checkout`
- [Commerce Services](https://github.com/hdng-ai/sales-portal/blob/main/server/services/checkout.ts): `server/services/checkout.ts`
- [Authentication](https://github.com/hdng-ai/sales-portal/tree/main/server/api/auth): `server/api/auth`

### Content and Business Portal

- [CMS Experience](https://github.com/hdng-ai/sales-portal/tree/main/app/components/cms): `app/components/cms`
- [CMS APIs](https://github.com/hdng-ai/sales-portal/tree/main/server/api/cms): `server/api/cms`
- [CMS Service](https://github.com/hdng-ai/sales-portal/blob/main/server/services/cms.ts): `server/services/cms.ts`
- [Preview Listener](https://github.com/hdng-ai/sales-portal/blob/main/app/plugins/cms-preview-listener.client.ts): `app/plugins/cms-preview-listener.client.ts`
- [Business Portal](https://github.com/hdng-ai/sales-portal/tree/main/app/pages/portal): `app/pages/portal`
- [Portal APIs](https://github.com/hdng-ai/sales-portal/blob/main/server/api/portal/company.get.ts): `server/api/portal/company.get.ts`
- [Orders and Quotes](https://github.com/hdng-ai/sales-portal/blob/main/server/services/orders.ts): `server/services/orders.ts`

### Other components

- **Shopper**
- **Business User**
- **CMS Studio**
- **Geins Platform**

## Connections

- Shopper → Storefront Routes: browses
- Business User → Business Portal: manages account
- CMS Studio → Preview Listener: sends preview events
- Tenant Context → Tenant Resolution: resolves tenant
- Tenant Setup → Tenant Configuration: loads settings
- Tenant Resolution → Tenant Configuration: reads configuration
- Storefront Routes → Catalog and Search: renders routes
- Catalog and Search → Search API: fetches products
- Catalog and Search → Product APIs: fetches filters
- Search API → Search Service: dispatches search
- Product APIs → Catalog Services: dispatches listing
- Cart and Checkout UI → Cart State: updates cart
- Cart and Checkout UI → Cart APIs: requests cart
- Cart and Checkout UI → Checkout APIs: submits checkout
- Cart APIs → Service Layer: uses services
- Checkout APIs → Service Layer: uses services
- Service Layer → Commerce Services: exports checkout
- Commerce Services → Geins Platform: uses commerce platform
- Authentication → Service Layer: uses services
- CMS Experience → CMS APIs: requests content
- CMS APIs → CMS Service: dispatches content
- CMS Service → Geins Platform: loads CMS data
- Business Portal → Portal APIs: requests company data
- Business Portal → Orders and Quotes: supports order workflows
- Orders and Quotes → Geins Platform: uses commerce platform
