# mohitbnt/cloudcart-k8s architecture

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

- Interactive diagram: https://gitdiagram.com/mohitbnt/cloudcart-k8s
- Repository: https://github.com/mohitbnt/cloudcart-k8s

## Overview

CloudCart is an e-commerce application paired with a Kubernetes/GitOps platform. The main user journey is browsing the catalog, authenticating, managing a cart, and placing an order; the order service reserves inventory and authorizes simulated payment before persisting the order. The graph also captures documented ingress, stateful services, network policy, and Argo CD reconciliation. Service-to-service links follow the README or shown calls; unsampled service behavior is not inferred beyond those sources.

Main entry points: [`cloudcart-application/gateway/app/main.py`](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/gateway/app/main.py) (API gateway), [`cloudcart-application/frontend/js/app.js`](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/app.js) (Storefront UI), [`cloudcart-application/services/order/app/main.py`](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/order/app/main.py) (Order service), [`kubernetes/base/postgres/statefulset.yaml`](https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/base/postgres/statefulset.yaml) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_frontend["Storefront UI<br/>[app.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_api_config["API endpoint config<br/>[config.js]"]
  node_browser_state["Browser state<br/>[store.js]"]
  node_ui_rendering["UI rendering<br/>[ui.js]"]
end

subgraph group_commerce["Commerce API"]
  node_gateway["API gateway<br/>[main.py]"]
  node_catalog["Catalog service<br/>[main.py]"]
  node_identity["Identity service<br/>[main.py]"]
  node_cart["Cart service<br/>[main.py]"]
  node_order["Order service<br/>[main.py]"]
  node_inventory["Inventory service<br/>[main.py]"]
  node_payment["Payment service<br/>[main.py]"]
  node_notification["Notification service<br/>[main.py]"]
end

subgraph group_state["State Services"]
  node_postgres[("PostgreSQL<br/>[statefulset.yaml]")]
  node_redis[("Redis<br/>[statefulset.yaml]")]
end

subgraph group_platform["Kubernetes Platform"]
  node_ingress["Ingress NGINX"]
  node_network_policies["Network policies"]
  node_environment_overlays["Environment overlays<br/>[kustomization.yaml]"]
  node_argocd_sync["Argo CD sync"]
end

node_shopper(("Shopper"))

node_shopper -->|"visits"| node_ingress
node_ingress -->|"routes to"| node_frontend
node_ingress -->|"routes to"| node_gateway
node_frontend -->|"requests via"| node_api_client
node_frontend -->|"updates"| node_browser_state
node_frontend -->|"renders with"| node_ui_rendering
node_api_client -->|"reads endpoint"| node_api_config
node_ui_rendering -->|"reads state"| node_browser_state
node_api_client -->|"sends API requests"| node_gateway
node_gateway -->|"proxies requests"| node_catalog
node_gateway -->|"proxies requests"| node_identity
node_gateway -->|"proxies requests"| node_cart
node_gateway -->|"proxies requests"| node_order
node_gateway -->|"proxies requests"| node_inventory
node_gateway -->|"proxies requests"| node_payment
node_gateway -->|"proxies requests"| node_notification
node_identity -->|"reads and writes"| node_postgres
node_identity -->|"stores sessions"| node_redis
node_cart -->|"stores cart"| node_redis
node_catalog -->|"reads and writes"| node_postgres
node_order -->|"reserves stock"| node_inventory
node_order -->|"authorizes payment"| node_payment
node_order -->|"persists orders"| node_postgres
node_notification -->|"stores notices"| node_postgres
node_environment_overlays -.->|"configures access"| node_network_policies
node_argocd_sync -->|"reconciles"| node_environment_overlays

click node_frontend "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/app.js"
click node_api_client "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/api.js"
click node_api_config "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/config.js"
click node_browser_state "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/store.js"
click node_ui_rendering "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/ui.js"
click node_gateway "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/gateway/app/main.py"
click node_catalog "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/catalog/app/main.py"
click node_identity "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/identity/app/main.py"
click node_cart "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/cart/app/main.py"
click node_order "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/order/app/main.py"
click node_inventory "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/inventory/app/main.py"
click node_payment "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/payment/app/main.py"
click node_notification "https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/notification/app/main.py"
click node_postgres "https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/base/postgres/statefulset.yaml"
click node_redis "https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/base/redis/statefulset.yaml"
click node_network_policies "https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/base/policies/01-default-deny.yaml"
click node_environment_overlays "https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/overlays/dev/kustomization.yaml"
click node_argocd_sync "https://github.com/mohitbnt/cloudcart-k8s/blob/main/argocd/02-application-set.yaml"

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_frontend,node_api_client,node_api_config,node_browser_state,node_ui_rendering toneBlue
class node_gateway,node_catalog,node_identity,node_cart,node_order,node_inventory,node_payment,node_notification toneAmber
class node_postgres,node_redis toneMint
class node_ingress,node_network_policies,node_environment_overlays,node_argocd_sync toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Storefront UI](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/app.js): `cloudcart-application/frontend/js/app.js`
- [API client](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/api.js): `cloudcart-application/frontend/js/api.js`
- [API endpoint config](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/config.js): `cloudcart-application/frontend/js/config.js`
- [Browser state](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/store.js): `cloudcart-application/frontend/js/store.js`
- [UI rendering](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/frontend/js/ui.js): `cloudcart-application/frontend/js/ui.js`

### Commerce API

- [API gateway](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/gateway/app/main.py): `cloudcart-application/gateway/app/main.py`
- [Catalog service](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/catalog/app/main.py): `cloudcart-application/services/catalog/app/main.py`
- [Identity service](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/identity/app/main.py): `cloudcart-application/services/identity/app/main.py`
- [Cart service](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/cart/app/main.py): `cloudcart-application/services/cart/app/main.py`
- [Order service](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/order/app/main.py): `cloudcart-application/services/order/app/main.py`
- [Inventory service](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/inventory/app/main.py): `cloudcart-application/services/inventory/app/main.py`
- [Payment service](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/payment/app/main.py): `cloudcart-application/services/payment/app/main.py`
- [Notification service](https://github.com/mohitbnt/cloudcart-k8s/blob/main/cloudcart-application/services/notification/app/main.py): `cloudcart-application/services/notification/app/main.py`

### State Services

- [PostgreSQL](https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/base/postgres/statefulset.yaml): `kubernetes/base/postgres/statefulset.yaml`
- [Redis](https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/base/redis/statefulset.yaml): `kubernetes/base/redis/statefulset.yaml`

### Kubernetes Platform

- **Ingress NGINX**
- [Network policies](https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/base/policies/01-default-deny.yaml): `kubernetes/base/policies/01-default-deny.yaml`
- [Environment overlays](https://github.com/mohitbnt/cloudcart-k8s/blob/main/kubernetes/overlays/dev/kustomization.yaml): `kubernetes/overlays/dev/kustomization.yaml`
- [Argo CD sync](https://github.com/mohitbnt/cloudcart-k8s/blob/main/argocd/02-application-set.yaml): `argocd/02-application-set.yaml`

### Other components

- **Shopper**

## Connections

- Shopper → Ingress NGINX: visits (evidence: `README.md`)
- Ingress NGINX → Storefront UI: routes to (evidence: `README.md`)
- Ingress NGINX → API gateway: routes to (evidence: `README.md`)
- Storefront UI → API client: requests via (evidence: `cloudcart-application/frontend/js/app.js`)
- Storefront UI → Browser state: updates (evidence: `cloudcart-application/frontend/js/app.js`)
- Storefront UI → UI rendering: renders with (evidence: `cloudcart-application/frontend/js/app.js`)
- API client → API endpoint config: reads endpoint (evidence: `cloudcart-application/frontend/js/api.js`)
- UI rendering → Browser state: reads state (evidence: `cloudcart-application/frontend/js/ui.js`)
- API client → API gateway: sends API requests (evidence: `README.md`)
- API gateway → Catalog service: proxies requests (evidence: `cloudcart-application/gateway/app/main.py`)
- API gateway → Identity service: proxies requests (evidence: `cloudcart-application/gateway/app/main.py`)
- API gateway → Cart service: proxies requests (evidence: `cloudcart-application/gateway/app/main.py`)
- API gateway → Order service: proxies requests (evidence: `cloudcart-application/gateway/app/main.py`)
- API gateway → Inventory service: proxies requests (evidence: `cloudcart-application/gateway/app/main.py`)
- API gateway → Payment service: proxies requests (evidence: `cloudcart-application/gateway/app/main.py`)
- API gateway → Notification service: proxies requests (evidence: `cloudcart-application/gateway/app/main.py`)
- Identity service → PostgreSQL: reads and writes (evidence: `cloudcart-application/services/identity/app/main.py`)
- Identity service → Redis: stores sessions (evidence: `cloudcart-application/services/identity/app/main.py`)
- Cart service → Redis: stores cart (evidence: `cloudcart-application/services/cart/app/main.py`)
- Catalog service → PostgreSQL: reads and writes (evidence: `cloudcart-application/services/catalog/app/main.py`)
- Order service → Inventory service: reserves stock (evidence: `cloudcart-application/services/order/app/main.py`)
- Order service → Payment service: authorizes payment (evidence: `cloudcart-application/services/order/app/main.py`)
- Order service → PostgreSQL: persists orders (evidence: `cloudcart-application/services/order/app/main.py`)
- Notification service → PostgreSQL: stores notices (evidence: `cloudcart-application/services/notification/app/main.py`)
- Environment overlays → Network policies: configures access (evidence: `README.md`)
- Argo CD sync → Environment overlays: reconciles (evidence: `README.md`)
