# krystalsoftwarebangladesh/ecommerce-backend architecture

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

- Interactive diagram: https://gitdiagram.com/krystalsoftwarebangladesh/ecommerce-backend
- Repository: https://github.com/krystalsoftwarebangladesh/ecommerce-backend

## Overview

This is a Django e-commerce backend with storefront and management APIs. The principal checkout flow accepts a cart, validates customer and shipping data, calculates totals, and creates an order while coordinating inventory reservations, sales, shipping, and email. The repository also contains catalog, customer, content, and accounting domains. Edges are limited to relationships visible in the supplied source index or excerpts; unsampled API wiring and subsystem internals are not inferred.

Main entry points: [`checkout_api/services.py`](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/checkout_api/services.py) (Checkout Service), [`sale_api/services.py`](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/sale_api/services.py) (Sales Service), [`inventory_api/services/reservation.py`](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/inventory_api/services/reservation.py) (Reservation Service), [`transaction_api/services.py`](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/transaction_api/services.py) (Transactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commerce["Storefront Commerce"]
  node_checkout["Checkout Service<br/>[services.py]"]
  node_checkout_api["Checkout API<br/>[checkout.py]"]
  node_cart["Cart Service<br/>[cart.py]"]
  node_cart_store[("Cart Records<br/>[cart.py]")]
  node_customer[("Customer Profiles<br/>[customer.py]")]
  node_shipping["Shipping Service<br/>[shipping.py]"]
  node_sales["Sales Service<br/>[services.py]"]
  node_sales_store[("Sales Records<br/>[sale.py]")]
end

subgraph group_catalog["Catalog and Content"]
  node_products[("Product Catalog<br/>[product.py]")]
  node_categories["Categories<br/>[category.py]"]
  node_brands[("Brands<br/>[brand.py]")]
  node_blog["Blog Content<br/>[blog_post.py]"]
  node_reviews["Product Reviews<br/>[review.py]"]
  node_content_security["Content Scanning<br/>[scanner.py]"]
end

subgraph group_operations["Commerce Operations"]
  node_inventory["Reservation Service<br/>[reservation.py]"]
  node_inventory_store[("Inventory Records<br/>[inventory.py]")]
  node_purchases["Purchasing<br/>[services.py]"]
end

subgraph group_finance["Accounting"]
  node_accounts[("Chart of Accounts")]
  node_transactions["Transactions<br/>[services.py]"]
  node_transaction_store[("Accounting Records<br/>[transaction.py]")]
end

subgraph group_platform["Platform Services"]
  node_email["Email Service<br/>[email.py]"]
  node_email_tasks["Email Tasks<br/>[tasks.py]"]
  node_request_logs["Request Log Storage<br/>[storage.py]"]
end

node_client(("API Client"))

node_client -->|"calls API"| node_checkout_api
node_checkout_api -.->|"delegates"| node_checkout
node_checkout -->|"locks cart"| node_cart_store
node_checkout -->|"uses cart logic"| node_cart
node_checkout -->|"reads customer"| node_customer
node_checkout -->|"gets rates"| node_shipping
node_checkout -->|"reserves stock"| node_inventory
node_checkout -->|"creates sale"| node_sales
node_checkout -->|"queues email"| node_email
node_cart -->|"reads and writes"| node_cart_store
node_inventory -->|"uses records"| node_inventory_store
node_inventory -->|"references products"| node_products
node_sales -->|"uses accounts"| node_accounts
node_sales -->|"posts entries"| node_transactions
node_sales -->|"uses reservations"| node_inventory
node_sales -->|"creates sales"| node_sales_store
node_purchases -->|"uses accounts"| node_accounts
node_purchases -->|"records movements"| node_inventory_store
node_purchases -->|"posts entries"| node_transactions
node_transactions -->|"creates entries"| node_transaction_store
node_accounts -->|"creates entries"| node_transactions
node_email -->|"dispatches tasks"| node_email_tasks
node_reviews -->|"reviews products"| node_products

click node_checkout "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/checkout_api/services.py"
click node_checkout_api "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/checkout_api/views/v1/checkout.py"
click node_cart "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/cart_api/services/cart.py"
click node_cart_store "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/cart_api/models/cart.py"
click node_customer "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/customer_api/models/customer.py"
click node_shipping "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/shipping_api/services/shipping.py"
click node_inventory "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/inventory_api/services/reservation.py"
click node_inventory_store "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/inventory_api/models/inventory.py"
click node_sales "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/sale_api/services.py"
click node_sales_store "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/sale_api/models/sale.py"
click node_products "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/product_api/models/product.py"
click node_categories "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/category_api/services/category.py"
click node_brands "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/product_api/models/brand.py"
click node_blog "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/blog_api/services/blog_post.py"
click node_reviews "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/review_api/services/review.py"
click node_content_security "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/content_security_api/services/scanner.py"
click node_purchases "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/purchase_api/services.py"
click node_accounts "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/account_api/models/chart_of_account.py"
click node_transactions "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/transaction_api/services.py"
click node_transaction_store "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/transaction_api/models/transaction.py"
click node_email "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/email_api/services/email.py"
click node_email_tasks "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/email_api/tasks.py"
click node_request_logs "https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/request_log_api/services/storage.py"

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,node_checkout_api,node_cart,node_cart_store,node_customer,node_shipping,node_sales,node_sales_store,node_client toneBlue
class node_products,node_categories,node_brands,node_blog,node_reviews,node_content_security toneAmber
class node_inventory,node_inventory_store,node_purchases toneMint
class node_accounts,node_transactions,node_transaction_store toneRose
class node_email,node_email_tasks,node_request_logs toneIndigo
```

## Components

### Storefront Commerce

- [Checkout Service](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/checkout_api/services.py): `checkout_api/services.py`
- [Checkout API](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/checkout_api/views/v1/checkout.py): `checkout_api/views/v1/checkout.py`
- [Cart Service](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/cart_api/services/cart.py): `cart_api/services/cart.py`
- [Cart Records](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/cart_api/models/cart.py): `cart_api/models/cart.py`
- [Customer Profiles](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/customer_api/models/customer.py): `customer_api/models/customer.py`
- [Shipping Service](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/shipping_api/services/shipping.py): `shipping_api/services/shipping.py`
- [Sales Service](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/sale_api/services.py): `sale_api/services.py`
- [Sales Records](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/sale_api/models/sale.py): `sale_api/models/sale.py`

### Catalog and Content

- [Product Catalog](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/product_api/models/product.py): `product_api/models/product.py`
- [Categories](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/category_api/services/category.py): `category_api/services/category.py`
- [Brands](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/product_api/models/brand.py): `product_api/models/brand.py`
- [Blog Content](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/blog_api/services/blog_post.py): `blog_api/services/blog_post.py`
- [Product Reviews](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/review_api/services/review.py): `review_api/services/review.py`
- [Content Scanning](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/content_security_api/services/scanner.py): `content_security_api/services/scanner.py`

### Commerce Operations

- [Reservation Service](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/inventory_api/services/reservation.py): `inventory_api/services/reservation.py`
- [Inventory Records](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/inventory_api/models/inventory.py): `inventory_api/models/inventory.py`
- [Purchasing](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/purchase_api/services.py): `purchase_api/services.py`

### Accounting

- [Chart of Accounts](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/account_api/models/chart_of_account.py): `account_api/models/chart_of_account.py`
- [Transactions](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/transaction_api/services.py): `transaction_api/services.py`
- [Accounting Records](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/transaction_api/models/transaction.py): `transaction_api/models/transaction.py`

### Platform Services

- [Email Service](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/email_api/services/email.py): `email_api/services/email.py`
- [Email Tasks](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/email_api/tasks.py): `email_api/tasks.py`
- [Request Log Storage](https://github.com/krystalsoftwarebangladesh/ecommerce-backend/blob/dev/request_log_api/services/storage.py): `request_log_api/services/storage.py`

### Other components

- **API Client**

## Connections

- API Client → Checkout API: calls API (evidence: `README.md`)
- Checkout API → Checkout Service: delegates
- Checkout Service → Cart Records: locks cart (evidence: `checkout_api/services.py`)
- Checkout Service → Cart Service: uses cart logic (evidence: `checkout_api/services.py`)
- Checkout Service → Customer Profiles: reads customer (evidence: `checkout_api/services.py`)
- Checkout Service → Shipping Service: gets rates (evidence: `checkout_api/services.py`)
- Checkout Service → Reservation Service: reserves stock (evidence: `checkout_api/services.py`)
- Checkout Service → Sales Service: creates sale (evidence: `checkout_api/services.py`)
- Checkout Service → Email Service: queues email (evidence: `checkout_api/services.py`)
- Cart Service → Cart Records: reads and writes (evidence: `cart_api/services/cart.py`)
- Reservation Service → Inventory Records: uses records (evidence: `inventory_api/services/reservation.py`)
- Reservation Service → Product Catalog: references products (evidence: `inventory_api/services/reservation.py`)
- Sales Service → Chart of Accounts: uses accounts (evidence: `sale_api/services.py`)
- Sales Service → Transactions: posts entries (evidence: `sale_api/services.py`)
- Sales Service → Reservation Service: uses reservations (evidence: `sale_api/services.py`)
- Sales Service → Sales Records: creates sales (evidence: `sale_api/services.py`)
- Purchasing → Chart of Accounts: uses accounts (evidence: `purchase_api/services.py`)
- Purchasing → Inventory Records: records movements (evidence: `purchase_api/services.py`)
- Purchasing → Transactions: posts entries (evidence: `purchase_api/services.py`)
- Transactions → Accounting Records: creates entries (evidence: `transaction_api/services.py`)
- Chart of Accounts → Transactions: creates entries
- Email Service → Email Tasks: dispatches tasks (evidence: `email_api/tasks.py`)
- Product Reviews → Product Catalog: reviews products
