# meding2904/dzommercial architecture

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

- Interactive diagram: https://gitdiagram.com/meding2904/dzommercial
- Repository: https://github.com/meding2904/dzommercial

## Overview

Azahar is a modular commerce framework, not just the skincare demo: customers browse and order through the storefront, while staff manage the ledger, fulfilment, catalogue, brand and plugins in web or desktop admin. The backend owns API behaviour and persistent state; plugins supply trade-specific capabilities. The README documents major features whose implementation was not sampled, so those are represented at directory level. Edges are limited to relationships visible in excerpts or explicitly documented; unsampled internal call paths are not inferred.

Main entry points: [`backend/internal/httpapi`](https://github.com/meding2904/dzommercial/tree/main/backend/internal/httpapi) (HTTP API), [`backend/internal/plugins/registry.go`](https://github.com/meding2904/dzommercial/blob/main/backend/internal/plugins/registry.go) (Plugin registry), [`frontend/src/routes/api/[...path]/+server.ts`](https://github.com/meding2904/dzommercial/blob/main/frontend/src/routes/api/%5B...path%5D/%2Bserver.ts) (Web API proxy), [`frontend/src/routes/(store)`](https://github.com/meding2904/dzommercial/tree/main/frontend/src/routes/(store)) (Storefront pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_storefront_ui["Storefront pages"]
  node_pc_builder["PC builder page<br/>[+page.server.ts]"]
  node_api_proxy["Web API proxy<br/>[+server.ts]"]
end

subgraph group_commerce["Commerce backend"]
  node_api["HTTP API"]
  node_checkout["Checkout and orders"]
  node_catalogue["Catalogue management"]
  node_shipping["Courier fulfilment"]
  node_auth["Accounts and sessions<br/>[handlers_auth.go]"]
  node_theme["Storefront branding<br/>[theme.go]"]
end

subgraph group_admin["Staff administration"]
  node_web_admin["Web admin"]
  node_desktop_admin["Desktop admin<br/>[app.js]"]
  node_desktop_api["Desktop API client<br/>[request.go]"]
  node_plugin_admin["Plugin administration"]
end

subgraph group_plugins["Plugin capabilities"]
  node_plugin_registry["Plugin registry<br/>[registry.go]"]
  node_oil_plugin["Oil shelf<br/>[oils.go]"]
  node_phone_plugin["Phone catalog<br/>[devices.go]"]
  node_pc_plugins["PC parts and builder"]
  node_ai_plugin["AI analyst"]
  node_code_mode["Code mode"]
end

subgraph group_platform["Runtime and persistence"]
  node_database[("Database<br/>[db.go]")]
  node_store[("Commerce state")]
  node_audit["Audit outbox<br/>[batcher.go]"]
end

node_customer(("Customer"))
node_courier_service["Courier service"]
node_ai_service["AI provider"]

node_customer -->|"browses and orders"| node_storefront_ui
node_storefront_ui -->|"requests API"| node_api_proxy
node_pc_builder -->|"loads plugin parts"| node_api_proxy
node_api_proxy -->|"forwards requests"| node_api
node_api -->|"routes checkout"| node_checkout
node_api -->|"routes catalogue"| node_catalogue
node_api -->|"routes fulfilment"| node_shipping
node_api -->|"routes accounts"| node_auth
node_web_admin -->|"uses web API"| node_api_proxy
node_desktop_admin -->|"calls bridge API"| node_desktop_api
node_desktop_api -->|"calls same API"| node_api
node_plugin_admin -->|"configures plugins"| node_api_proxy
node_api -->|"uses registered plugins"| node_plugin_registry
node_plugin_registry -->|"registers plugin"| node_oil_plugin
node_plugin_registry -->|"registers plugin"| node_phone_plugin
node_plugin_registry -->|"registers plugins"| node_pc_plugins
node_plugin_registry -->|"registers plugin"| node_ai_plugin
node_plugin_registry -->|"registers plugin"| node_code_mode
node_api -->|"reads and writes"| node_store
node_store -->|"persists state"| node_database
node_api -.->|"creates parcels"| node_courier_service
node_ai_plugin -->|"requests analysis"| node_ai_service
node_code_mode -->|"requests plans"| node_ai_service
node_api -->|"manages shop design"| node_theme
node_api -->|"records changes"| node_audit

click node_storefront_ui "https://github.com/meding2904/dzommercial/tree/main/frontend/src/routes/(store)"
click node_pc_builder "https://github.com/meding2904/dzommercial/blob/main/frontend/src/routes/(store)/build-your-pc/%2Bpage.server.ts"
click node_api_proxy "https://github.com/meding2904/dzommercial/blob/main/frontend/src/routes/api/%5B...path%5D/%2Bserver.ts"
click node_api "https://github.com/meding2904/dzommercial/tree/main/backend/internal/httpapi"
click node_checkout "https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_checkout.go"
click node_catalogue "https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_admin_products.go"
click node_shipping "https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_shipping.go"
click node_auth "https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_auth.go"
click node_theme "https://github.com/meding2904/dzommercial/blob/main/backend/internal/storefront/theme.go"
click node_web_admin "https://github.com/meding2904/dzommercial/tree/main/frontend/src/routes/admin/(panel)"
click node_desktop_admin "https://github.com/meding2904/dzommercial/blob/main/desktop/frontend/app.js"
click node_desktop_api "https://github.com/meding2904/dzommercial/blob/main/desktop/internal/api/request.go"
click node_plugin_admin "https://github.com/meding2904/dzommercial/tree/main/frontend/src/lib/plugins/admin"
click node_plugin_registry "https://github.com/meding2904/dzommercial/blob/main/backend/internal/plugins/registry.go"
click node_oil_plugin "https://github.com/meding2904/dzommercial/blob/main/backend/internal/plugins/oils/oils.go"
click node_phone_plugin "https://github.com/meding2904/dzommercial/blob/main/backend/internal/plugins/phone/devices.go"
click node_pc_plugins "https://github.com/meding2904/dzommercial/tree/main/backend/internal/plugins/pcbuilder"
click node_ai_plugin "https://github.com/meding2904/dzommercial/tree/main/backend/internal/plugins/ai"
click node_code_mode "https://github.com/meding2904/dzommercial/tree/main/backend/internal/plugins/codemode"
click node_database "https://github.com/meding2904/dzommercial/blob/main/backend/internal/db/db.go"
click node_store "https://github.com/meding2904/dzommercial/tree/main/backend/internal/store"
click node_audit "https://github.com/meding2904/dzommercial/blob/main/backend/internal/auditbatch/batcher.go"

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_ui,node_pc_builder,node_api_proxy toneBlue
class node_api,node_checkout,node_catalogue,node_shipping,node_auth,node_theme toneAmber
class node_web_admin,node_desktop_admin,node_desktop_api,node_plugin_admin toneMint
class node_plugin_registry,node_oil_plugin,node_phone_plugin,node_pc_plugins,node_ai_plugin,node_code_mode toneRose
class node_database,node_store,node_audit,node_customer,node_courier_service,node_ai_service toneIndigo
```

## Components

### Customer storefront

- [Storefront pages](https://github.com/meding2904/dzommercial/tree/main/frontend/src/routes/(store)): `frontend/src/routes/(store)`
- [PC builder page](https://github.com/meding2904/dzommercial/blob/main/frontend/src/routes/(store)/build-your-pc/%2Bpage.server.ts): `frontend/src/routes/(store)/build-your-pc/+page.server.ts`
- [Web API proxy](https://github.com/meding2904/dzommercial/blob/main/frontend/src/routes/api/%5B...path%5D/%2Bserver.ts): `frontend/src/routes/api/[...path]/+server.ts`

### Commerce backend

- [HTTP API](https://github.com/meding2904/dzommercial/tree/main/backend/internal/httpapi): `backend/internal/httpapi`
- [Checkout and orders](https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_checkout.go): `backend/internal/httpapi/handlers_checkout.go`
- [Catalogue management](https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_admin_products.go): `backend/internal/httpapi/handlers_admin_products.go`
- [Courier fulfilment](https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_shipping.go): `backend/internal/httpapi/handlers_shipping.go`
- [Accounts and sessions](https://github.com/meding2904/dzommercial/blob/main/backend/internal/httpapi/handlers_auth.go): `backend/internal/httpapi/handlers_auth.go`
- [Storefront branding](https://github.com/meding2904/dzommercial/blob/main/backend/internal/storefront/theme.go): `backend/internal/storefront/theme.go`

### Staff administration

- [Web admin](https://github.com/meding2904/dzommercial/tree/main/frontend/src/routes/admin/(panel)): `frontend/src/routes/admin/(panel)`
- [Desktop admin](https://github.com/meding2904/dzommercial/blob/main/desktop/frontend/app.js): `desktop/frontend/app.js`
- [Desktop API client](https://github.com/meding2904/dzommercial/blob/main/desktop/internal/api/request.go): `desktop/internal/api/request.go`
- [Plugin administration](https://github.com/meding2904/dzommercial/tree/main/frontend/src/lib/plugins/admin): `frontend/src/lib/plugins/admin`

### Plugin capabilities

- [Plugin registry](https://github.com/meding2904/dzommercial/blob/main/backend/internal/plugins/registry.go): `backend/internal/plugins/registry.go`
- [Oil shelf](https://github.com/meding2904/dzommercial/blob/main/backend/internal/plugins/oils/oils.go): `backend/internal/plugins/oils/oils.go`
- [Phone catalog](https://github.com/meding2904/dzommercial/blob/main/backend/internal/plugins/phone/devices.go): `backend/internal/plugins/phone/devices.go`
- [PC parts and builder](https://github.com/meding2904/dzommercial/tree/main/backend/internal/plugins/pcbuilder): `backend/internal/plugins/pcbuilder`
- [AI analyst](https://github.com/meding2904/dzommercial/tree/main/backend/internal/plugins/ai): `backend/internal/plugins/ai`
- [Code mode](https://github.com/meding2904/dzommercial/tree/main/backend/internal/plugins/codemode): `backend/internal/plugins/codemode`

### Runtime and persistence

- [Database](https://github.com/meding2904/dzommercial/blob/main/backend/internal/db/db.go): `backend/internal/db/db.go`
- [Commerce state](https://github.com/meding2904/dzommercial/tree/main/backend/internal/store): `backend/internal/store`
- [Audit outbox](https://github.com/meding2904/dzommercial/blob/main/backend/internal/auditbatch/batcher.go): `backend/internal/auditbatch/batcher.go`

### Other components

- **Customer**
- **Courier service**
- **AI provider**

## Connections

- Customer → Storefront pages: browses and orders
- Storefront pages → Web API proxy: requests API (evidence: `frontend/src/routes/(store)/+page.server.ts`)
- PC builder page → Web API proxy: loads plugin parts (evidence: `frontend/src/routes/(store)/build-your-pc/+page.server.ts`)
- Web API proxy → HTTP API: forwards requests (evidence: `frontend/src/routes/api/[...path]/+server.ts`)
- HTTP API → Checkout and orders: routes checkout
- HTTP API → Catalogue management: routes catalogue
- HTTP API → Courier fulfilment: routes fulfilment
- HTTP API → Accounts and sessions: routes accounts
- Web admin → Web API proxy: uses web API
- Desktop admin → Desktop API client: calls bridge API (evidence: `desktop/frontend/app.js`)
- Desktop API client → HTTP API: calls same API
- Plugin administration → Web API proxy: configures plugins
- HTTP API → Plugin registry: uses registered plugins
- Plugin registry → Oil shelf: registers plugin
- Plugin registry → Phone catalog: registers plugin
- Plugin registry → PC parts and builder: registers plugins
- Plugin registry → AI analyst: registers plugin
- Plugin registry → Code mode: registers plugin
- HTTP API → Commerce state: reads and writes (evidence: `backend/internal/httpapi/handlers_auth.go`)
- Commerce state → Database: persists state
- HTTP API → Courier service: creates parcels
- AI analyst → AI provider: requests analysis (evidence: `backend/internal/plugins/ai/client.go`)
- Code mode → AI provider: requests plans (evidence: `backend/internal/plugins/codemode/client.go`)
- HTTP API → Storefront branding: manages shop design
- HTTP API → Audit outbox: records changes
