# mohammedniyasm/e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/mohammedniyasm/e-commerce
- Repository: https://github.com/mohammedniyasm/e-commerce

## Overview

This repository is a Go e-commerce HTTP service. Its user-facing workflow exposes product browsing and authenticated shopping operations through routed handlers; review operations are shown crossing into a use case and PostgreSQL repository. The tree also identifies order, payment, shipping, wallet, referral, catalog administration, and background-worker subsystems. The excerpts establish server startup and selected route and review relationships; other subsystem links are omitted where their wiring was not shown.

Main entry points: [`internal/delivery/http/router/routes.go`](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/router/routes.go) (API Routes), [`internal/usecase/payment`](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/payment) (Payments), [`internal/delivery/http/handler/review_handler.go`](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/review_handler.go) (Review Handler), [`internal/usecase/review/review_usecase.go`](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/usecase/review/review_usecase.go) (Review Use Case)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and HTTP"]
  node_server["HTTP Server<br/>[main.go]"]
  node_bootstrap["Application Bootstrap<br/>[bootstrap.go]"]
  node_routes["API Routes<br/>[routes.go]"]
end

subgraph group_commerce["Commerce Operations"]
  node_order_handler["Order Handlers<br/>[order_handler.go]"]
  node_cart["Cart Operations"]
  node_payment["Payments"]
  node_shipment["Shipping"]
  node_returns["Returns"]
  node_wallet["Wallet"]
  node_referral["Referrals"]
end

subgraph group_catalog["Catalog and Feedback"]
  node_product_handler["Product Handlers<br/>[product_handler.go]"]
  node_brand_handler["Brand Handlers<br/>[brand_handler.go]"]
  node_review_handler["Review Handler<br/>[review_handler.go]"]
  node_review_usecase["Review Use Case<br/>[review_usecase.go]"]
  node_catalog_ops["Catalog Operations"]
end

subgraph group_platform["Persistence and Services"]
  node_review_repository["Review Repository"]
  node_postgres[("PostgreSQL Repositories")]
  node_integrations["External Integrations"]
  node_workers["Background Workers"]
end

node_user(("Shopper"))
node_admin(("Administrator"))

node_server -->|"initializes"| node_bootstrap
node_user -.->|"sends requests"| node_routes
node_admin -.->|"sends requests"| node_routes
node_routes -->|"routes products"| node_product_handler
node_routes -->|"routes brands"| node_brand_handler
node_routes -->|"routes orders"| node_order_handler
node_routes -->|"routes reviews"| node_review_handler
node_routes -.->|"routes cart"| node_cart
node_routes -.->|"routes payments"| node_payment
node_routes -->|"routes shipping"| node_shipment
node_routes -->|"routes returns"| node_returns
node_routes -->|"routes wallet"| node_wallet
node_routes -->|"routes referrals"| node_referral
node_routes -->|"routes catalog"| node_catalog_ops
node_review_handler -->|"calls"| node_review_usecase
node_review_usecase -.->|"uses repository"| node_review_repository
node_review_repository -.->|"queries"| node_postgres
node_payment -.->|"uses gateways"| node_integrations
node_workers -.->|"maintains records"| node_postgres

click node_server "https://github.com/mohammedniyasm/e-commerce/blob/master/cmd/server/main.go"
click node_bootstrap "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/bootstrap/bootstrap.go"
click node_routes "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/router/routes.go"
click node_product_handler "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/product_handler.go"
click node_brand_handler "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/brand_handler.go"
click node_order_handler "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/order_handler.go"
click node_review_handler "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/review_handler.go"
click node_review_usecase "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/usecase/review/review_usecase.go"
click node_review_repository "https://github.com/mohammedniyasm/e-commerce/blob/master/internal/repository/postgres/review_repository.go"
click node_cart "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/cart"
click node_payment "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/payment"
click node_shipment "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/shipment"
click node_returns "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/returnrequest"
click node_wallet "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/wallet"
click node_referral "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/referral"
click node_catalog_ops "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/products"
click node_postgres "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/repository/postgres"
click node_integrations "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/infrastructure"
click node_workers "https://github.com/mohammedniyasm/e-commerce/tree/master/internal/worker"

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_server,node_bootstrap,node_routes toneBlue
class node_order_handler,node_cart,node_payment,node_shipment,node_returns,node_wallet,node_referral toneAmber
class node_product_handler,node_brand_handler,node_review_handler,node_review_usecase,node_catalog_ops toneMint
class node_review_repository,node_postgres,node_integrations,node_workers toneRose
class node_user,node_admin toneIndigo
```

## Components

### Runtime and HTTP

- [HTTP Server](https://github.com/mohammedniyasm/e-commerce/blob/master/cmd/server/main.go): `cmd/server/main.go`
- [Application Bootstrap](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/bootstrap/bootstrap.go): `internal/bootstrap/bootstrap.go`
- [API Routes](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/router/routes.go): `internal/delivery/http/router/routes.go`

### Commerce Operations

- [Order Handlers](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/order_handler.go): `internal/delivery/http/handler/order_handler.go`
- [Cart Operations](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/cart): `internal/usecase/cart`
- [Payments](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/payment): `internal/usecase/payment`
- [Shipping](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/shipment): `internal/usecase/shipment`
- [Returns](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/returnrequest): `internal/usecase/returnrequest`
- [Wallet](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/wallet): `internal/usecase/wallet`
- [Referrals](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/referral): `internal/usecase/referral`

### Catalog and Feedback

- [Product Handlers](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/product_handler.go): `internal/delivery/http/handler/product_handler.go`
- [Brand Handlers](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/brand_handler.go): `internal/delivery/http/handler/brand_handler.go`
- [Review Handler](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/delivery/http/handler/review_handler.go): `internal/delivery/http/handler/review_handler.go`
- [Review Use Case](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/usecase/review/review_usecase.go): `internal/usecase/review/review_usecase.go`
- [Catalog Operations](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/usecase/products): `internal/usecase/products`

### Persistence and Services

- [Review Repository](https://github.com/mohammedniyasm/e-commerce/blob/master/internal/repository/postgres/review_repository.go): `internal/repository/postgres/review_repository.go`
- [PostgreSQL Repositories](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/repository/postgres): `internal/repository/postgres`
- [External Integrations](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/infrastructure): `internal/infrastructure`
- [Background Workers](https://github.com/mohammedniyasm/e-commerce/tree/master/internal/worker): `internal/worker`

### Other components

- **Shopper**
- **Administrator**

## Connections

- HTTP Server → Application Bootstrap: initializes (evidence: `cmd/server/main.go`)
- Shopper → API Routes: sends requests
- Administrator → API Routes: sends requests
- API Routes → Product Handlers: routes products (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Brand Handlers: routes brands (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Order Handlers: routes orders (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Review Handler: routes reviews (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Cart Operations: routes cart
- API Routes → Payments: routes payments
- API Routes → Shipping: routes shipping (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Returns: routes returns (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Wallet: routes wallet (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Referrals: routes referrals (evidence: `internal/delivery/http/router/routes.go`)
- API Routes → Catalog Operations: routes catalog (evidence: `internal/delivery/http/router/routes.go`)
- Review Handler → Review Use Case: calls (evidence: `internal/delivery/http/handler/review_handler.go`)
- Review Use Case → Review Repository: uses repository
- Review Repository → PostgreSQL Repositories: queries
- Payments → External Integrations: uses gateways
- Background Workers → PostgreSQL Repositories: maintains records
