# dhminh227/online_shopping architecture

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

- Interactive diagram: https://gitdiagram.com/dhminh227/online_shopping
- Repository: https://github.com/dhminh227/online_shopping

## Overview

Marketplace supports buyer shopping and seller operations: users authenticate, sellers apply and manage shops, listings are authored and reviewed, buyers build carts and check out, then orders are managed and fulfilled. The graph follows the documented module boundaries and the sampled route/composition wiring. Checkout, order, and worker internals were not sampled, so their detailed call relationships are omitted; the outbox and payment integration are included only at the documented capability level.

Main entry points: [`internal/app/app.go`](https://github.com/dhminh227/online_shopping/blob/master/internal/app/app.go) (App composition), [`web/src/app`](https://github.com/dhminh227/online_shopping/tree/master/web/src/app) (Marketplace UI), [`internal/platform/outbox`](https://github.com/dhminh227/online_shopping/tree/master/internal/platform/outbox) (Transactional outbox), [`web/src/lib/api.ts`](https://github.com/dhminh227/online_shopping/blob/master/web/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web storefront"]
  node_webapp["Marketplace UI"]
  node_webapi["API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and sellers"]
  node_auth["Authentication"]
  node_accounts["Accounts"]
  node_sellers["Seller applications"]
end

subgraph group_commerce["Catalog and commerce"]
  node_shops["Shops and policies"]
  node_catalog["Catalog and listings"]
  node_cart["Buyer cart"]
  node_checkout["Checkout"]
  node_payments["Payment gateway<br/>[gateway.go]"]
  node_orders["Orders and fulfillment"]
  node_inventory["Inventory"]
  node_shipping["Shipping<br/>[shipping.go]"]
end

subgraph group_runtime["Application runtime"]
  node_api["HTTP API<br/>[main.go]"]
  node_composition["App composition<br/>[app.go]"]
  node_worker["Background worker<br/>[main.go]"]
end

subgraph group_platform["Platform services"]
  node_database[("PostgreSQL<br/>[postgres.go]")]
  node_objectstorage["Object storage<br/>[client.go]"]
  node_outbox["Transactional outbox"]
  node_email["Email delivery<br/>[email.go]"]
end

node_buyer(("Buyer"))
node_seller(("Seller"))
node_admin(("Administrator"))

node_buyer -->|"shops and buys"| node_webapp
node_seller -->|"manages shop"| node_webapp
node_admin -->|"moderates"| node_webapp
node_webapp -->|"requests data"| node_webapi
node_webapi -->|"calls API"| node_api
node_api -->|"serves through"| node_composition
node_composition -->|"registers routes"| node_auth
node_composition -->|"registers routes"| node_accounts
node_composition -->|"registers routes"| node_sellers
node_composition -->|"registers routes"| node_shops
node_composition -->|"registers routes"| node_catalog
node_composition -->|"registers routes"| node_cart
node_composition -->|"registers routes"| node_checkout
node_composition -->|"registers routes"| node_orders
node_composition -->|"registers routes"| node_inventory
node_composition -->|"provides connection"| node_database
node_composition -->|"provides client"| node_objectstorage
node_composition -->|"creates repository"| node_outbox
node_checkout -.->|"uses gateway"| node_payments
node_catalog -->|"stores listing media"| node_objectstorage
node_worker -->|"delivers events"| node_outbox
node_outbox -.->|"dispatches email"| node_email

click node_webapp "https://github.com/dhminh227/online_shopping/tree/master/web/src/app"
click node_webapi "https://github.com/dhminh227/online_shopping/blob/master/web/src/lib/api.ts"
click node_api "https://github.com/dhminh227/online_shopping/blob/master/cmd/api/main.go"
click node_composition "https://github.com/dhminh227/online_shopping/blob/master/internal/app/app.go"
click node_auth "https://github.com/dhminh227/online_shopping/tree/master/internal/auth"
click node_accounts "https://github.com/dhminh227/online_shopping/tree/master/internal/accounts"
click node_sellers "https://github.com/dhminh227/online_shopping/tree/master/internal/sellers"
click node_shops "https://github.com/dhminh227/online_shopping/tree/master/internal/shops"
click node_catalog "https://github.com/dhminh227/online_shopping/tree/master/internal/catalog"
click node_cart "https://github.com/dhminh227/online_shopping/tree/master/internal/cart"
click node_checkout "https://github.com/dhminh227/online_shopping/tree/master/internal/checkout"
click node_payments "https://github.com/dhminh227/online_shopping/blob/master/internal/payments/gateway.go"
click node_orders "https://github.com/dhminh227/online_shopping/tree/master/internal/orders"
click node_inventory "https://github.com/dhminh227/online_shopping/tree/master/internal/inventory"
click node_shipping "https://github.com/dhminh227/online_shopping/blob/master/internal/shipping/shipping.go"
click node_database "https://github.com/dhminh227/online_shopping/blob/master/internal/platform/database/postgres.go"
click node_objectstorage "https://github.com/dhminh227/online_shopping/blob/master/internal/platform/objectstorage/client.go"
click node_outbox "https://github.com/dhminh227/online_shopping/tree/master/internal/platform/outbox"
click node_worker "https://github.com/dhminh227/online_shopping/blob/master/cmd/worker/main.go"
click node_email "https://github.com/dhminh227/online_shopping/blob/master/internal/platform/email/email.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_webapp,node_webapi toneBlue
class node_auth,node_accounts,node_sellers toneAmber
class node_shops,node_catalog,node_cart,node_checkout,node_payments,node_orders,node_inventory,node_shipping toneMint
class node_api,node_composition,node_worker toneRose
class node_database,node_objectstorage,node_outbox,node_email,node_buyer,node_seller,node_admin toneIndigo
```

## Components

### Web storefront

- [Marketplace UI](https://github.com/dhminh227/online_shopping/tree/master/web/src/app): `web/src/app`
- [API client](https://github.com/dhminh227/online_shopping/blob/master/web/src/lib/api.ts): `web/src/lib/api.ts`

### Identity and sellers

- [Authentication](https://github.com/dhminh227/online_shopping/tree/master/internal/auth): `internal/auth`
- [Accounts](https://github.com/dhminh227/online_shopping/tree/master/internal/accounts): `internal/accounts`
- [Seller applications](https://github.com/dhminh227/online_shopping/tree/master/internal/sellers): `internal/sellers`

### Catalog and commerce

- [Shops and policies](https://github.com/dhminh227/online_shopping/tree/master/internal/shops): `internal/shops`
- [Catalog and listings](https://github.com/dhminh227/online_shopping/tree/master/internal/catalog): `internal/catalog`
- [Buyer cart](https://github.com/dhminh227/online_shopping/tree/master/internal/cart): `internal/cart`
- [Checkout](https://github.com/dhminh227/online_shopping/tree/master/internal/checkout): `internal/checkout`
- [Payment gateway](https://github.com/dhminh227/online_shopping/blob/master/internal/payments/gateway.go): `internal/payments/gateway.go`
- [Orders and fulfillment](https://github.com/dhminh227/online_shopping/tree/master/internal/orders): `internal/orders`
- [Inventory](https://github.com/dhminh227/online_shopping/tree/master/internal/inventory): `internal/inventory`
- [Shipping](https://github.com/dhminh227/online_shopping/blob/master/internal/shipping/shipping.go): `internal/shipping/shipping.go`

### Application runtime

- [HTTP API](https://github.com/dhminh227/online_shopping/blob/master/cmd/api/main.go): `cmd/api/main.go`
- [App composition](https://github.com/dhminh227/online_shopping/blob/master/internal/app/app.go): `internal/app/app.go`
- [Background worker](https://github.com/dhminh227/online_shopping/blob/master/cmd/worker/main.go): `cmd/worker/main.go`

### Platform services

- [PostgreSQL](https://github.com/dhminh227/online_shopping/blob/master/internal/platform/database/postgres.go): `internal/platform/database/postgres.go`
- [Object storage](https://github.com/dhminh227/online_shopping/blob/master/internal/platform/objectstorage/client.go): `internal/platform/objectstorage/client.go`
- [Transactional outbox](https://github.com/dhminh227/online_shopping/tree/master/internal/platform/outbox): `internal/platform/outbox`
- [Email delivery](https://github.com/dhminh227/online_shopping/blob/master/internal/platform/email/email.go): `internal/platform/email/email.go`

### Other components

- **Buyer**
- **Seller**
- **Administrator**

## Connections

- Buyer → Marketplace UI: shops and buys
- Seller → Marketplace UI: manages shop
- Administrator → Marketplace UI: moderates
- Marketplace UI → API client: requests data
- API client → HTTP API: calls API
- HTTP API → App composition: serves through
- App composition → Authentication: registers routes
- App composition → Accounts: registers routes
- App composition → Seller applications: registers routes
- App composition → Shops and policies: registers routes
- App composition → Catalog and listings: registers routes
- App composition → Buyer cart: registers routes
- App composition → Checkout: registers routes
- App composition → Orders and fulfillment: registers routes
- App composition → Inventory: registers routes
- App composition → PostgreSQL: provides connection
- App composition → Object storage: provides client
- App composition → Transactional outbox: creates repository
- Checkout → Payment gateway: uses gateway
- Catalog and listings → Object storage: stores listing media
- Background worker → Transactional outbox: delivers events
- Transactional outbox → Email delivery: dispatches email
