# keshav2136/online-retail-marketplace architecture

> Architecture diagram of the GitHub repository keshav2136/online-retail-marketplace, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keshav2136/online-retail-marketplace
- Repository: https://github.com/keshav2136/online-retail-marketplace

## Overview

##### Project Type and Purpose
- This is a full-stack, monolithic Django web application (MVT pattern) that exposes HTML pages and REST-style endpoints.
- It provides an online shopping interface (front-end templates powered by Bulma & jQuery) and a backend (Django views, models, ORM) for user management, product browsing, and seller data.

##### File Structure
- Top-level files: Pipfile/Pipfile.lock (Python dependencies), requirements.txt, Procfile (Heroku/Gunicorn deploy).
- onlineretail/ — Django project root containing:
– onlineretail/settings.py, urls.py, wsgi.py, asgi.py
– Two Django apps: home/ (catalog, landing page) and user/ (authentication & profile).
– db.sqlite3 (local database).
– static/ (css, js) and templates/ (HTML).
- No separate microservices—single codebase.

##### README for Additional Insights
- Front-end stack: jQuery + Bulma CSS.
- Backend: Python, Django (mentions Firebase, MongoDB for seller info, MySQL for real users—those would be external or future data stores).
- Deploy via Heroku (Procfile).

##### Main Components & Interactions
a. Client (Web Browser)
– Loads static assets (HTML, CSS, JS) from Django’s static file handler.
– Initiates HTTP(S) requests for pages or API endpoints.
b. Django Application Server
– URL Router → View functions (home.views, user.views)
– Templates rendered into HTML; JSON responses for AJAX.
– ORM layer communicates with a relational DB (SQLite locally; eventual MySQL for users).
– May also call out to Firebase or MongoDB for seller/inventory data (via external SDK or REST).
c. Database Layer
– Primary DB: SQLite for dev; MySQL in production for user data.
– Secondary DB (external): MongoDB for seller/inventory; Firebase (Auth, Storage).
d. Deployment Environment
– Gunicorn (Procfile) running WSGI/ASGI process on Heroku dyno.
– Environment variables for SECRET_KEY, DATABASE_URL, Firebase creds.

##### Architectural Patterns & Design Principles
- MVC/MVT—Separation of concerns:
– Models (user.models, home.models)
– Views (processing logic, user.views, home.views)
– Templates (UI layer)
- Modularization by feature: home vs user apps.
- Externalize static assets for caching/CDN.
- Future-proof for multi-database support.

– UI layer (templates, static assets)
– Application layer (Django router, views, models)
– Persistence layer (SQLite/MySQL, MongoDB, Firebase)
– Deployment/runtime (Heroku dyno, Gunicorn).

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef ui fill:#a2d2ff,stroke:#1d3557
    classDef backend fill:#d8e2dc,stroke:#81b29a
    classDef db fill:#c3f584,stroke:#2f5233
    classDef external fill:#ffad60,stroke:#9c6644

    subgraph "Client (Web Browser)"
        Browser["Web Browser"]:::ui
    end

    subgraph "Static Assets (Django)"
        hdCSS["header-desktop.css"]:::ui
        hdJS["header-desktop.js"]:::ui
    end

    subgraph "Dependencies"
        pipfile["Pipfile"] 
        lock["Pipfile.lock"]
        req["requirements.txt"]
    end

    subgraph "Django App Server" 
        mgpy["manage.py"] 
        Proc["Procfile"]
        subgraph "Core"
            settings["settings.py"]
            urls["urls.py"]
            wsgi["wsgi.py"]
            asgi["asgi.py"]
        end
        subgraph "Apps"
            subgraph "home"
                homeApps["apps.py"]
                homeUrls["urls.py"]
                homeViews["views.py"]
                homeModels["models.py"]
                homeAdmin["admin.py"]
                homeTests["tests.py"]
                homeMigs["migrations"] 
            end
            subgraph "user"
                userApps["apps.py"]
                userUrls["urls.py"]
                userViews["views.py"]
                userModels["models.py"]
                userAdmin["admin.py"]
                userTests["tests.py"]
                userMigs["migrations"] 
            end
        end
        subgraph "Template Engine"
            baseT["base.html"]
            homeT["home.html"]
            contactT["contact.html"]
            userT["user.html"]
        end
    end

    subgraph "Databases"
        sqlite["SQLite / db.sqlite3"]:::db
        mysql["MySQL"]:::db
        mongo["MongoDB"]:::external
        firebase["Firebase"]:::external
    end

    subgraph "Deployment/Runtime"
        Heroku["Heroku Dyno"]:::external
        gunicorn["Gunicorn (WSGI/ASGI)"]:::backend
    end

    %% Flows
    Browser -->|GET CSS/JS| hdCSS
    Browser -->|GET CSS/JS| hdJS
    Browser -->|HTTP Request| urls
    urls -->|"calls home view"| homeViews
    urls -->|"calls user view"| userViews
    homeViews -->|"ORM Query"| homeModels
    userViews -->|"ORM Query"| userModels
    homeViews -->|"render HTML"| homeT
    userViews -->|"render HTML"| userT
    homeModels -->|"SQL"| sqlite
    userModels -->|"SQL"| sqlite
    homeViews -->|"SDK/API"| mongo
    userViews -->|"SDK/API"| firebase
    Proc -->|"start WSGI"| gunicorn
    Heroku --> gunicorn
    gunicorn --> urls

    %% Click Events
    click pipfile "https://github.com/keshav2136/online-retail-marketplace/tree/main/Pipfile"
    click lock "https://github.com/keshav2136/online-retail-marketplace/blob/main/Pipfile.lock"
    click req "https://github.com/keshav2136/online-retail-marketplace/blob/main/requirements.txt"
    click Proc "https://github.com/keshav2136/online-retail-marketplace/tree/main/Procfile"
    click mgpy "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/manage.py"
    click settings "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/onlineretail/settings.py"
    click urls "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/onlineretail/urls.py"
    click wsgi "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/onlineretail/wsgi.py"
    click asgi "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/onlineretail/asgi.py"
    click homeApps "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/home/apps.py"
    click homeUrls "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/home/urls.py"
    click homeViews "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/home/views.py"
    click homeModels "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/home/models.py"
    click homeAdmin "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/home/admin.py"
    click homeTests "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/home/tests.py"
    click homeMigs "https://github.com/keshav2136/online-retail-marketplace/tree/main/onlineretail/home/migrations/"
    click userApps "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/user/apps.py"
    click userUrls "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/user/urls.py"
    click userViews "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/user/views.py"
    click userModels "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/user/models.py"
    click userAdmin "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/user/admin.py"
    click userTests "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/user/tests.py"
    click userMigs "https://github.com/keshav2136/online-retail-marketplace/tree/main/onlineretail/user/migrations/"
    click hdCSS "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/static/css/header-desktop.css"
    click hdJS "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/static/js/header-desktop.js"
    click baseT "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/templates/base.html"
    click homeT "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/templates/home.html"
    click contactT "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/templates/contact.html"
    click userT "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/templates/user.html"
    click sqlite "https://github.com/keshav2136/online-retail-marketplace/blob/main/onlineretail/db.sqlite3"
```
