# arian-nmi/django-shop architecture

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

- Interactive diagram: https://gitdiagram.com/arian-nmi/django-shop
- Repository: https://github.com/arian-nmi/django-shop

## Overview

Django Shop is an e-commerce application. The primary customer journey is browsing the catalog, managing a cart, checking out into an order, and completing payment; customers can then review orders and manage their account, while staff manage catalog, orders, coupons, and reviews. The graph also includes the documented REST API and background email capability. Links are limited to relationships stated in the README or visible in sampled source and the source index; unsampled checkout, payment, and storefront wiring is not inferred.

Main entry points: [`core/shop/models.py`](https://github.com/arian-nmi/django-shop/blob/main/core/shop/models.py) (Products and wishlist), [`core/order/models.py`](https://github.com/arian-nmi/django-shop/blob/main/core/order/models.py) (Orders, coupons, addresses), [`core/order/views.py`](https://github.com/arian-nmi/django-shop/blob/main/core/order/views.py) (Checkout and orders), [`core/dashboard/customer/views.py`](https://github.com/arian-nmi/django-shop/blob/main/core/dashboard/customer/views.py) (Customer dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Storefront and catalog"]
  node_storefront["Storefront<br/>[views.py]"]
  node_products[("Products and wishlist<br/>[models.py]")]
  node_product_api["Product API<br/>[views.py]"]
end

subgraph group_commerce["Cart, checkout, payment"]
  node_cart["Cart<br/>[cart.py]"]
  node_cart_data[("Cart records<br/>[models.py]")]
  node_cart_api["Cart API<br/>[views.py]"]
  node_checkout["Checkout and orders<br/>[views.py]"]
  node_order_data[("Orders, coupons, addresses<br/>[models.py]")]
  node_payment_flow["Payment flow<br/>[views.py]"]
  node_zarinpal["Zarinpal client<br/>[zarinpal_client.py]"]
end

subgraph group_identity["Accounts and dashboards"]
  node_accounts[("Accounts and profiles<br/>[models.py]")]
  node_account_views["Authentication<br/>[views.py]"]
  node_customer_dashboard["Customer dashboard<br/>[views.py]"]
  node_admin_dashboard["Admin dashboard<br/>[views.py]"]
end

subgraph group_engagement["Reviews"]
  node_reviews[("Reviews and ratings<br/>[models.py]")]
  node_review_views["Review submission<br/>[views.py]"]
end

subgraph group_platform["API and background work"]
  node_api_auth["JWT and API routes<br/>[auth_urls.py]"]
  node_order_api["Order API<br/>[views.py]"]
  node_async_email["Order email task<br/>[tasks.py]"]
  node_celery["Celery configuration<br/>[celery.py]"]
end

node_customer(("Customer"))
node_staff(("Staff"))
node_database[("PostgreSQL")]
node_redis["Redis broker"]
node_gateway["Zarinpal sandbox"]
node_email_service["SMTP email"]

node_customer -->|"browses"| node_storefront
node_storefront -.->|"queries"| node_products
node_customer -->|"manages cart"| node_cart
node_cart -.->|"persists"| node_cart_data
node_customer -->|"checks out"| node_checkout
node_checkout -.->|"creates order"| node_order_data
node_checkout -.->|"validates cart"| node_cart
node_checkout -.->|"starts payment"| node_payment_flow
node_payment_flow -.->|"requests verification"| node_zarinpal
node_zarinpal -->|"calls gateway"| node_gateway
node_customer -.->|"authenticates"| node_account_views
node_account_views -.->|"uses accounts"| node_accounts
node_customer -->|"manages account"| node_customer_dashboard
node_customer_dashboard -->|"updates profile"| node_accounts
node_customer_dashboard -->|"reads orders"| node_order_data
node_customer_dashboard -->|"reads wishlist"| node_products
node_staff -->|"administers shop"| node_admin_dashboard
node_admin_dashboard -->|"manages products"| node_products
node_admin_dashboard -->|"manages orders"| node_order_data
node_admin_dashboard -->|"moderates reviews"| node_reviews
node_customer -->|"submits review"| node_review_views
node_review_views -->|"uses reviews"| node_reviews
node_review_views -->|"selects product"| node_products
node_customer -->|"requests products"| node_product_api
node_product_api -->|"queries"| node_products
node_customer -->|"uses cart API"| node_cart_api
node_cart_api -->|"reads and writes"| node_cart_data
node_cart_api -->|"validates products"| node_products
node_customer -->|"uses order API"| node_order_api
node_order_api -->|"uses order models"| node_order_data
node_customer -->|"gets JWT"| node_api_auth
node_order_data -->|"loads order details"| node_async_email
node_async_email -->|"sends email"| node_email_service
node_async_email -->|"runs as task"| node_celery
node_celery -->|"uses broker"| node_redis
node_products -.->|"stores catalog"| node_database
node_order_data -.->|"stores commerce data"| node_database
node_accounts -.->|"stores accounts"| node_database
node_cart_data -.->|"stores cart data"| node_database
node_reviews -.->|"stores reviews"| node_database

click node_storefront "https://github.com/arian-nmi/django-shop/blob/main/core/shop/views.py"
click node_products "https://github.com/arian-nmi/django-shop/blob/main/core/shop/models.py"
click node_product_api "https://github.com/arian-nmi/django-shop/blob/main/core/shop/api/views.py"
click node_cart "https://github.com/arian-nmi/django-shop/blob/main/core/cart/cart.py"
click node_cart_data "https://github.com/arian-nmi/django-shop/blob/main/core/cart/models.py"
click node_cart_api "https://github.com/arian-nmi/django-shop/blob/main/core/cart/api/views.py"
click node_checkout "https://github.com/arian-nmi/django-shop/blob/main/core/order/views.py"
click node_order_data "https://github.com/arian-nmi/django-shop/blob/main/core/order/models.py"
click node_payment_flow "https://github.com/arian-nmi/django-shop/blob/main/core/payment/views.py"
click node_zarinpal "https://github.com/arian-nmi/django-shop/blob/main/core/payment/zarinpal_client.py"
click node_accounts "https://github.com/arian-nmi/django-shop/blob/main/core/accounts/models.py"
click node_account_views "https://github.com/arian-nmi/django-shop/blob/main/core/accounts/views.py"
click node_customer_dashboard "https://github.com/arian-nmi/django-shop/blob/main/core/dashboard/customer/views.py"
click node_admin_dashboard "https://github.com/arian-nmi/django-shop/blob/main/core/dashboard/admin/views.py"
click node_reviews "https://github.com/arian-nmi/django-shop/blob/main/core/review/models.py"
click node_review_views "https://github.com/arian-nmi/django-shop/blob/main/core/review/views.py"
click node_api_auth "https://github.com/arian-nmi/django-shop/blob/main/core/api/auth_urls.py"
click node_order_api "https://github.com/arian-nmi/django-shop/blob/main/core/order/api/views.py"
click node_async_email "https://github.com/arian-nmi/django-shop/blob/main/core/order/tasks.py"
click node_celery "https://github.com/arian-nmi/django-shop/blob/main/core/core/celery.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_storefront,node_products,node_product_api toneBlue
class node_cart,node_cart_data,node_cart_api,node_checkout,node_order_data,node_payment_flow,node_zarinpal,node_database,node_redis toneAmber
class node_accounts,node_account_views,node_customer_dashboard,node_admin_dashboard toneMint
class node_reviews,node_review_views toneRose
class node_api_auth,node_order_api,node_async_email,node_celery,node_customer,node_staff,node_gateway,node_email_service toneIndigo
```

## Components

### Storefront and catalog

- [Storefront](https://github.com/arian-nmi/django-shop/blob/main/core/shop/views.py): `core/shop/views.py`
- [Products and wishlist](https://github.com/arian-nmi/django-shop/blob/main/core/shop/models.py): `core/shop/models.py`
- [Product API](https://github.com/arian-nmi/django-shop/blob/main/core/shop/api/views.py): `core/shop/api/views.py`

### Cart, checkout, payment

- [Cart](https://github.com/arian-nmi/django-shop/blob/main/core/cart/cart.py): `core/cart/cart.py`
- [Cart records](https://github.com/arian-nmi/django-shop/blob/main/core/cart/models.py): `core/cart/models.py`
- [Cart API](https://github.com/arian-nmi/django-shop/blob/main/core/cart/api/views.py): `core/cart/api/views.py`
- [Checkout and orders](https://github.com/arian-nmi/django-shop/blob/main/core/order/views.py): `core/order/views.py`
- [Orders, coupons, addresses](https://github.com/arian-nmi/django-shop/blob/main/core/order/models.py): `core/order/models.py`
- [Payment flow](https://github.com/arian-nmi/django-shop/blob/main/core/payment/views.py): `core/payment/views.py`
- [Zarinpal client](https://github.com/arian-nmi/django-shop/blob/main/core/payment/zarinpal_client.py): `core/payment/zarinpal_client.py`

### Accounts and dashboards

- [Accounts and profiles](https://github.com/arian-nmi/django-shop/blob/main/core/accounts/models.py): `core/accounts/models.py`
- [Authentication](https://github.com/arian-nmi/django-shop/blob/main/core/accounts/views.py): `core/accounts/views.py`
- [Customer dashboard](https://github.com/arian-nmi/django-shop/blob/main/core/dashboard/customer/views.py): `core/dashboard/customer/views.py`
- [Admin dashboard](https://github.com/arian-nmi/django-shop/blob/main/core/dashboard/admin/views.py): `core/dashboard/admin/views.py`

### Reviews

- [Reviews and ratings](https://github.com/arian-nmi/django-shop/blob/main/core/review/models.py): `core/review/models.py`
- [Review submission](https://github.com/arian-nmi/django-shop/blob/main/core/review/views.py): `core/review/views.py`

### API and background work

- [JWT and API routes](https://github.com/arian-nmi/django-shop/blob/main/core/api/auth_urls.py): `core/api/auth_urls.py`
- [Order API](https://github.com/arian-nmi/django-shop/blob/main/core/order/api/views.py): `core/order/api/views.py`
- [Order email task](https://github.com/arian-nmi/django-shop/blob/main/core/order/tasks.py): `core/order/tasks.py`
- [Celery configuration](https://github.com/arian-nmi/django-shop/blob/main/core/core/celery.py): `core/core/celery.py`

### Other components

- **Customer**
- **Staff**
- **PostgreSQL**
- **Redis broker**
- **Zarinpal sandbox**
- **SMTP email**

## Connections

- Customer → Storefront: browses
- Storefront → Products and wishlist: queries
- Customer → Cart: manages cart
- Cart → Cart records: persists
- Customer → Checkout and orders: checks out
- Checkout and orders → Orders, coupons, addresses: creates order
- Checkout and orders → Cart: validates cart
- Checkout and orders → Payment flow: starts payment
- Payment flow → Zarinpal client: requests verification
- Zarinpal client → Zarinpal sandbox: calls gateway
- Customer → Authentication: authenticates
- Authentication → Accounts and profiles: uses accounts
- Customer → Customer dashboard: manages account
- Customer dashboard → Accounts and profiles: updates profile (evidence: `core/dashboard/customer/views.py`)
- Customer dashboard → Orders, coupons, addresses: reads orders (evidence: `core/dashboard/customer/views.py`)
- Customer dashboard → Products and wishlist: reads wishlist (evidence: `core/dashboard/customer/views.py`)
- Staff → Admin dashboard: administers shop
- Admin dashboard → Products and wishlist: manages products (evidence: `core/dashboard/admin/views.py`)
- Admin dashboard → Orders, coupons, addresses: manages orders (evidence: `core/dashboard/admin/views.py`)
- Admin dashboard → Reviews and ratings: moderates reviews (evidence: `core/dashboard/admin/views.py`)
- Customer → Review submission: submits review
- Review submission → Reviews and ratings: uses reviews (evidence: `core/review/views.py`)
- Review submission → Products and wishlist: selects product (evidence: `core/review/views.py`)
- Customer → Product API: requests products
- Product API → Products and wishlist: queries (evidence: `core/shop/api/views.py`)
- Customer → Cart API: uses cart API
- Cart API → Cart records: reads and writes (evidence: `core/cart/api/views.py`)
- Cart API → Products and wishlist: validates products (evidence: `core/cart/api/views.py`)
- Customer → Order API: uses order API
- Order API → Orders, coupons, addresses: uses order models
- Customer → JWT and API routes: gets JWT
- Orders, coupons, addresses → Order email task: loads order details (evidence: `core/order/tasks.py`)
- Order email task → SMTP email: sends email (evidence: `core/order/tasks.py`)
- Order email task → Celery configuration: runs as task (evidence: `core/order/tasks.py`)
- Celery configuration → Redis broker: uses broker
- Products and wishlist → PostgreSQL: stores catalog
- Orders, coupons, addresses → PostgreSQL: stores commerce data
- Accounts and profiles → PostgreSQL: stores accounts
- Cart records → PostgreSQL: stores cart data
- Reviews and ratings → PostgreSQL: stores reviews
