# yacbhl71/mazigho architecture

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

- Interactive diagram: https://gitdiagram.com/yacbhl71/mazigho
- Repository: https://github.com/yacbhl71/mazigho

## Overview

MAZIGHO is a tenant-scoped, multi-store commerce platform with three distinct surfaces: public storefronts, isolated store-owner workspaces, and platform-operator Studio. The main journey runs from resolving and preparing a store, through publishing its storefront and handling customer orders, to owner operations and platform oversight. The README documents capabilities beyond the sampled excerpts; those are represented at subsystem level. Edges are limited to relationships shown in excerpts, the source index, or README statements.

Main entry points: [`client/src/App.tsx`](https://github.com/yacbhl71/mazigho/blob/main/client/src/App.tsx) (Web application), [`server/adminRouter.ts`](https://github.com/yacbhl71/mazigho/blob/main/server/adminRouter.ts) (Studio operations), [`server/routers.ts`](https://github.com/yacbhl71/mazigho/blob/main/server/routers.ts) (tRPC API), [`server/ownerRouter.ts`](https://github.com/yacbhl71/mazigho/blob/main/server/ownerRouter.ts) (Store operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["Product surfaces"]
  node_app["Web application<br/>[App.tsx]"]
  node_storefront["Public storefront<br/>[Shop.tsx]"]
  node_owner_workspace["Owner workspace"]
  node_studio["MAZIGHO Studio<br/>[AdminStudio.tsx]"]
  node_acquisition["Store acquisition"]
end

subgraph group_platform["Platform services"]
  node_auth["Authentication<br/>[authRouter.ts]"]
  node_api["tRPC API<br/>[routers.ts]"]
  node_server["HTTP server<br/>[index.ts]"]
  node_scope["Tenant access control<br/>[storeScope.ts]"]
  node_database[("Commerce database<br/>[schema.ts]")]
end

subgraph group_commerce["Commerce operations"]
  node_admin_ops["Studio operations<br/>[adminRouter.ts]"]
  node_owner_ops["Store operations<br/>[ownerRouter.ts]"]
  node_checkout["Checkout and payments<br/>[stripeCheckout.ts]"]
  node_fulfillment["Supplier fulfillment<br/>[cjFulfillment.ts]"]
end

subgraph group_integrations["External integrations"]
  node_supplier["CJ Dropshipping<br/>[cjDropshipping.ts]"]
  node_ai["AI services<br/>[llm.ts]"]
  node_media["Media storage<br/>[storage.ts]"]
  node_email["Transactional email"]
  node_payment_provider["Stripe"]
end

node_visitor(("Shopper"))
node_operator(("Platform operator"))
node_owner(("Store owner"))

node_visitor -->|"browses"| node_app
node_owner -->|"uses"| node_app
node_operator -->|"uses"| node_app
node_app -->|"routes to"| node_storefront
node_app -->|"routes to"| node_acquisition
node_app -->|"routes to"| node_owner_workspace
node_app -->|"routes to"| node_studio
node_app -->|"uses procedures"| node_api
node_server -->|"mounts"| node_api
node_server -->|"builds context"| node_database
node_api -->|"registers"| node_auth
node_api -->|"registers"| node_admin_ops
node_api -->|"registers"| node_owner_ops
node_api -->|"routes checkout"| node_checkout
node_owner_ops -->|"enforces tenant scope"| node_scope
node_admin_ops -->|"enforces platform scope"| node_scope
node_owner_ops -->|"reads and writes"| node_database
node_admin_ops -->|"reads and writes"| node_database
node_checkout -.->|"charges via"| node_payment_provider
node_fulfillment -->|"prepares supplier order"| node_supplier
node_admin_ops -->|"imports products"| node_supplier
node_admin_ops -->|"invokes"| node_ai
node_owner_ops -->|"invokes"| node_ai
node_admin_ops -->|"uploads media"| node_media
node_auth -->|"sends reset email"| node_email
node_owner_ops -->|"sends order email"| node_email

click node_app "https://github.com/yacbhl71/mazigho/blob/main/client/src/App.tsx"
click node_storefront "https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/Shop.tsx"
click node_owner_workspace "https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/OwnerStorePanel.tsx"
click node_studio "https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/admin/AdminStudio.tsx"
click node_acquisition "https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/StoreAcquisitionWizard.tsx"
click node_auth "https://github.com/yacbhl71/mazigho/blob/main/server/authRouter.ts"
click node_api "https://github.com/yacbhl71/mazigho/blob/main/server/routers.ts"
click node_server "https://github.com/yacbhl71/mazigho/blob/main/server/_core/index.ts"
click node_scope "https://github.com/yacbhl71/mazigho/blob/main/server/services/storeScope.ts"
click node_database "https://github.com/yacbhl71/mazigho/blob/main/drizzle/schema.ts"
click node_admin_ops "https://github.com/yacbhl71/mazigho/blob/main/server/adminRouter.ts"
click node_owner_ops "https://github.com/yacbhl71/mazigho/blob/main/server/ownerRouter.ts"
click node_checkout "https://github.com/yacbhl71/mazigho/blob/main/server/stripeCheckout.ts"
click node_fulfillment "https://github.com/yacbhl71/mazigho/blob/main/server/services/cjFulfillment.ts"
click node_supplier "https://github.com/yacbhl71/mazigho/blob/main/server/cjDropshipping.ts"
click node_ai "https://github.com/yacbhl71/mazigho/blob/main/server/_core/llm.ts"
click node_media "https://github.com/yacbhl71/mazigho/blob/main/server/storage.ts"
click node_email "https://github.com/yacbhl71/mazigho/blob/main/server/transactionalEmail.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_app,node_storefront,node_owner_workspace,node_studio,node_acquisition toneBlue
class node_auth,node_api,node_server,node_scope,node_database toneAmber
class node_admin_ops,node_owner_ops,node_checkout,node_fulfillment toneMint
class node_supplier,node_ai,node_media,node_email,node_payment_provider toneRose
class node_visitor,node_operator,node_owner toneIndigo
```

## Components

### Product surfaces

- [Web application](https://github.com/yacbhl71/mazigho/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Public storefront](https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/Shop.tsx): `client/src/pages/Shop.tsx`
- [Owner workspace](https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/OwnerStorePanel.tsx): `client/src/pages/OwnerStorePanel.tsx`
- [MAZIGHO Studio](https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/admin/AdminStudio.tsx): `client/src/pages/admin/AdminStudio.tsx`
- [Store acquisition](https://github.com/yacbhl71/mazigho/blob/main/client/src/pages/StoreAcquisitionWizard.tsx): `client/src/pages/StoreAcquisitionWizard.tsx`

### Platform services

- [Authentication](https://github.com/yacbhl71/mazigho/blob/main/server/authRouter.ts): `server/authRouter.ts`
- [tRPC API](https://github.com/yacbhl71/mazigho/blob/main/server/routers.ts): `server/routers.ts`
- [HTTP server](https://github.com/yacbhl71/mazigho/blob/main/server/_core/index.ts): `server/_core/index.ts`
- [Tenant access control](https://github.com/yacbhl71/mazigho/blob/main/server/services/storeScope.ts): `server/services/storeScope.ts`
- [Commerce database](https://github.com/yacbhl71/mazigho/blob/main/drizzle/schema.ts): `drizzle/schema.ts`

### Commerce operations

- [Studio operations](https://github.com/yacbhl71/mazigho/blob/main/server/adminRouter.ts): `server/adminRouter.ts`
- [Store operations](https://github.com/yacbhl71/mazigho/blob/main/server/ownerRouter.ts): `server/ownerRouter.ts`
- [Checkout and payments](https://github.com/yacbhl71/mazigho/blob/main/server/stripeCheckout.ts): `server/stripeCheckout.ts`
- [Supplier fulfillment](https://github.com/yacbhl71/mazigho/blob/main/server/services/cjFulfillment.ts): `server/services/cjFulfillment.ts`

### External integrations

- [CJ Dropshipping](https://github.com/yacbhl71/mazigho/blob/main/server/cjDropshipping.ts): `server/cjDropshipping.ts`
- [AI services](https://github.com/yacbhl71/mazigho/blob/main/server/_core/llm.ts): `server/_core/llm.ts`
- [Media storage](https://github.com/yacbhl71/mazigho/blob/main/server/storage.ts): `server/storage.ts`
- [Transactional email](https://github.com/yacbhl71/mazigho/blob/main/server/transactionalEmail.ts): `server/transactionalEmail.ts`
- **Stripe**

### Other components

- **Shopper**
- **Platform operator**
- **Store owner**

## Connections

- Shopper → Web application: browses (evidence: `README.md`)
- Store owner → Web application: uses (evidence: `README.md`)
- Platform operator → Web application: uses (evidence: `README.md`)
- Web application → Public storefront: routes to (evidence: `client/src/App.tsx`)
- Web application → Store acquisition: routes to (evidence: `client/src/App.tsx`)
- Web application → Owner workspace: routes to (evidence: `client/src/App.tsx`)
- Web application → MAZIGHO Studio: routes to (evidence: `client/src/App.tsx`)
- Web application → tRPC API: uses procedures (evidence: `README.md`)
- HTTP server → tRPC API: mounts (evidence: `server/_core/index.ts`)
- HTTP server → Commerce database: builds context
- tRPC API → Authentication: registers (evidence: `server/routers.ts`)
- tRPC API → Studio operations: registers (evidence: `server/routers.ts`)
- tRPC API → Store operations: registers (evidence: `server/routers.ts`)
- tRPC API → Checkout and payments: routes checkout (evidence: `server/routers.ts`)
- Store operations → Tenant access control: enforces tenant scope
- Studio operations → Tenant access control: enforces platform scope (evidence: `server/adminRouter.ts`)
- Store operations → Commerce database: reads and writes (evidence: `server/ownerRouter.ts`)
- Studio operations → Commerce database: reads and writes (evidence: `server/adminRouter.ts`)
- Checkout and payments → Stripe: charges via
- Supplier fulfillment → CJ Dropshipping: prepares supplier order (evidence: `server/services/cjFulfillment.ts`)
- Studio operations → CJ Dropshipping: imports products (evidence: `server/adminRouter.ts`)
- Studio operations → AI services: invokes (evidence: `server/adminRouter.ts`)
- Store operations → AI services: invokes (evidence: `server/ownerRouter.ts`)
- Studio operations → Media storage: uploads media (evidence: `server/adminRouter.ts`)
- Authentication → Transactional email: sends reset email (evidence: `server/authRouter.ts`)
- Store operations → Transactional email: sends order email (evidence: `server/ownerRouter.ts`)
