# boredompeaks/perfume-store-backend architecture

> Architecture diagram of the GitHub repository boredompeaks/perfume-store-backend, 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/boredompeaks/perfume-store-backend
- Repository: https://github.com/boredompeaks/perfume-store-backend

## Overview

Perfume Store is an e-commerce product with a Next.js storefront and an independently deployable Django/DRF API. The customer journey spans account access, product discovery, cart, checkout/payment, and order follow-up; the backend also covers inventory, shipping, returns, and operations. Source excerpts and the README support the backend domain links shown. Some frontend-to-API wiring and unsampled subsystem internals are not visible here, so those connections are omitted or marked unverified.

Main entry points: [`backend/orders/views/checkout.py`](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/views/checkout.py) (Checkout), [`frontend/src/app/page.tsx`](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/app/page.tsx) (Storefront), [`backend/products/models.py`](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/products/models.py) (Catalog and stock), [`backend/orders/models.py`](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/models.py) (Orders and returns)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_web["Storefront<br/>[page.tsx]"]
  node_account_ui["Account flows<br/>[LoginForm.tsx]"]
  node_catalog_ui["Product browsing<br/>[page.tsx]"]
  node_cart_ui["Cart and checkout<br/>[CheckoutView.tsx]"]
  node_orders_ui["Order views<br/>[OrdersListView.tsx]"]
end

subgraph group_commerce["Commerce API"]
  node_accounts["Accounts API<br/>[views.py]"]
  node_products["Catalog and stock<br/>[models.py]"]
  node_cart["Session cart<br/>[models.py]"]
  node_checkout["Checkout<br/>[checkout.py]"]
  node_orders[("Orders and returns<br/>[models.py]")]
  node_payment["Payment webhooks<br/>[webhooks.py]"]
  node_inventory["Inventory workflow<br/>[inventory.py]"]
  node_shipping["Shipping pricing<br/>[pricing.py]"]
  node_order_state["Order state machine<br/>[state.py]"]
end

subgraph group_shared["Shared Services"]
  node_audit[("Business audit<br/>[models.py]")]
  node_notifications["Notifications<br/>[notifications.py]"]
  node_money["Money rules<br/>[money.py]"]
end

subgraph group_operations["Operations"]
  node_ops["Operations dashboard<br/>[services.py]"]
  node_alerts["Stock alerts<br/>[alerts.py]"]
  node_celery["Async sweeps<br/>[tasks.py]"]
end

node_customer(("Customer"))
node_razorpay{{"Razorpay"}}
node_email{{"Email service"}}

node_customer -->|"browses"| node_web
node_web -->|"opens account"| node_account_ui
node_web -->|"browses products"| node_catalog_ui
node_web -->|"shops"| node_cart_ui
node_web -->|"tracks orders"| node_orders_ui
node_account_ui -.->|"uses API"| node_accounts
node_catalog_ui -.->|"uses API"| node_products
node_cart_ui -.->|"uses API"| node_cart
node_cart_ui -.->|"submits checkout"| node_checkout
node_orders_ui -.->|"uses API"| node_orders
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"reads products"| node_products
node_checkout -->|"prices shipping"| node_shipping
node_checkout -->|"creates order"| node_orders
node_checkout -->|"quantizes amounts"| node_money
node_orders -->|"uses transitions"| node_order_state
node_payment -->|"updates payment"| node_orders
node_payment -->|"checks stock"| node_inventory
node_payment -->|"receives callbacks"| node_razorpay
node_accounts -->|"sends email"| node_notifications
node_notifications -->|"delivers messages"| node_email
node_products -->|"sends restock email"| node_notifications
node_ops -->|"counts stock"| node_products
node_ops -->|"dispatches alerts"| node_alerts
node_celery -.->|"drains outbox"| node_notifications
node_inventory -->|"updates stock"| node_products

click node_web "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/app/page.tsx"
click node_account_ui "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/components/auth/LoginForm.tsx"
click node_catalog_ui "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/app/products/page.tsx"
click node_cart_ui "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/components/checkout/CheckoutView.tsx"
click node_orders_ui "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/components/orders/OrdersListView.tsx"
click node_accounts "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/accounts/views.py"
click node_products "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/products/models.py"
click node_cart "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/cart/models.py"
click node_checkout "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/views/checkout.py"
click node_orders "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/models.py"
click node_payment "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/webhooks.py"
click node_inventory "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/inventory.py"
click node_shipping "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/shipping/pricing.py"
click node_order_state "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/state.py"
click node_audit "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/models.py"
click node_notifications "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/notifications.py"
click node_money "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/money.py"
click node_ops "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/ops/services.py"
click node_alerts "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/ops/alerts.py"
click node_celery "https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/tasks.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_web,node_account_ui,node_catalog_ui,node_cart_ui,node_orders_ui toneBlue
class node_accounts,node_products,node_cart,node_checkout,node_orders,node_payment,node_inventory,node_shipping,node_order_state toneAmber
class node_audit,node_notifications,node_money toneMint
class node_ops,node_alerts,node_celery toneRose
class node_customer,node_razorpay,node_email toneIndigo
```

## Components

### Storefront

- [Storefront](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Account flows](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/components/auth/LoginForm.tsx): `frontend/src/components/auth/LoginForm.tsx`
- [Product browsing](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/app/products/page.tsx): `frontend/src/app/products/page.tsx`
- [Cart and checkout](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/components/checkout/CheckoutView.tsx): `frontend/src/components/checkout/CheckoutView.tsx`
- [Order views](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/frontend/src/components/orders/OrdersListView.tsx): `frontend/src/components/orders/OrdersListView.tsx`

### Commerce API

- [Accounts API](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/accounts/views.py): `backend/accounts/views.py`
- [Catalog and stock](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/products/models.py): `backend/products/models.py`
- [Session cart](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/cart/models.py): `backend/cart/models.py`
- [Checkout](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/views/checkout.py): `backend/orders/views/checkout.py`
- [Orders and returns](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/models.py): `backend/orders/models.py`
- [Payment webhooks](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/webhooks.py): `backend/orders/webhooks.py`
- [Inventory workflow](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/inventory.py): `backend/orders/inventory.py`
- [Shipping pricing](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/shipping/pricing.py): `backend/shipping/pricing.py`
- [Order state machine](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/orders/state.py): `backend/orders/state.py`

### Shared Services

- [Business audit](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/models.py): `backend/common/models.py`
- [Notifications](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/notifications.py): `backend/common/notifications.py`
- [Money rules](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/money.py): `backend/common/money.py`

### Operations

- [Operations dashboard](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/ops/services.py): `backend/ops/services.py`
- [Stock alerts](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/ops/alerts.py): `backend/ops/alerts.py`
- [Async sweeps](https://github.com/boredompeaks/perfume-store-backend/blob/feat/add-frontend/backend/common/tasks.py): `backend/common/tasks.py`

### Other components

- **Customer**
- **Razorpay**
- **Email service**

## Connections

- Customer → Storefront: browses (evidence: `README.md`)
- Storefront → Account flows: opens account (evidence: `README.md`)
- Storefront → Product browsing: browses products (evidence: `README.md`)
- Storefront → Cart and checkout: shops (evidence: `README.md`)
- Storefront → Order views: tracks orders (evidence: `README.md`)
- Account flows → Accounts API: uses API
- Product browsing → Catalog and stock: uses API
- Cart and checkout → Session cart: uses API
- Cart and checkout → Checkout: submits checkout
- Order views → Orders and returns: uses API
- Checkout → Session cart: reads cart (evidence: `backend/orders/views/checkout.py`)
- Checkout → Catalog and stock: reads products (evidence: `backend/orders/views/checkout.py`)
- Checkout → Shipping pricing: prices shipping (evidence: `backend/orders/views/checkout.py`)
- Checkout → Orders and returns: creates order (evidence: `backend/orders/views/checkout.py`)
- Checkout → Money rules: quantizes amounts (evidence: `backend/orders/views/checkout.py`)
- Orders and returns → Order state machine: uses transitions (evidence: `backend/orders/models.py`)
- Payment webhooks → Orders and returns: updates payment (evidence: `backend/orders/webhooks.py`)
- Payment webhooks → Inventory workflow: checks stock (evidence: `backend/orders/webhooks.py`)
- Payment webhooks → Razorpay: receives callbacks (evidence: `backend/orders/webhooks.py`)
- Accounts API → Notifications: sends email (evidence: `backend/accounts/views.py`)
- Notifications → Email service: delivers messages (evidence: `backend/common/notifications.py`)
- Catalog and stock → Notifications: sends restock email (evidence: `backend/products/models.py`)
- Operations dashboard → Catalog and stock: counts stock (evidence: `backend/ops/services.py`)
- Operations dashboard → Stock alerts: dispatches alerts (evidence: `backend/ops/services.py`)
- Async sweeps → Notifications: drains outbox (evidence: `README.md`)
- Inventory workflow → Catalog and stock: updates stock (evidence: `backend/orders/inventory.py`)
