# webwizard2965/django-shopping-website architecture

> Architecture diagram of the GitHub repository webwizard2965/django-shopping-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/webwizard2965/django-shopping-website
- Repository: https://github.com/webwizard2965/django-shopping-website

## Overview

##### Project Type & Purpose
- This is a full-stack e-commerce web application.
- Backend: Django (with Django REST Framework-style serializers & views), SQLite (development), Stripe integrations.
- Frontend: React SPA using Redux for state management, served as static assets.

##### File Structure & Key Components
- Top-level: two main folders, **backend** and **frontend**.
- Backend “apps”:
- account (users, billing addresses, orders)
- payments (payment processing integrations)
- product (product catalog management)
- my_project (Django project settings, URLs, WSGI/ASGI)
- Frontend structure:
- public (index.html and manifest)
- src
– actions, reducers, store (Redux)
– components (UI building blocks)
– pages (routes/views)
– constants
- Config & deployment hints:
- backend/requirements.txt, backend/static/images
- frontend/package.json, .env (for production env vars)

##### Main Components
a. Client Layer
– Web Browser
– React SPA (served from a static file server or Django’s static endpoint)
– Redux store (client in-memory state)
b. API Layer
– React Axios/fetch calls ↔ Django REST API endpoints
– URL grouping by app (e.g., /api/account/, /api/product/, /api/payments/)
c. Backend Layer
– Django (WSGI/ASGI) application
– Django ORM (models in account/, product/, payments/)
– Business logic: serializers.py, views.py in each app
– Admin interface (Django Admin)
d. Data Layer
– Development: SQLite (db.sqlite3)
– Future/Production: PostgreSQL (per README upcoming)
e. External Services
– Stripe payment gateway (API calls from payments app)

##### Relationships & Data Flows
1. Browser → React App
2. React App → Redux store (dispatch actions)
3. React → REST API calls (using cardActions.js, productActions.js, userActions.js)
4. Django REST API → Django ORM → Database
5. Payments App → Stripe API
6. Django Admin UI → ORM → Database

##### Architectural Patterns & Design Principles
- Separation of concerns:
- Frontend (presentation + client-side state management)
- Backend (API + business logic + data persistence)
- Modular Django apps (account, product, payments) following the “app per domain” pattern.
- Redux unidirectional data flow on the client.
- RESTful API endpoints grouped by resource.

##### Technology Stack Highlights
- Django + Django REST Framework (serializers, viewsets)
- React (functional components + hooks) + Redux
- SQLite (dev) / PostgreSQL (prod)
- Stripe for secure payments
- Node.js & npm for frontend build

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        Browser["Web Browser"]:::frontend
        subgraph "React SPA"
            IndexHTML["index.html"]:::frontend
            AppJS["App.js"]:::frontend
        end
        ReduxStore["Redux Store"]:::frontend
        UIComponents["UI Components"]:::frontend
        Pages["Route Pages"]:::frontend
        Constants["Constants"]:::frontend
    end

    %% API Layer
    subgraph "API Layer"
        CardActions["cardActions.js"]:::api
        ProductActions["productActions.js"]:::api
        UserActions["userActions.js"]:::api
        AxiosClient["Axios/Fetch Client"]:::api
    end

    %% Backend Layer
    subgraph "Backend Layer"
        DjangoCore["Django Core (settings, URLs, WSGI/ASGI)"]:::backend
        DjangoRESTAPI["Django REST API"]:::backend
        subgraph "Account App"
            AccountModels["models.py"]:::backend
            AccountSerializers["serializers.py"]:::backend
            AccountViews["views.py"]:::backend
            AccountURLs["urls.py"]:::backend
            AccountAdmin["admin.py"]:::backend
        end
        subgraph "Product App"
            ProductModels["models.py"]:::backend
            ProductSerializers["serializers.py"]:::backend
            ProductViews["views.py"]:::backend
            ProductURLs["urls.py"]:::backend
            ProductAdmin["admin.py"]:::backend
        end
        subgraph "Payments App"
            PaymentsModels["models.py"]:::backend
            PaymentsViews["views.py"]:::backend
            PaymentsURLs["urls.py"]:::backend
            PaymentsAdmin["admin.py"]:::backend
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        SQLiteDB["db.sqlite3"]:::database
        StaticAssets["static/images/"]:::database
    end

    %% Dependencies
    subgraph "Dependencies & Config"
        BackendReqs["requirements.txt"]:::config
        FrontendPkg["package.json"]:::config
        FrontendEnv[".env"]:::config
    end

    %% External Services
    subgraph "External Services"
        Stripe["Stripe API"]:::external
    end

    %% Connections
    Browser --> IndexHTML
    IndexHTML --> AppJS
    AppJS --> ReduxStore
    AppJS --> UIComponents
    AppJS --> Pages
    AppJS --> Constants

    AppJS --> CardActions
    AppJS --> ProductActions
    AppJS --> UserActions
    CardActions --> AxiosClient
    ProductActions --> AxiosClient
    UserActions --> AxiosClient
    AxiosClient --> DjangoRESTAPI

    DjangoRESTAPI --> AccountViews
    DjangoRESTAPI --> ProductViews
    DjangoRESTAPI --> PaymentsViews

    AccountViews --> AccountSerializers
    AccountViews --> AccountModels
    AccountSerializers --> AccountModels
    ProductViews --> ProductSerializers
    ProductViews --> ProductModels
    ProductSerializers --> ProductModels
    PaymentsViews --> PaymentsModels

    AccountModels --> SQLiteDB
    ProductModels --> SQLiteDB
    PaymentsModels --> SQLiteDB
    AccountAdmin --> AccountModels
    ProductAdmin --> ProductModels
    PaymentsAdmin --> PaymentsModels

    PaymentsViews --> Stripe

    DjangoCore --> DjangoRESTAPI

    BackendReqs --> DjangoCore
    FrontendPkg --> AppJS
    FrontendEnv --> AppJS

    StaticAssets --> DjangoCore

    %% Click Events
    click IndexHTML "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/public/index.html"
    click AppJS "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/src/App.js"
    click ReduxStore "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/src/store.js"
    click CardActions "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/src/actions/cardActions.js"
    click ProductActions "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/src/actions/productActions.js"
    click UserActions "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/src/actions/userActions.js"
    click AccountModels "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/account/models.py"
    click AccountSerializers "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/account/serializers.py"
    click AccountViews "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/account/views.py"
    click AccountURLs "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/account/urls.py"
    click AccountAdmin "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/account/admin.py"
    click ProductModels "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/product/models.py"
    click ProductSerializers "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/product/serializers.py"
    click ProductViews "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/product/views.py"
    click ProductURLs "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/product/urls.py"
    click ProductAdmin "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/product/admin.py"
    click PaymentsModels "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/payments/models.py"
    click PaymentsViews "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/payments/views.py"
    click PaymentsURLs "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/payments/urls.py"
    click PaymentsAdmin "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/payments/admin.py"
    click SQLiteDB "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/db.sqlite3"
    click StaticAssets "https://github.com/webwizard2965/django-shopping-website/tree/main/backend/static/images/"
    click BackendReqs "https://github.com/webwizard2965/django-shopping-website/blob/main/backend/requirements.txt"
    click FrontendPkg "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/package.json"
    click FrontendEnv "https://github.com/webwizard2965/django-shopping-website/blob/main/frontend/.env"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#00ACC1,color:#004D40
    classDef api fill:#E8F5E9,stroke:#43A047,color:#1B5E20
    classDef backend fill:#FFF3E0,stroke:#FB8C00,color:#E65100
    classDef database fill:#FFFDE7,stroke:#FDD835,color:#F57F17
    classDef external fill:#ECEFF1,stroke:#90A4AE,color:#455A64
    classDef config fill:#F3E5F5,stroke:#8E24AA,color:#4A148C
```
