# brianandhikap/accessgo-retail-v2 architecture

> Architecture diagram of the GitHub repository brianandhikap/accessgo-retail-v2, 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/brianandhikap/accessgo-retail-v2
- Repository: https://github.com/brianandhikap/accessgo-retail-v2

## Overview

AccessGo Retail is a multi-shop retail platform with WhatsApp/Telegram sales, AI-assisted ordering, QRIS payment, fulfillment, and tenant administration. The customer workflow runs from the public storefront through chat, order and payment processing to shipment tracking; admins manage shops, catalog, staff, promotions, and finances, while Super Admins manage tenants and plans. The graph includes documented capabilities whose route implementations were not sampled. Edges are limited to README statements and source-index references; unsampled route internals are represented at their exact directory path.

Main entry points: [`src/App.jsx`](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/App.jsx) (App routes), [`server/services/orders.js`](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/orders.js) (Order lifecycle), [`server/routes`](https://github.com/brianandhikap/accessgo-retail-v2/tree/main/server/routes) (API routes), [`server/services/channels.js`](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/channels.js) (Chat channels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_web["App routes<br/>[App.jsx]"]
  node_clientstate["Session and shop state<br/>[ctx.jsx]"]
  node_api["API client<br/>[api.js]"]
  node_catalogui["Catalog management<br/>[Products.jsx]"]
  node_orderui["Order management<br/>[Orders.jsx]"]
  node_adminui["Shop operations<br/>[Shops.jsx]"]
  node_financeui["Finance screens<br/>[Finance.jsx]"]
  node_saadminui["Platform controls<br/>[Superadmin.jsx]"]
end

subgraph group_commerce["Sales and fulfillment"]
  node_storefront["Public storefront<br/>[Storefront.jsx]"]
  node_invoiceview["Invoice tracking<br/>[Invoice.jsx]"]
  node_catalog["Catalog and promotions<br/>[catalog.js]"]
  node_orders["Order lifecycle<br/>[orders.js]"]
  node_payments["QRIS payments<br/>[singapay.js]"]
  node_shipping["Shipping quotes<br/>[kiriminaja.js]"]
  node_refunds["Refund handling<br/>[refunds.js]"]
end

subgraph group_messaging["Messaging and assistance"]
  node_ai["AI order assistant<br/>[ai.js]"]
  node_channels["Chat channels<br/>[channels.js]"]
  node_whatsapp["WhatsApp connector<br/>[whatsapp.js]"]
  node_telegram["Telegram connector<br/>[telegram.js]"]
end

subgraph group_operations["Platform operations"]
  node_routes["API routes"]
  node_auth["Authentication<br/>[auth.js]"]
  node_wallet["Shop wallet<br/>[wallet.js]"]
  node_plans["Plans and access<br/>[plans.js]"]
  node_billing["Subscriptions<br/>[billing.js]"]
  node_notify["Notifications<br/>[notify.js]"]
  node_mail["Account email<br/>[accountMail.js]"]
end

subgraph group_state["Persistence"]
  node_db[("Retail database<br/>[db.js]")]
end

node_customer(("Customer"))
node_admin(("Shop admin"))
node_superadmin(("Super Admin"))
node_singapay{{"Singapay"}}
node_kiriminaja{{"KiriminAja"}}
node_wa{{"WhatsApp"}}
node_tg{{"Telegram"}}

node_customer -->|"browses and orders"| node_storefront
node_storefront -.->|"requests data"| node_api
node_storefront -->|"orders through"| node_wa
node_storefront -->|"orders through"| node_tg
node_wa -.->|"delivers messages"| node_channels
node_tg -.->|"delivers messages"| node_channels
node_channels -->|"handles incoming"| node_ai
node_ai -->|"reads catalog"| node_catalog
node_ai -->|"starts orders"| node_orders
node_ai -->|"gets shipping rates"| node_shipping
node_orders -->|"creates QRIS"| node_payments
node_orders -->|"creates shipment"| node_shipping
node_orders -->|"sends invoice"| node_channels
node_payments -.->|"requests payment"| node_singapay
node_shipping -.->|"requests delivery"| node_kiriminaja
node_singapay -->|"sends payment webhook"| node_routes
node_routes -->|"confirms payment"| node_orders
node_orders -->|"credits shop"| node_wallet
node_orders -->|"notifies parties"| node_notify
node_orders -->|"coordinates refunds"| node_refunds
node_orders -->|"reads and writes"| node_db
node_channels -->|"dispatches WhatsApp"| node_whatsapp
node_channels -->|"dispatches Telegram"| node_telegram
node_whatsapp -.->|"connects"| node_wa
node_telegram -.->|"connects"| node_tg
node_admin -->|"manages shop"| node_web
node_superadmin -->|"manages platform"| node_web
node_web -->|"loads providers"| node_clientstate
node_clientstate -->|"fetches session"| node_api
node_web -->|"routes to"| node_storefront
node_web -->|"routes to"| node_invoiceview
node_web -->|"routes to"| node_catalogui
node_web -->|"routes to"| node_orderui
node_web -->|"routes to"| node_adminui
node_web -->|"routes to"| node_financeui
node_web -->|"routes to"| node_saadminui
node_api -.->|"calls API"| node_routes
node_routes -.->|"authenticates requests"| node_auth
node_routes -.->|"manages catalog"| node_catalog
node_routes -->|"checks entitlements"| node_plans
node_routes -->|"handles subscriptions"| node_billing
node_routes -->|"handles withdrawals"| node_wallet
node_routes -->|"queues account email"| node_mail
node_plans -->|"reads plans"| node_db
node_billing -->|"creates subscription payments"| node_payments
node_billing -->|"sends account email"| node_mail
node_wallet -.->|"records ledger"| node_db
node_notify -->|"sends alerts"| node_whatsapp

click node_web "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/App.jsx"
click node_clientstate "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/ctx.jsx"
click node_api "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/api.js"
click node_storefront "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Storefront.jsx"
click node_invoiceview "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Invoice.jsx"
click node_catalogui "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Products.jsx"
click node_orderui "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Orders.jsx"
click node_adminui "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Shops.jsx"
click node_financeui "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Finance.jsx"
click node_saadminui "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Superadmin.jsx"
click node_routes "https://github.com/brianandhikap/accessgo-retail-v2/tree/main/server/routes"
click node_auth "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/auth.js"
click node_catalog "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/catalog.js"
click node_ai "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/ai.js"
click node_channels "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/channels.js"
click node_whatsapp "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/whatsapp.js"
click node_telegram "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/telegram.js"
click node_orders "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/orders.js"
click node_payments "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/singapay.js"
click node_shipping "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/kiriminaja.js"
click node_refunds "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/refunds.js"
click node_wallet "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/wallet.js"
click node_plans "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/plans.js"
click node_billing "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/billing.js"
click node_notify "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/notify.js"
click node_mail "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/accountMail.js"
click node_db "https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/db.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_web,node_clientstate,node_api,node_catalogui,node_orderui,node_adminui,node_financeui,node_saadminui toneBlue
class node_storefront,node_invoiceview,node_catalog,node_orders,node_payments,node_shipping,node_refunds toneAmber
class node_ai,node_channels,node_whatsapp,node_telegram toneMint
class node_routes,node_auth,node_wallet,node_plans,node_billing,node_notify,node_mail toneRose
class node_db,node_customer,node_admin,node_superadmin,node_singapay,node_kiriminaja,node_wa,node_tg toneIndigo
```

## Components

### Web application

- [App routes](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/App.jsx): `src/App.jsx`
- [Session and shop state](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/ctx.jsx): `src/ctx.jsx`
- [API client](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/api.js): `src/api.js`
- [Catalog management](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Products.jsx): `src/pages/Products.jsx`
- [Order management](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Orders.jsx): `src/pages/Orders.jsx`
- [Shop operations](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Shops.jsx): `src/pages/Shops.jsx`
- [Finance screens](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Finance.jsx): `src/pages/Finance.jsx`
- [Platform controls](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Superadmin.jsx): `src/pages/Superadmin.jsx`

### Sales and fulfillment

- [Public storefront](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Storefront.jsx): `src/pages/Storefront.jsx`
- [Invoice tracking](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/src/pages/Invoice.jsx): `src/pages/Invoice.jsx`
- [Catalog and promotions](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/catalog.js): `server/services/catalog.js`
- [Order lifecycle](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/orders.js): `server/services/orders.js`
- [QRIS payments](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/singapay.js): `server/services/singapay.js`
- [Shipping quotes](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/kiriminaja.js): `server/services/kiriminaja.js`
- [Refund handling](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/refunds.js): `server/services/refunds.js`

### Messaging and assistance

- [AI order assistant](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/ai.js): `server/services/ai.js`
- [Chat channels](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/channels.js): `server/services/channels.js`
- [WhatsApp connector](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/whatsapp.js): `server/services/whatsapp.js`
- [Telegram connector](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/telegram.js): `server/services/telegram.js`

### Platform operations

- [API routes](https://github.com/brianandhikap/accessgo-retail-v2/tree/main/server/routes): `server/routes`
- [Authentication](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/auth.js): `server/auth.js`
- [Shop wallet](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/wallet.js): `server/services/wallet.js`
- [Plans and access](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/plans.js): `server/services/plans.js`
- [Subscriptions](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/billing.js): `server/services/billing.js`
- [Notifications](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/notify.js): `server/services/notify.js`
- [Account email](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/services/accountMail.js): `server/services/accountMail.js`

### Persistence

- [Retail database](https://github.com/brianandhikap/accessgo-retail-v2/blob/main/server/db.js): `server/db.js`

### Other components

- **Customer**
- **Shop admin**
- **Super Admin**
- **Singapay**
- **KiriminAja**
- **WhatsApp**
- **Telegram**

## Connections

- Customer → Public storefront: browses and orders
- Public storefront → API client: requests data (evidence: `src/pages/Storefront.jsx`)
- Public storefront → WhatsApp: orders through
- Public storefront → Telegram: orders through
- WhatsApp → Chat channels: delivers messages
- Telegram → Chat channels: delivers messages
- Chat channels → AI order assistant: handles incoming (evidence: `server/services/channels.js`)
- AI order assistant → Catalog and promotions: reads catalog (evidence: `server/services/ai.js`)
- AI order assistant → Order lifecycle: starts orders (evidence: `server/services/ai.js`)
- AI order assistant → Shipping quotes: gets shipping rates (evidence: `server/services/ai.js`)
- Order lifecycle → QRIS payments: creates QRIS (evidence: `server/services/orders.js`)
- Order lifecycle → Shipping quotes: creates shipment (evidence: `server/services/orders.js`)
- Order lifecycle → Chat channels: sends invoice (evidence: `server/services/orders.js`)
- QRIS payments → Singapay: requests payment
- Shipping quotes → KiriminAja: requests delivery
- Singapay → API routes: sends payment webhook
- API routes → Order lifecycle: confirms payment (evidence: `server/routes/webhooks.js`)
- Order lifecycle → Shop wallet: credits shop (evidence: `server/services/orders.js`)
- Order lifecycle → Notifications: notifies parties (evidence: `server/services/orders.js`)
- Order lifecycle → Refund handling: coordinates refunds (evidence: `server/services/orders.js`)
- Order lifecycle → Retail database: reads and writes (evidence: `server/services/orders.js`)
- Chat channels → WhatsApp connector: dispatches WhatsApp (evidence: `server/services/channels.js`)
- Chat channels → Telegram connector: dispatches Telegram (evidence: `server/services/channels.js`)
- WhatsApp connector → WhatsApp: connects
- Telegram connector → Telegram: connects
- Shop admin → App routes: manages shop
- Super Admin → App routes: manages platform
- App routes → Session and shop state: loads providers (evidence: `src/App.jsx`)
- Session and shop state → API client: fetches session (evidence: `src/ctx.jsx`)
- App routes → Public storefront: routes to (evidence: `src/App.jsx`)
- App routes → Invoice tracking: routes to (evidence: `src/App.jsx`)
- App routes → Catalog management: routes to (evidence: `src/App.jsx`)
- App routes → Order management: routes to (evidence: `src/App.jsx`)
- App routes → Shop operations: routes to (evidence: `src/App.jsx`)
- App routes → Finance screens: routes to (evidence: `src/App.jsx`)
- App routes → Platform controls: routes to (evidence: `src/App.jsx`)
- API client → API routes: calls API
- API routes → Authentication: authenticates requests (evidence: `server/routes/auth.js`)
- API routes → Catalog and promotions: manages catalog
- API routes → Plans and access: checks entitlements (evidence: `server/routes/auth.js`)
- API routes → Subscriptions: handles subscriptions (evidence: `server/routes/webhooks.js`)
- API routes → Shop wallet: handles withdrawals (evidence: `server/routes/superadmin.js`)
- API routes → Account email: queues account email (evidence: `server/routes/auth.js`)
- Plans and access → Retail database: reads plans (evidence: `server/services/plans.js`)
- Subscriptions → QRIS payments: creates subscription payments (evidence: `server/services/billing.js`)
- Subscriptions → Account email: sends account email (evidence: `server/services/billing.js`)
- Shop wallet → Retail database: records ledger (evidence: `server/services/wallet.js`)
- Notifications → WhatsApp connector: sends alerts (evidence: `server/services/notify.js`)
