# jaswanthroyg/shophub architecture

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

- Interactive diagram: https://gitdiagram.com/jaswanthroyg/shophub
- Repository: https://github.com/jaswanthroyg/shophub

## Overview

ShopHub is a Django REST e-commerce backend. Customers authenticate, discover products, manage a cart, wishlist and addresses, then check out; payment verification confirms the order, updates inventory and clears the cart. Administrators manage catalog data and order status. The graph includes the documented product branches and the checkout/payment flow. Source excerpts and the SOURCE INDEX support the implementation links; broader platform and database relationships are based on the README, since configuration and several route files were not excerpted.

Main entry points: [`orders/views.py`](https://github.com/jaswanthroyg/shophub/blob/main/orders/views.py) (Order API), [`payments/views.py`](https://github.com/jaswanthroyg/shophub/blob/main/payments/views.py) (Payment verification), [`products/views.py`](https://github.com/jaswanthroyg/shophub/blob/main/products/views.py) (Product API), [`products/models.py`](https://github.com/jaswanthroyg/shophub/blob/main/products/models.py) (Products)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Accounts and access"]
  node_accounts_api["Authentication API<br/>[views.py]"]
  node_accounts_data["User accounts<br/>[serializers.py]"]
end

subgraph group_catalog["Product catalog"]
  node_products_api["Product API<br/>[views.py]"]
  node_products_data[("Products<br/>[models.py]")]
  node_categories_api["Category API<br/>[views.py]"]
  node_categories_data[("Categories<br/>[models.py]")]
end

subgraph group_customer["Customer resources"]
  node_cart_api["Cart API<br/>[views.py]"]
  node_cart_data[("Cart items<br/>[models.py]")]
  node_wishlist_api["Wishlist API<br/>[views.py]"]
  node_wishlist_data[("Wishlist items<br/>[models.py]")]
  node_addresses_api["Address API<br/>[views.py]"]
  node_addresses_data[("Addresses<br/>[models.py]")]
end

subgraph group_commerce["Orders and payments"]
  node_orders_api["Order API<br/>[views.py]"]
  node_orders_data[("Orders and items<br/>[models.py]")]
  node_payments_api["Payment verification<br/>[views.py]"]
  node_payments_data[("Payment records<br/>[models.py]")]
end

node_customer_actor(("Customer"))
node_admin_actor(("Administrator"))
node_api["REST API"]
node_razorpay["Razorpay"]
node_postgres[("PostgreSQL")]

node_customer_actor -->|"uses APIs"| node_api
node_admin_actor -->|"uses APIs"| node_api
node_api -->|"routes requests"| node_accounts_api
node_accounts_api -->|"validates accounts"| node_accounts_data
node_api -->|"routes requests"| node_products_api
node_products_api -->|"queries products"| node_products_data
node_products_api -.->|"filters categories"| node_categories_data
node_products_api -->|"serializes results"| node_products_data
node_products_api -->|"paginates results"| node_products_data
node_api -->|"routes requests"| node_categories_api
node_categories_api -->|"queries categories"| node_categories_data
node_api -->|"routes requests"| node_cart_api
node_cart_api -->|"manages items"| node_cart_data
node_cart_api -->|"looks up products"| node_products_data
node_api -->|"routes requests"| node_wishlist_api
node_wishlist_api -->|"manages items"| node_wishlist_data
node_api -->|"routes requests"| node_addresses_api
node_addresses_api -->|"manages addresses"| node_addresses_data
node_api -->|"routes requests"| node_orders_api
node_orders_api -->|"reads checkout address"| node_addresses_data
node_orders_api -->|"reads checkout cart"| node_cart_data
node_orders_api -->|"creates order"| node_orders_data
node_orders_api -->|"creates pending payment"| node_payments_data
node_orders_api -->|"creates gateway order"| node_razorpay
node_api -->|"routes verification"| node_payments_api
node_payments_api -->|"verifies signature"| node_razorpay
node_payments_api -->|"updates payment"| node_payments_data
node_payments_api -->|"confirms order"| node_orders_data
node_payments_api -->|"reduces stock"| node_products_data
node_payments_api -->|"clears cart"| node_cart_data
node_api -->|"persists data"| node_postgres

click node_accounts_api "https://github.com/jaswanthroyg/shophub/blob/main/accounts/views.py"
click node_accounts_data "https://github.com/jaswanthroyg/shophub/blob/main/accounts/serializers.py"
click node_products_api "https://github.com/jaswanthroyg/shophub/blob/main/products/views.py"
click node_products_data "https://github.com/jaswanthroyg/shophub/blob/main/products/models.py"
click node_categories_api "https://github.com/jaswanthroyg/shophub/blob/main/categories/views.py"
click node_categories_data "https://github.com/jaswanthroyg/shophub/blob/main/categories/models.py"
click node_cart_api "https://github.com/jaswanthroyg/shophub/blob/main/cart/views.py"
click node_cart_data "https://github.com/jaswanthroyg/shophub/blob/main/cart/models.py"
click node_wishlist_api "https://github.com/jaswanthroyg/shophub/blob/main/wishlist/views.py"
click node_wishlist_data "https://github.com/jaswanthroyg/shophub/blob/main/wishlist/models.py"
click node_addresses_api "https://github.com/jaswanthroyg/shophub/blob/main/addresses/views.py"
click node_addresses_data "https://github.com/jaswanthroyg/shophub/blob/main/addresses/models.py"
click node_orders_api "https://github.com/jaswanthroyg/shophub/blob/main/orders/views.py"
click node_orders_data "https://github.com/jaswanthroyg/shophub/blob/main/orders/models.py"
click node_payments_api "https://github.com/jaswanthroyg/shophub/blob/main/payments/views.py"
click node_payments_data "https://github.com/jaswanthroyg/shophub/blob/main/payments/models.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_accounts_api,node_accounts_data toneBlue
class node_products_api,node_products_data,node_categories_api,node_categories_data,node_postgres toneAmber
class node_cart_api,node_cart_data,node_wishlist_api,node_wishlist_data,node_addresses_api,node_addresses_data,node_api toneMint
class node_orders_api,node_orders_data,node_payments_api,node_payments_data toneRose
class node_customer_actor,node_admin_actor,node_razorpay toneIndigo
```

## Components

### Accounts and access

- [Authentication API](https://github.com/jaswanthroyg/shophub/blob/main/accounts/views.py): `accounts/views.py`
- [User accounts](https://github.com/jaswanthroyg/shophub/blob/main/accounts/serializers.py): `accounts/serializers.py`

### Product catalog

- [Product API](https://github.com/jaswanthroyg/shophub/blob/main/products/views.py): `products/views.py`
- [Products](https://github.com/jaswanthroyg/shophub/blob/main/products/models.py): `products/models.py`
- [Category API](https://github.com/jaswanthroyg/shophub/blob/main/categories/views.py): `categories/views.py`
- [Categories](https://github.com/jaswanthroyg/shophub/blob/main/categories/models.py): `categories/models.py`

### Customer resources

- [Cart API](https://github.com/jaswanthroyg/shophub/blob/main/cart/views.py): `cart/views.py`
- [Cart items](https://github.com/jaswanthroyg/shophub/blob/main/cart/models.py): `cart/models.py`
- [Wishlist API](https://github.com/jaswanthroyg/shophub/blob/main/wishlist/views.py): `wishlist/views.py`
- [Wishlist items](https://github.com/jaswanthroyg/shophub/blob/main/wishlist/models.py): `wishlist/models.py`
- [Address API](https://github.com/jaswanthroyg/shophub/blob/main/addresses/views.py): `addresses/views.py`
- [Addresses](https://github.com/jaswanthroyg/shophub/blob/main/addresses/models.py): `addresses/models.py`

### Orders and payments

- [Order API](https://github.com/jaswanthroyg/shophub/blob/main/orders/views.py): `orders/views.py`
- [Orders and items](https://github.com/jaswanthroyg/shophub/blob/main/orders/models.py): `orders/models.py`
- [Payment verification](https://github.com/jaswanthroyg/shophub/blob/main/payments/views.py): `payments/views.py`
- [Payment records](https://github.com/jaswanthroyg/shophub/blob/main/payments/models.py): `payments/models.py`

### Other components

- **Customer**
- **Administrator**
- **REST API**
- **Razorpay**
- **PostgreSQL**

## Connections

- Customer → REST API: uses APIs (evidence: `README.md`)
- Administrator → REST API: uses APIs (evidence: `README.md`)
- REST API → Authentication API: routes requests (evidence: `README.md`)
- Authentication API → User accounts: validates accounts (evidence: `accounts/views.py`)
- REST API → Product API: routes requests (evidence: `README.md`)
- Product API → Products: queries products (evidence: `products/views.py`)
- Product API → Categories: filters categories
- Product API → Products: serializes results (evidence: `products/views.py`)
- Product API → Products: paginates results (evidence: `products/views.py`)
- REST API → Category API: routes requests (evidence: `README.md`)
- Category API → Categories: queries categories (evidence: `categories/views.py`)
- REST API → Cart API: routes requests (evidence: `README.md`)
- Cart API → Cart items: manages items (evidence: `cart/views.py`)
- Cart API → Products: looks up products (evidence: `cart/views.py`)
- REST API → Wishlist API: routes requests (evidence: `README.md`)
- Wishlist API → Wishlist items: manages items (evidence: `wishlist/views.py`)
- REST API → Address API: routes requests (evidence: `README.md`)
- Address API → Addresses: manages addresses (evidence: `addresses/views.py`)
- REST API → Order API: routes requests (evidence: `README.md`)
- Order API → Addresses: reads checkout address (evidence: `orders/views.py`)
- Order API → Cart items: reads checkout cart (evidence: `orders/views.py`)
- Order API → Orders and items: creates order (evidence: `orders/views.py`)
- Order API → Payment records: creates pending payment (evidence: `orders/views.py`)
- Order API → Razorpay: creates gateway order (evidence: `orders/views.py`)
- REST API → Payment verification: routes verification
- Payment verification → Razorpay: verifies signature (evidence: `payments/views.py`)
- Payment verification → Payment records: updates payment (evidence: `payments/views.py`)
- Payment verification → Orders and items: confirms order (evidence: `payments/views.py`)
- Payment verification → Products: reduces stock (evidence: `payments/views.py`)
- Payment verification → Cart items: clears cart (evidence: `payments/views.py`)
- REST API → PostgreSQL: persists data (evidence: `README.md`)
