# alisina-1231/ecommerce-platform architecture

> Architecture diagram of the GitHub repository alisina-1231/ecommerce-platform, 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/alisina-1231/ecommerce-platform
- Repository: https://github.com/alisina-1231/ecommerce-platform

## Overview

This repository is a Go e-commerce backend split into product, cart, checkout, order, and payment services. The principal workflow enters checkout, which reads the cart, retrieves products and totals them, creates an order and payment, then clears the cart and returns the result. Product, cart, order, and payment also expose independent API operations. The README lists additional cloud, streaming, and ML capabilities, but their implementation directories are absent from the supplied tree. Service wiring is shown where excerpts support it; some storage and HTTP boundaries remain unverified.

Main entry points: [`services/checkout/internal/client`](https://github.com/alisina-1231/ecommerce-platform/tree/main/services/checkout/internal/client) (Service clients), [`services/product/internal/repository/product_repository.go`](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/repository/product_repository.go) (Product repository), [`services/cart/internal/repository/cart_repository.go`](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/repository/cart_repository.go) (Cart repository), [`services/order/internal/repository/order_repository.go`](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/repository/order_repository.go) (Order repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_checkout["Checkout orchestration"]
  node_checkout_server["Checkout API<br/>[main.go]"]
  node_checkout_handler["Checkout workflow"]
  node_checkout_clients["Service clients"]
  node_checkout_models["Checkout contracts<br/>[checkout.go]"]
end

subgraph group_catalog["Product catalog"]
  node_product_server["Product API<br/>[main.go]"]
  node_product_handler["Product operations<br/>[product_handler.go]"]
  node_product_repo["Product repository"]
  node_product_model["Product model<br/>[product.go]"]
  node_product_db[("Product database<br/>[database.go]")]
end

subgraph group_cart["Shopping cart"]
  node_cart_server["Cart API<br/>[main.go]"]
  node_cart_handler["Cart operations<br/>[cart_handler.go]"]
  node_cart_repo["Cart repository<br/>[cart_repository.go]"]
  node_cart_model["Cart model<br/>[cart.go]"]
  node_cart_db[("DynamoDB<br/>[database.go]")]
end

subgraph group_orders["Order management"]
  node_order_server["Order API<br/>[main.go]"]
  node_order_handler["Order operations<br/>[order_handler.go]"]
  node_order_repo["Order repository"]
  node_order_model["Order model<br/>[order.go]"]
  node_order_db[("Order database<br/>[database.go]")]
end

subgraph group_payments["Payment management"]
  node_payment_server["Payment API<br/>[main.go]"]
  node_payment_handler["Payment operations<br/>[payment_handler.go]"]
  node_payment_repo["Payment repository"]
  node_payment_model["Payment model<br/>[payment.go]"]
  node_payment_db[("Payment database<br/>[database.go]")]
end

node_buyer(("Client"))

node_buyer -->|"submits checkout"| node_checkout_server
node_checkout_server -->|"routes request"| node_checkout_handler
node_checkout_handler -->|"calls clients"| node_checkout_clients
node_checkout_handler -->|"uses contracts"| node_checkout_models
node_checkout_clients -.->|"HTTP requests"| node_cart_server
node_checkout_clients -.->|"HTTP requests"| node_product_server
node_checkout_clients -.->|"HTTP requests"| node_order_server
node_checkout_clients -.->|"HTTP requests"| node_payment_server
node_product_server -->|"routes requests"| node_product_handler
node_product_server -->|"constructs repository"| node_product_repo
node_product_handler -->|"reads and writes"| node_product_repo
node_product_repo -->|"uses model"| node_product_model
node_product_repo -.->|"queries database"| node_product_db
node_cart_server -->|"routes requests"| node_cart_handler
node_cart_server -->|"constructs repository"| node_cart_repo
node_cart_handler -->|"manages carts"| node_cart_repo
node_cart_repo -->|"reads and writes"| node_cart_model
node_cart_repo -->|"reads and writes"| node_cart_db
node_order_server -->|"routes requests"| node_order_handler
node_order_server -->|"constructs repository"| node_order_repo
node_order_handler -->|"manages orders"| node_order_repo
node_order_repo -->|"uses model"| node_order_model
node_order_repo -.->|"queries database"| node_order_db
node_payment_server -->|"routes requests"| node_payment_handler
node_payment_server -->|"constructs repository"| node_payment_repo
node_payment_handler -->|"manages payments"| node_payment_repo
node_payment_repo -->|"uses model"| node_payment_model
node_payment_repo -.->|"queries database"| node_payment_db

click node_checkout_server "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/checkout/cmd/server/main.go"
click node_checkout_handler "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/checkout/internal/handler/checkout_handler.go"
click node_checkout_clients "https://github.com/alisina-1231/ecommerce-platform/tree/main/services/checkout/internal/client"
click node_checkout_models "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/checkout/internal/models/checkout.go"
click node_product_server "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/cmd/server/main.go"
click node_product_handler "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/handler/product_handler.go"
click node_product_repo "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/repository/product_repository.go"
click node_product_model "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/models/product.go"
click node_product_db "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/database/database.go"
click node_cart_server "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/cmd/server/main.go"
click node_cart_handler "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/handler/cart_handler.go"
click node_cart_repo "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/repository/cart_repository.go"
click node_cart_model "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/models/cart.go"
click node_cart_db "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/database/database.go"
click node_order_server "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/cmd/server/main.go"
click node_order_handler "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/handler/order_handler.go"
click node_order_repo "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/repository/order_repository.go"
click node_order_model "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/models/order.go"
click node_order_db "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/database/database.go"
click node_payment_server "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/cmd/server/main.go"
click node_payment_handler "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/handler/payment_handler.go"
click node_payment_repo "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/repository/payment_repository.go"
click node_payment_model "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/models/payment.go"
click node_payment_db "https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/database/database.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_checkout_server,node_checkout_handler,node_checkout_clients,node_checkout_models,node_buyer toneBlue
class node_product_server,node_product_handler,node_product_repo,node_product_model,node_product_db toneAmber
class node_cart_server,node_cart_handler,node_cart_repo,node_cart_model,node_cart_db toneMint
class node_order_server,node_order_handler,node_order_repo,node_order_model,node_order_db toneRose
class node_payment_server,node_payment_handler,node_payment_repo,node_payment_model,node_payment_db toneIndigo
```

## Components

### Checkout orchestration

- [Checkout API](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/checkout/cmd/server/main.go): `services/checkout/cmd/server/main.go`
- [Checkout workflow](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/checkout/internal/handler/checkout_handler.go): `services/checkout/internal/handler/checkout_handler.go`
- [Service clients](https://github.com/alisina-1231/ecommerce-platform/tree/main/services/checkout/internal/client): `services/checkout/internal/client`
- [Checkout contracts](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/checkout/internal/models/checkout.go): `services/checkout/internal/models/checkout.go`

### Product catalog

- [Product API](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/cmd/server/main.go): `services/product/cmd/server/main.go`
- [Product operations](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/handler/product_handler.go): `services/product/internal/handler/product_handler.go`
- [Product repository](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/repository/product_repository.go): `services/product/internal/repository/product_repository.go`
- [Product model](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/models/product.go): `services/product/internal/models/product.go`
- [Product database](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/product/internal/database/database.go): `services/product/internal/database/database.go`

### Shopping cart

- [Cart API](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/cmd/server/main.go): `services/cart/cmd/server/main.go`
- [Cart operations](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/handler/cart_handler.go): `services/cart/internal/handler/cart_handler.go`
- [Cart repository](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/repository/cart_repository.go): `services/cart/internal/repository/cart_repository.go`
- [Cart model](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/models/cart.go): `services/cart/internal/models/cart.go`
- [DynamoDB](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/cart/internal/database/database.go): `services/cart/internal/database/database.go`

### Order management

- [Order API](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/cmd/server/main.go): `services/order/cmd/server/main.go`
- [Order operations](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/handler/order_handler.go): `services/order/internal/handler/order_handler.go`
- [Order repository](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/repository/order_repository.go): `services/order/internal/repository/order_repository.go`
- [Order model](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/models/order.go): `services/order/internal/models/order.go`
- [Order database](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/order/internal/database/database.go): `services/order/internal/database/database.go`

### Payment management

- [Payment API](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/cmd/server/main.go): `services/payment/cmd/server/main.go`
- [Payment operations](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/handler/payment_handler.go): `services/payment/internal/handler/payment_handler.go`
- [Payment repository](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/repository/payment_repository.go): `services/payment/internal/repository/payment_repository.go`
- [Payment model](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/models/payment.go): `services/payment/internal/models/payment.go`
- [Payment database](https://github.com/alisina-1231/ecommerce-platform/blob/main/services/payment/internal/database/database.go): `services/payment/internal/database/database.go`

### Other components

- **Client**

## Connections

- Client → Checkout API: submits checkout (evidence: `services/checkout/cmd/server/main.go`)
- Checkout API → Checkout workflow: routes request (evidence: `services/checkout/cmd/server/main.go`)
- Checkout workflow → Service clients: calls clients (evidence: `services/checkout/internal/handler/checkout_handler.go`)
- Checkout workflow → Checkout contracts: uses contracts (evidence: `services/checkout/internal/handler/checkout_handler.go`)
- Service clients → Cart API: HTTP requests
- Service clients → Product API: HTTP requests
- Service clients → Order API: HTTP requests
- Service clients → Payment API: HTTP requests
- Product API → Product operations: routes requests (evidence: `services/product/cmd/server/main.go`)
- Product API → Product repository: constructs repository (evidence: `services/product/cmd/server/main.go`)
- Product operations → Product repository: reads and writes (evidence: `services/product/internal/handler/product_handler.go`)
- Product repository → Product model: uses model (evidence: `services/product/internal/repository/product_repository.go`)
- Product repository → Product database: queries database
- Cart API → Cart operations: routes requests (evidence: `services/cart/cmd/server/main.go`)
- Cart API → Cart repository: constructs repository (evidence: `services/cart/cmd/server/main.go`)
- Cart operations → Cart repository: manages carts (evidence: `services/cart/internal/handler/cart_handler.go`)
- Cart repository → Cart model: reads and writes (evidence: `services/cart/internal/repository/cart_repository.go`)
- Cart repository → DynamoDB: reads and writes (evidence: `services/cart/internal/repository/cart_repository.go`)
- Order API → Order operations: routes requests (evidence: `services/order/cmd/server/main.go`)
- Order API → Order repository: constructs repository (evidence: `services/order/cmd/server/main.go`)
- Order operations → Order repository: manages orders (evidence: `services/order/internal/handler/order_handler.go`)
- Order repository → Order model: uses model (evidence: `services/order/internal/repository/order_repository.go`)
- Order repository → Order database: queries database
- Payment API → Payment operations: routes requests (evidence: `services/payment/cmd/server/main.go`)
- Payment API → Payment repository: constructs repository (evidence: `services/payment/cmd/server/main.go`)
- Payment operations → Payment repository: manages payments (evidence: `services/payment/internal/handler/payment_handler.go`)
- Payment repository → Payment model: uses model (evidence: `services/payment/internal/repository/payment_repository.go`)
- Payment repository → Payment database: queries database
