# raffyrojo/ugreen-pricelist architecture

> Architecture diagram of the GitHub repository raffyrojo/ugreen-pricelist, 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/raffyrojo/ugreen-pricelist
- Repository: https://github.com/raffyrojo/ugreen-pricelist

## Overview

UGREEN Pricelist is a browser-based product catalog and CMS, backed by JSON data and a Cloudflare Worker. The main workflow loads the catalog, filters and renders products for browsing, and lets administrators edit catalog content and publish changes through the Worker to GitHub; Pages then redeploys the updated data. The README documents exports and dealer features, while excerpts show search analytics and Worker KV behavior. Some subsystem wiring is documented rather than visible in the sampled code, so those edges cite the README; unsampled details are not inferred.

Main entry points: [`backend/worker.js`](https://github.com/raffyrojo/ugreen-pricelist/blob/main/backend/worker.js) (Cloudflare Worker), [`data/products.json`](https://github.com/raffyrojo/ugreen-pricelist/blob/main/data/products.json) (Product catalog), [`js/app.js`](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/app.js) (App bootstrap), [`js/search-overlay.js`](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/search-overlay.js) (Search suggestions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog experience"]
  node_catalog_data[("Product catalog<br/>[products.json]")]
  node_catalog_config["Catalog settings<br/>[categories.json]"]
  node_bootstrap["App bootstrap<br/>[app.js]"]
  node_filters["Search and filters<br/>[filters.js]"]
  node_search_input["Debounced search<br/>[search.js]"]
  node_sidebar["Section sidebar<br/>[sidebar.js]"]
  node_render["Product views<br/>[render.js]"]
  node_search_overlay["Search suggestions<br/>[search-overlay.js]"]
  node_exports["Catalog exports<br/>[exports.js]"]
end

subgraph group_management["Catalog management"]
  node_admin["Admin dashboard<br/>[admin.js]"]
  node_dealer_admin["Dealer administration<br/>[dealers-admin.js]"]
end

subgraph group_publishing["Publishing"]
  node_save_client["Publish client<br/>[github-save.js]"]
  node_worker["Cloudflare Worker<br/>[worker.js]"]
  node_github[("GitHub repository")]
  node_pages["GitHub Pages"]
end

subgraph group_dealer_analytics["Dealer and analytics"]
  node_dealer_mode["Dealer view<br/>[dealer-mode.js]"]
  node_worker_kv[("Worker KV")]
  node_trending_data["Editorial trending<br/>[trending.json]"]
end

node_visitor(("Catalog visitor"))
node_admin_user(("Administrator"))
node_dealer_user(("Dealer"))

node_visitor -->|"opens catalog"| node_bootstrap
node_bootstrap -->|"loads data"| node_catalog_data
node_bootstrap -->|"loads settings"| node_catalog_config
node_bootstrap -->|"initializes view"| node_render
node_visitor -->|"enters query"| node_search_input
node_search_input -->|"debounces search"| node_render
node_filters -->|"filters products"| node_catalog_data
node_sidebar -->|"counts products"| node_catalog_data
node_search_overlay -->|"suggests products"| node_catalog_data
node_visitor -->|"requests export"| node_exports
node_exports -->|"exports products"| node_catalog_data
node_admin_user -->|"edits catalog"| node_admin
node_admin -->|"edits in memory"| node_catalog_data
node_admin_user -->|"manages dealers"| node_dealer_admin
node_dealer_admin -.->|"publishes changes"| node_save_client
node_admin -->|"publishes catalog"| node_save_client
node_save_client -->|"sends publish request"| node_worker
node_worker -->|"commits data"| node_github
node_github -->|"redeploys site"| node_pages
node_dealer_user -->|"signs in"| node_dealer_mode
node_dealer_mode -.->|"authenticates dealer"| node_worker
node_worker -->|"reads dealer records"| node_worker_kv
node_worker -->|"tracks activity"| node_worker_kv
node_search_overlay -->|"sends analytics"| node_worker
node_search_overlay -->|"loads editorial picks"| node_trending_data

click node_catalog_data "https://github.com/raffyrojo/ugreen-pricelist/blob/main/data/products.json"
click node_catalog_config "https://github.com/raffyrojo/ugreen-pricelist/blob/main/data/categories.json"
click node_bootstrap "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/app.js"
click node_filters "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/filters.js"
click node_search_input "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/search.js"
click node_sidebar "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/sidebar.js"
click node_render "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/render.js"
click node_search_overlay "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/search-overlay.js"
click node_exports "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/exports.js"
click node_admin "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/admin.js"
click node_dealer_admin "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/dealers-admin.js"
click node_save_client "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/github-save.js"
click node_worker "https://github.com/raffyrojo/ugreen-pricelist/blob/main/backend/worker.js"
click node_dealer_mode "https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/dealer-mode.js"
click node_trending_data "https://github.com/raffyrojo/ugreen-pricelist/blob/main/data/trending.json"

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_catalog_data,node_catalog_config,node_bootstrap,node_filters,node_search_input,node_sidebar,node_render,node_search_overlay,node_exports toneBlue
class node_admin,node_dealer_admin toneAmber
class node_save_client,node_worker,node_github,node_pages toneMint
class node_dealer_mode,node_worker_kv,node_trending_data toneRose
class node_visitor,node_admin_user,node_dealer_user toneIndigo
```

## Components

### Catalog experience

- [Product catalog](https://github.com/raffyrojo/ugreen-pricelist/blob/main/data/products.json): `data/products.json`
- [Catalog settings](https://github.com/raffyrojo/ugreen-pricelist/blob/main/data/categories.json): `data/categories.json`
- [App bootstrap](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/app.js): `js/app.js`
- [Search and filters](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/filters.js): `js/filters.js`
- [Debounced search](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/search.js): `js/search.js`
- [Section sidebar](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/sidebar.js): `js/sidebar.js`
- [Product views](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/render.js): `js/render.js`
- [Search suggestions](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/search-overlay.js): `js/search-overlay.js`
- [Catalog exports](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/exports.js): `js/exports.js`

### Catalog management

- [Admin dashboard](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/admin.js): `js/admin.js`
- [Dealer administration](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/dealers-admin.js): `js/dealers-admin.js`

### Publishing

- [Publish client](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/github-save.js): `js/github-save.js`
- [Cloudflare Worker](https://github.com/raffyrojo/ugreen-pricelist/blob/main/backend/worker.js): `backend/worker.js`
- **GitHub repository**
- **GitHub Pages**

### Dealer and analytics

- [Dealer view](https://github.com/raffyrojo/ugreen-pricelist/blob/main/js/dealer-mode.js): `js/dealer-mode.js`
- **Worker KV**
- [Editorial trending](https://github.com/raffyrojo/ugreen-pricelist/blob/main/data/trending.json): `data/trending.json`

### Other components

- **Catalog visitor**
- **Administrator**
- **Dealer**

## Connections

- Catalog visitor → App bootstrap: opens catalog (evidence: `README.md`)
- App bootstrap → Product catalog: loads data (evidence: `README.md`)
- App bootstrap → Catalog settings: loads settings (evidence: `README.md`)
- App bootstrap → Product views: initializes view (evidence: `js/app.js`)
- Catalog visitor → Debounced search: enters query (evidence: `README.md`)
- Debounced search → Product views: debounces search (evidence: `js/search.js`)
- Search and filters → Product catalog: filters products
- Section sidebar → Product catalog: counts products
- Search suggestions → Product catalog: suggests products (evidence: `js/search-overlay.js`)
- Catalog visitor → Catalog exports: requests export (evidence: `README.md`)
- Catalog exports → Product catalog: exports products (evidence: `README.md`)
- Administrator → Admin dashboard: edits catalog (evidence: `README.md`)
- Admin dashboard → Product catalog: edits in memory (evidence: `README.md`)
- Administrator → Dealer administration: manages dealers (evidence: `README.md`)
- Dealer administration → Publish client: publishes changes
- Admin dashboard → Publish client: publishes catalog (evidence: `README.md`)
- Publish client → Cloudflare Worker: sends publish request (evidence: `README.md`)
- Cloudflare Worker → GitHub repository: commits data (evidence: `README.md`)
- GitHub repository → GitHub Pages: redeploys site (evidence: `README.md`)
- Dealer → Dealer view: signs in (evidence: `README.md`)
- Dealer view → Cloudflare Worker: authenticates dealer
- Cloudflare Worker → Worker KV: reads dealer records (evidence: `backend/worker.js`)
- Cloudflare Worker → Worker KV: tracks activity (evidence: `backend/worker.js`)
- Search suggestions → Cloudflare Worker: sends analytics (evidence: `js/search-overlay.js`)
- Search suggestions → Editorial trending: loads editorial picks (evidence: `js/search-overlay.js`)
