# novmar03/demo-shop architecture

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

- Interactive diagram: https://gitdiagram.com/novmar03/demo-shop
- Repository: https://github.com/novmar03/demo-shop

## Overview

This is a Russian-language demo storefront with an eight-item catalog and shared cart, offering three payment demonstrations: a CloudPayments widget, payment blocks, and Checkout cryptogram creation. The principal flow is browsing products, changing cart quantities, producing an order snapshot, then choosing a payment scenario; Checkout deliberately does not complete a charge. The graph includes catalog presentation, cart state, and each payment path. Connections reflect the sampled app and module calls or README-described behavior; server-side payment confirmation is documented as not implemented.

Main entry points: [`src/app.js`](https://github.com/novmar03/demo-shop/blob/main/src/app.js) (Storefront app), [`src/blocks.js`](https://github.com/novmar03/demo-shop/blob/main/src/blocks.js) (Payment blocks), [`src/checkout.js`](https://github.com/novmar03/demo-shop/blob/main/src/checkout.js) (Cryptogram checkout), [`src/payment.js`](https://github.com/novmar03/demo-shop/blob/main/src/payment.js) (Widget checkout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["Storefront app<br/>[app.js]"]
  node_catalog["Product catalog<br/>[products.js]"]
  node_ui["UI components<br/>[ui.js]"]
  node_styles["Responsive styling<br/>[styles.css]"]
end

subgraph group_cart["Cart and order"]
  node_cartstate["Cart operations<br/>[cart.js]"]
  node_localstorage[("Browser storage")]
  node_snapshot["Order snapshot<br/>[cart.js]"]
end

subgraph group_payments["Payment scenarios"]
  node_widgetflow["Widget checkout<br/>[payment.js]"]
  node_blocksflow["Payment blocks<br/>[blocks.js]"]
  node_checkoutflow["Cryptogram checkout<br/>[checkout.js]"]
end

subgraph group_external["Payment provider"]
  node_widget["CloudPayments widget"]
  node_blocks["CloudPayments blocks"]
  node_checkout["CloudPayments Checkout"]
end

node_customer(("Shopper"))
node_browser(("Browser"))

node_customer -->|"browses and acts"| node_app
node_app -->|"reads products"| node_catalog
node_app -->|"renders storefront"| node_ui
node_ui -.->|"uses styles"| node_styles
node_app -->|"updates cart"| node_cartstate
node_cartstate -->|"validates product IDs"| node_catalog
node_app -->|"loads and saves cart"| node_localstorage
node_app -->|"creates order"| node_snapshot
node_snapshot -->|"adds product details"| node_catalog
node_customer -->|"selects payment route"| node_app
node_app -->|"starts widget payment"| node_widgetflow
node_widgetflow -->|"loads SDK and starts"| node_widget
node_app -->|"mounts payment blocks"| node_blocksflow
node_blocksflow -->|"uses payment parameters"| node_widget
node_blocksflow -->|"loads and mounts"| node_blocks
node_app -->|"mounts Checkout form"| node_checkoutflow
node_checkoutflow -->|"loads SDK and creates cryptogram"| node_checkout
node_checkoutflow -->|"uses public ID"| node_widgetflow
node_app -->|"dispatches checkout results"| node_browser

click node_app "https://github.com/novmar03/demo-shop/blob/main/src/app.js"
click node_catalog "https://github.com/novmar03/demo-shop/blob/main/src/products.js"
click node_ui "https://github.com/novmar03/demo-shop/blob/main/src/ui.js"
click node_styles "https://github.com/novmar03/demo-shop/blob/main/src/styles.css"
click node_cartstate "https://github.com/novmar03/demo-shop/blob/main/src/cart.js"
click node_snapshot "https://github.com/novmar03/demo-shop/blob/main/src/cart.js"
click node_widgetflow "https://github.com/novmar03/demo-shop/blob/main/src/payment.js"
click node_blocksflow "https://github.com/novmar03/demo-shop/blob/main/src/blocks.js"
click node_checkoutflow "https://github.com/novmar03/demo-shop/blob/main/src/checkout.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_app,node_catalog,node_ui,node_styles,node_browser toneBlue
class node_cartstate,node_localstorage,node_snapshot toneAmber
class node_widgetflow,node_blocksflow,node_checkoutflow toneMint
class node_widget,node_blocks,node_checkout toneRose
class node_customer toneIndigo
```

## Components

### Storefront

- [Storefront app](https://github.com/novmar03/demo-shop/blob/main/src/app.js): `src/app.js`
- [Product catalog](https://github.com/novmar03/demo-shop/blob/main/src/products.js): `src/products.js`
- [UI components](https://github.com/novmar03/demo-shop/blob/main/src/ui.js): `src/ui.js`
- [Responsive styling](https://github.com/novmar03/demo-shop/blob/main/src/styles.css): `src/styles.css`

### Cart and order

- [Cart operations](https://github.com/novmar03/demo-shop/blob/main/src/cart.js): `src/cart.js`
- **Browser storage**
- [Order snapshot](https://github.com/novmar03/demo-shop/blob/main/src/cart.js): `src/cart.js`

### Payment scenarios

- [Widget checkout](https://github.com/novmar03/demo-shop/blob/main/src/payment.js): `src/payment.js`
- [Payment blocks](https://github.com/novmar03/demo-shop/blob/main/src/blocks.js): `src/blocks.js`
- [Cryptogram checkout](https://github.com/novmar03/demo-shop/blob/main/src/checkout.js): `src/checkout.js`

### Payment provider

- **CloudPayments widget**
- **CloudPayments blocks**
- **CloudPayments Checkout**

### Other components

- **Shopper**
- **Browser**

## Connections

- Shopper → Storefront app: browses and acts (evidence: `src/app.js`)
- Storefront app → Product catalog: reads products (evidence: `src/app.js`)
- Storefront app → UI components: renders storefront (evidence: `src/app.js`)
- UI components → Responsive styling: uses styles
- Storefront app → Cart operations: updates cart (evidence: `src/app.js`)
- Cart operations → Product catalog: validates product IDs (evidence: `src/cart.js`)
- Storefront app → Browser storage: loads and saves cart (evidence: `src/app.js`)
- Storefront app → Order snapshot: creates order (evidence: `src/app.js`)
- Order snapshot → Product catalog: adds product details (evidence: `src/cart.js`)
- Shopper → Storefront app: selects payment route (evidence: `src/app.js`)
- Storefront app → Widget checkout: starts widget payment (evidence: `src/app.js`)
- Widget checkout → CloudPayments widget: loads SDK and starts (evidence: `src/payment.js`)
- Storefront app → Payment blocks: mounts payment blocks (evidence: `src/app.js`)
- Payment blocks → CloudPayments widget: uses payment parameters (evidence: `src/blocks.js`)
- Payment blocks → CloudPayments blocks: loads and mounts (evidence: `src/blocks.js`)
- Storefront app → Cryptogram checkout: mounts Checkout form (evidence: `src/app.js`)
- Cryptogram checkout → CloudPayments Checkout: loads SDK and creates cryptogram (evidence: `src/checkout.js`)
- Cryptogram checkout → Widget checkout: uses public ID (evidence: `src/checkout.js`)
- Storefront app → Browser: dispatches checkout results (evidence: `src/app.js`)
