# abin-jacob-dev/e-commerce-jersey-selling-website architecture

> Architecture diagram of the GitHub repository abin-jacob-dev/e-commerce-jersey-selling-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abin-jacob-dev/e-commerce-jersey-selling-website
- Repository: https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website

## Overview

1. **Overall shape**
   - This is a single Django monolith for an e-commerce site selling sports jerseys.
   - The runtime entry points are the standard Django project files in `campeon/campeon/` (`settings.py`, `urls.py`, `wsgi.py`, `asgi.py`), with `manage.py` as the CLI entry.

2. **Request routing boundary**
   - The root URL config delegates traffic into five main apps: `core`, `userauths`, `user`, `products`, `payment`, plus a separate `admin_panel`.
   - The architecture is server-rendered Django templates rather than an API-first or SPA design; pages are composed from app-specific templates and shared partials.

3. **Core site subsystem**
   - `core` appears to own the public informational pages and entry experience: home, shop, about, contact, and 404 handling.
   - It also includes a custom template tag module (`query_transform.py`) used for preserving query parameters in list/filter navigation.

4. **Authentication and account subsystem**
   - `userauths` is the identity boundary and likely contains the custom `Account` model, OTP support, referral fields, and activation/reset flows.
   - It also includes forms, views, adapters, and utilities, indicating integration with external auth such as Google login via `django-allauth`.
   - This app is the source of login/sign-up, admin sign-in, account verification, and password reset flows.

5. **User profile subsystem**
   - `user` handles post-auth account management: profile edits, addresses, referrals, and user-specific utility logic.
   - The presence of migrations for `Addresses` and OTP-related data suggests it also manages shipping address book state and related verification helpers.
   - This is the customer account domain, separate from authentication itself.

6. **Catalog and commerce domain**
   - `products` is the largest domain app and likely contains the core commerce models: products, variants, categories, colors, cart, wishlist, orders, coupons, offers, wallet, and order-item state.
   - The heavy migration history suggests the business rules evolved here, especially around pricing, discounts, refunds, returns, and order snapshots.
   - The app also includes `forms.py`, `context_processors.py`, `signals.py`, `service.py`, and `offer_service.py`, showing a mix of UI helpers, event-driven side effects, and domain services.

7. **Discount and pricing flow**
   - Offer/coupon logic is implemented inside `products` and partially `payment`, not in a standalone pricing engine.
   - The repository structure implies pricing is computed from product/variant data, then adjusted by offers, coupons, and possibly wallet balances before checkout.
   - `offer_service.py` suggests a dedicated decision layer for selecting the best offer for a product or category.

8. **Checkout and payment subsystem**
   - `payment` encapsulates order payment processing and likely the Razorpay integration boundary.
   - It includes `services.py`, which points to a service layer for payment order creation, verification, and status updates.
   - Payment methods include COD, wallet, and Razorpay, so this app likely finalizes orders and reconciles payment state with order records in `products`.

9. **Admin operations subsystem**
   - `admin_panel` is a custom back-office UI separate from Django’s built-in admin.
   - Its templates cover dashboard analytics, product/category/color management, coupon and offer CRUD, order review, user blocking, and sales reporting.
   - This is a separate operational interface for staff/superusers, not just a model registry.

10. **Shared UI and presentation layer**
   - The `templates/` tree is split by domain (`core`, `products`, `user`, `userauths`, `admin`) plus reusable `partials` and `components`.
   - That layout indicates multiple Django view layers rendering to a shared presentation system, with no standalone frontend application.
   - Bootstrap and JavaScript are used for interactivity, but the app remains server-driven.

11. **Persistence and data model boundaries**
   - The project uses Django ORM migrations across each app, with development SQLite and production PostgreSQL supported via environment config.
   - Business data is split by domain: identity in `userauths`, profile/address in `user`, commerce entities in `products`, and payment records in `payment`.
   - This separation is important for diagramming because the same user flows cross several app-owned tables.

12. **External services and infrastructure**
   - Cloudinary is used for media storage/CDN, so product and profile images are not handled as local durable files.
   - SMTP handles account activation and password reset emails.
   - Razorpay handles external payment authorization, while WeasyPrint and OpenPyXL generate PDFs and spreadsheets for invoices and sales reports.

13. **Event and side-effect handling**
   - `products/signals.py` indicates some domain actions are reactive rather than only request-driven, likely for wallet/refund/referral/order updates.
   - This means certain state transitions probably trigger cross-model side effects after save events, not just inside views.
   - For an architecture diagram, this is the main “implicit” flow to show between orders, wallet/refunds, and referral accounting.

14. **Operational deployment boundary**
   - The project is configured for standard Django deployment via WSGI/ASGI, with environment variables in `.env`.
   - Static files are local, while media storage is externalized; the intended production stack is Django behind a web server with PostgreSQL and Cloudinary-backed media.

Main entry points: [`campeon/campeon/urls.py`](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/urls.py) (Root URLs), [`campeon/campeon/settings.py`](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/settings.py) (Settings), [`campeon/admin_panel`](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/admin_panel) (Admin panel), [`campeon/products`](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/products) (Products)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_manage_py["manage.py<br/>CLI entry<br/>[manage.py]"]
  node_settings["Settings<br/>Django config<br/>[settings.py]"]
  node_root_urls["Root URLs<br/>router<br/>[urls.py]"]
  node_wsgi_asgi["WSGI/ASGI<br/>deploy entry<br/>[wsgi.py]"]
end

subgraph group_public["Public site"]
  node_shared_templates["Shared templates<br/>presentation layer"]
  node_core_app["Core<br/>public pages"]
  node_core_tags["Query tags<br/>template tags<br/>[query_transform.py]"]
end

subgraph group_identity["Identity"]
  node_userauths_app["Auth<br/>identity"]
  node_account_model[("Account model<br/>identity data<br/>[models.py]")]
  node_user_app["Profile<br/>customer account"]
  node_address_model[("Address book<br/>profile data<br/>[models.py]")]
end

subgraph group_commerce["Commerce"]
  node_products_app["Products<br/>commerce domain"]
  node_product_domain[("Catalog data<br/>commerce data<br/>[models.py]")]
  node_pricing_service["Pricing rules<br/>domain service<br/>[offer_service.py]"]
  node_domain_signals["Domain signals<br/>event hooks<br/>[signals.py]"]
  node_payment_app["Payment<br/>checkout"]
  node_payment_service["Payment service<br/>service layer<br/>[services.py]"]
end

subgraph group_ops["Operations"]
  node_admin_panel_app["Admin panel<br/>back office"]
end

subgraph group_external["External services"]
  node_cloudinary[("Cloudinary<br/>media storage")]
  node_razorpay["Razorpay<br/>payment gateway"]
  node_smtp["SMTP mail<br/>email delivery"]
  node_postgres[("PostgreSQL<br/>database")]
  node_pdf_xlsx["Reports export<br/>document generation"]
end

node_manage_py -->|"loads"| node_settings
node_settings -->|"connects"| node_postgres
node_settings -->|"stores media"| node_cloudinary
node_settings -->|"sends mail"| node_smtp
node_settings -->|"integrates"| node_razorpay
node_root_urls -->|"routes to"| node_core_app
node_root_urls -->|"routes to"| node_userauths_app
node_root_urls -->|"routes to"| node_user_app
node_root_urls -->|"routes to"| node_products_app
node_root_urls -->|"routes to"| node_payment_app
node_root_urls -->|"routes to"| node_admin_panel_app
node_core_app -->|"renders"| node_shared_templates
node_core_app -->|"uses"| node_core_tags
node_userauths_app -->|"owns"| node_account_model
node_userauths_app -->|"email flows"| node_smtp
node_user_app -->|"owns"| node_address_model
node_user_app -->|"extends"| node_account_model
node_products_app -->|"owns"| node_product_domain
node_products_app -->|"uses"| node_pricing_service
node_products_app -->|"emits"| node_domain_signals
node_pricing_service -->|"reads"| node_product_domain
node_payment_app -->|"uses"| node_payment_service
node_payment_service -->|"calls"| node_razorpay
node_payment_app -->|"updates orders"| node_product_domain
node_domain_signals -->|"updates"| node_product_domain
node_admin_panel_app -->|"manages"| node_products_app
node_admin_panel_app -->|"manages"| node_user_app
node_admin_panel_app -->|"reviews"| node_payment_app
node_admin_panel_app -->|"exports"| node_pdf_xlsx

click node_manage_py "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/manage.py"
click node_settings "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/settings.py"
click node_root_urls "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/urls.py"
click node_wsgi_asgi "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/wsgi.py"
click node_shared_templates "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/templates"
click node_core_app "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/core"
click node_core_tags "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/core/templatetags/query_transform.py"
click node_userauths_app "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/userauths"
click node_account_model "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/userauths/models.py"
click node_user_app "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/user"
click node_address_model "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/user/models.py"
click node_products_app "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/products"
click node_product_domain "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/products/models.py"
click node_pricing_service "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/products/offer_service.py"
click node_domain_signals "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/products/signals.py"
click node_payment_app "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/payment"
click node_payment_service "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/payment/services.py"
click node_admin_panel_app "https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/admin_panel"

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_manage_py,node_settings,node_root_urls,node_wsgi_asgi toneBlue
class node_shared_templates,node_core_app,node_core_tags toneAmber
class node_userauths_app,node_account_model,node_user_app,node_address_model toneMint
class node_products_app,node_product_domain,node_pricing_service,node_domain_signals,node_payment_app,node_payment_service toneRose
class node_admin_panel_app toneIndigo
class node_cloudinary,node_razorpay,node_smtp,node_postgres,node_pdf_xlsx toneTeal
```

## Components

### Runtime

Django entry points and deployment configuration.

- [manage.py](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/manage.py): CLI entry · Django command-line entry point. · `campeon/manage.py`
- [Settings](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/settings.py): Django config · Project configuration, apps, middleware, database, and environment settings. · `campeon/campeon/settings.py`
- [Root URLs](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/urls.py): router · Top-level request routing into the Django apps. · `campeon/campeon/urls.py`
- [WSGI/ASGI](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/campeon/wsgi.py): deploy entry · Web and async deployment entry points. · `campeon/campeon/wsgi.py`

### Public site

Server-rendered storefront pages and shared templates.

- [Shared templates](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/templates): presentation layer · Reusable server-rendered templates, partials, and components. · `campeon/templates`
- [Core](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/core): public pages · Home, shop, about, contact, and 404 handling. · `campeon/core`
- [Query tags](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/core/templatetags/query_transform.py): template tags · Utility tag for preserving query parameters in navigation. · `campeon/core/templatetags/query_transform.py`

### Identity

Authentication and customer account boundaries.

- [Auth](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/userauths): identity · Sign-in, sign-up, activation, password reset, and OTP flows. · `campeon/userauths`
- [Account model](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/userauths/models.py): identity data · Custom account record with referral, activation, and profile fields. · `campeon/userauths/models.py`
- [Profile](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/user): customer account · Addresses, profile edits, referrals, and account utilities. · `campeon/user`
- [Address book](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/user/models.py): profile data · Shipping address and customer state managed by the user app. · `campeon/user/models.py`

### Commerce

Catalog, cart, checkout, orders, and payment flows.

- [Products](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/products): commerce domain · Catalog, cart, wishlist, orders, coupons, offers, wallet, and order state. · `campeon/products`
- [Catalog data](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/products/models.py): commerce data · Core product, variant, category, cart, wishlist, order, coupon, and wallet models. · `campeon/products/models.py`
- [Pricing rules](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/products/offer_service.py): domain service · Offer selection and business logic for discounts and pricing. · `campeon/products/offer_service.py`
- [Domain signals](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/products/signals.py): event hooks · Reactive side effects for order, wallet, refund, and referral updates. · `campeon/products/signals.py`
- [Payment](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/payment): checkout · Payment order creation, verification, and payment status reconciliation. · `campeon/payment`
- [Payment service](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/blob/validations/campeon/payment/services.py): service layer · Encapsulates payment processing and provider integration. · `campeon/payment/services.py`

### Operations

Staff-facing back office and reporting.

- [Admin panel](https://github.com/abin-jacob-dev/e-commerce-jersey-selling-website/tree/validations/campeon/admin_panel): back office · Custom staff dashboard for products, coupons, offers, orders, users, and reports. · `campeon/admin_panel`

### External services

Third-party services and infrastructure used by the app.

- **Cloudinary**: media storage · External media hosting for images and assets.
- **Razorpay**: payment gateway · External payment authorization provider.
- **SMTP mail**: email delivery · Outbound email for activation and password reset.
- **PostgreSQL**: database · Primary production database supported by environment config.
- **Reports export**: document generation · PDF and spreadsheet generation for invoices and sales reports.

## Connections

- manage.py → Settings: loads · Django CLI uses project settings.
- Settings → PostgreSQL: connects · ORM persistence targets the relational database.
- Settings → Cloudinary: stores media · Image and asset handling is externalized.
- Settings → SMTP mail: sends mail · Activation and reset emails use SMTP.
- Settings → Razorpay: integrates · Checkout config enables payment provider integration.
- Root URLs → Core: routes to · Public informational pages.
- Root URLs → Auth: routes to · Authentication and account flows.
- Root URLs → Profile: routes to · Profile, addresses, referrals, and wallet pages.
- Root URLs → Products: routes to · Catalog, cart, wishlist, and checkout flows.
- Root URLs → Payment: routes to · Payment completion and status pages.
- Root URLs → Admin panel: routes to · Custom staff back-office routes.
- Core → Shared templates: renders · Uses the shared server-rendered presentation layer.
- Core → Query tags: uses · Preserves filter state in shop navigation.
- Auth → Account model: owns · Authentication boundary and custom account data.
- Auth → SMTP mail: email flows · Activation and password reset messages.
- Profile → Address book: owns · Customer address book and profile state.
- Profile → Account model: extends · Profile and referral flows depend on account identity.
- Products → Catalog data: owns · Primary commerce data model.
- Products → Pricing rules: uses · Offer and discount resolution.
- Products → Domain signals: emits · Order and wallet side effects.
- Pricing rules → Catalog data: reads · Pricing decisions depend on catalog and variant data.
- Payment → Payment service: uses · Payment processing is isolated in a service layer.
- Payment service → Razorpay: calls · External authorization and verification.
- Payment → Catalog data: updates orders · Final payment state reconciles with order records.
- Domain signals → Catalog data: updates · Reactive order, refund, wallet, and referral state changes.
- Admin panel → Products: manages · Staff CRUD and review of catalog and orders.
- Admin panel → Profile: manages · User blocking and account operations.
- Admin panel → Payment: reviews · Operational visibility into payment/order status.
- Admin panel → Reports export: exports · Sales reports and invoices are generated as documents.
