# architmahajann/e-commerce architecture

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

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

## Overview

ClickMart is a Django REST e-commerce backend with a React storefront. The main shopper flow is account/JWT access, active catalog browsing, authenticated cart changes, then checkout that snapshots prices, validates and reduces stock, clears the cart, and queues an email notification. The graph separates those domain stages from persistence, API routing, and asynchronous notification. Checkout internals and URL wiring were not excerpted, so those links rely on README documentation; the shown task implementation confirms notification loading and dispatch to its mail utility.

Main entry points: [`api/urls.py`](https://github.com/architmahajann/e-commerce/blob/main/api/urls.py) (Versioned API router), [`orders/views.py`](https://github.com/architmahajann/e-commerce/blob/main/orders/views.py) (Checkout and order history), [`products/models.py`](https://github.com/architmahajann/e-commerce/blob/main/products/models.py) (Product data and inventory), [`carts/views.py`](https://github.com/architmahajann/e-commerce/blob/main/carts/views.py) (Cart management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Storefront"]
  node_frontend["React storefront<br/>[main.jsx]"]
  node_client_api["Frontend API client<br/>[api.js]"]
end

subgraph group_entry["API and identity"]
  node_router["Versioned API router<br/>[urls.py]"]
  node_identity["Accounts and JWT<br/>[views.py]"]
  node_user_serializers["User serializers<br/>[serializers.py]"]
end

subgraph group_commerce["Shopping domains"]
  node_catalog["Product catalog<br/>[views.py]"]
  node_product_data["Product data and inventory<br/>[models.py]"]
  node_product_serializers["Product serializers<br/>[serializers.py]"]
  node_cart_api["Cart management<br/>[views.py]"]
  node_cart_data["Cart models<br/>[models.py]"]
  node_cart_serializers["Cart serializers<br/>[serializers.py]"]
  node_checkout["Checkout and order history<br/>[views.py]"]
  node_order_data["Order snapshots<br/>[models.py]"]
end

subgraph group_async["Notifications"]
  node_order_tasks["Notification task<br/>[tasks.py]"]
  node_mail["Order email utility<br/>[utils.py]"]
  node_queue["Celery broker"]
  node_smtp["SMTP service"]
end

subgraph group_state["Persistence"]
  node_database[("Application database")]
  node_media[("Product media storage")]
end

node_shopper(("Shopper"))

node_shopper -->|"shops through"| node_frontend
node_frontend -.->|"uses"| node_client_api
node_client_api -->|"sends JSON and JWT"| node_router
node_router -->|"routes account requests"| node_identity
node_router -->|"routes catalog requests"| node_catalog
node_router -->|"routes cart requests"| node_cart_api
node_router -->|"routes order requests"| node_checkout
node_identity -->|"serializes accounts"| node_user_serializers
node_identity -->|"persists users"| node_database
node_catalog -->|"serializes products"| node_product_serializers
node_catalog -->|"reads active products"| node_product_data
node_product_data -->|"stores inventory"| node_database
node_product_data -->|"stores images"| node_media
node_cart_api -->|"serializes carts"| node_cart_serializers
node_cart_api -->|"reads and updates"| node_cart_data
node_cart_api -->|"checks stock"| node_product_data
node_cart_data -->|"stores cart state"| node_database
node_checkout -->|"checks and clears cart"| node_cart_data
node_checkout -->|"validates and reduces stock"| node_product_data
node_checkout -->|"creates order snapshot"| node_order_data
node_checkout -->|"queues notification"| node_order_tasks
node_order_data -->|"stores orders"| node_database
node_order_tasks -->|"loads order"| node_order_data
node_order_tasks -->|"calls mail utility"| node_mail
node_order_tasks -->|"runs as Celery task"| node_queue
node_mail -->|"sends notification"| node_smtp
node_queue -->|"delivers email task"| node_smtp

click node_frontend "https://github.com/architmahajann/e-commerce/blob/main/frontend/src/main.jsx"
click node_client_api "https://github.com/architmahajann/e-commerce/blob/main/frontend/src/api.js"
click node_router "https://github.com/architmahajann/e-commerce/blob/main/api/urls.py"
click node_identity "https://github.com/architmahajann/e-commerce/blob/main/users/views.py"
click node_user_serializers "https://github.com/architmahajann/e-commerce/blob/main/users/serializers.py"
click node_catalog "https://github.com/architmahajann/e-commerce/blob/main/products/views.py"
click node_product_data "https://github.com/architmahajann/e-commerce/blob/main/products/models.py"
click node_product_serializers "https://github.com/architmahajann/e-commerce/blob/main/products/serializers.py"
click node_cart_api "https://github.com/architmahajann/e-commerce/blob/main/carts/views.py"
click node_cart_data "https://github.com/architmahajann/e-commerce/blob/main/carts/models.py"
click node_cart_serializers "https://github.com/architmahajann/e-commerce/blob/main/carts/serializers.py"
click node_checkout "https://github.com/architmahajann/e-commerce/blob/main/orders/views.py"
click node_order_data "https://github.com/architmahajann/e-commerce/blob/main/orders/models.py"
click node_order_tasks "https://github.com/architmahajann/e-commerce/blob/main/orders/tasks.py"
click node_mail "https://github.com/architmahajann/e-commerce/blob/main/orders/utils.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_frontend,node_client_api toneBlue
class node_router,node_identity,node_user_serializers toneAmber
class node_catalog,node_product_data,node_product_serializers,node_cart_api,node_cart_data,node_cart_serializers,node_checkout,node_order_data toneMint
class node_order_tasks,node_mail,node_queue,node_smtp toneRose
class node_database,node_media,node_shopper toneIndigo
```

## Components

### Storefront

- [React storefront](https://github.com/architmahajann/e-commerce/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Frontend API client](https://github.com/architmahajann/e-commerce/blob/main/frontend/src/api.js): `frontend/src/api.js`

### API and identity

- [Versioned API router](https://github.com/architmahajann/e-commerce/blob/main/api/urls.py): `api/urls.py`
- [Accounts and JWT](https://github.com/architmahajann/e-commerce/blob/main/users/views.py): `users/views.py`
- [User serializers](https://github.com/architmahajann/e-commerce/blob/main/users/serializers.py): `users/serializers.py`

### Shopping domains

- [Product catalog](https://github.com/architmahajann/e-commerce/blob/main/products/views.py): `products/views.py`
- [Product data and inventory](https://github.com/architmahajann/e-commerce/blob/main/products/models.py): `products/models.py`
- [Product serializers](https://github.com/architmahajann/e-commerce/blob/main/products/serializers.py): `products/serializers.py`
- [Cart management](https://github.com/architmahajann/e-commerce/blob/main/carts/views.py): `carts/views.py`
- [Cart models](https://github.com/architmahajann/e-commerce/blob/main/carts/models.py): `carts/models.py`
- [Cart serializers](https://github.com/architmahajann/e-commerce/blob/main/carts/serializers.py): `carts/serializers.py`
- [Checkout and order history](https://github.com/architmahajann/e-commerce/blob/main/orders/views.py): `orders/views.py`
- [Order snapshots](https://github.com/architmahajann/e-commerce/blob/main/orders/models.py): `orders/models.py`

### Notifications

- [Notification task](https://github.com/architmahajann/e-commerce/blob/main/orders/tasks.py): `orders/tasks.py`
- [Order email utility](https://github.com/architmahajann/e-commerce/blob/main/orders/utils.py): `orders/utils.py`
- **Celery broker**
- **SMTP service**

### Persistence

- **Application database**
- **Product media storage**

### Other components

- **Shopper**

## Connections

- Shopper → React storefront: shops through (evidence: `README.md`)
- React storefront → Frontend API client: uses
- Frontend API client → Versioned API router: sends JSON and JWT (evidence: `README.md`)
- Versioned API router → Accounts and JWT: routes account requests (evidence: `README.md`)
- Versioned API router → Product catalog: routes catalog requests (evidence: `README.md`)
- Versioned API router → Cart management: routes cart requests (evidence: `README.md`)
- Versioned API router → Checkout and order history: routes order requests (evidence: `README.md`)
- Accounts and JWT → User serializers: serializes accounts (evidence: `users/views.py`)
- Accounts and JWT → Application database: persists users (evidence: `README.md`)
- Product catalog → Product serializers: serializes products (evidence: `products/views.py`)
- Product catalog → Product data and inventory: reads active products (evidence: `products/views.py`)
- Product data and inventory → Application database: stores inventory (evidence: `README.md`)
- Product data and inventory → Product media storage: stores images (evidence: `README.md`)
- Cart management → Cart serializers: serializes carts (evidence: `carts/views.py`)
- Cart management → Cart models: reads and updates (evidence: `carts/views.py`)
- Cart management → Product data and inventory: checks stock (evidence: `carts/views.py`)
- Cart models → Application database: stores cart state (evidence: `README.md`)
- Checkout and order history → Cart models: checks and clears cart (evidence: `README.md`)
- Checkout and order history → Product data and inventory: validates and reduces stock (evidence: `README.md`)
- Checkout and order history → Order snapshots: creates order snapshot (evidence: `README.md`)
- Checkout and order history → Notification task: queues notification (evidence: `README.md`)
- Order snapshots → Application database: stores orders (evidence: `README.md`)
- Notification task → Order snapshots: loads order (evidence: `orders/tasks.py`)
- Notification task → Order email utility: calls mail utility (evidence: `orders/tasks.py`)
- Notification task → Celery broker: runs as Celery task (evidence: `orders/tasks.py`)
- Order email utility → SMTP service: sends notification (evidence: `README.md`)
- Celery broker → SMTP service: delivers email task (evidence: `README.md`)
