# aditya-bachhav/wrappdelights architecture

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

- Interactive diagram: https://gitdiagram.com/aditya-bachhav/wrappdelights
- Repository: https://github.com/aditya-bachhav/wrappdelights

## Overview

1. **Top-level shape**
   - This is a **single Django monolith** for a gifting/catalog store called WrappDelights.
   - The main application code lives under `delights_backend/core`, with one Django project package (`core`) and one primary app (`store`).

2. **Execution model**
   - The app is served as a **server-side rendered Django site** using templates, not a separate frontend.
   - The WSGI entrypoint is `delights_backend/core/core/wsgi.py`; `asgi.py` also exists, but the deployment path is WSGI/Gunicorn-oriented.

3. **Request routing boundary**
   - Global URL routing is centralized in `core/urls.py`.
   - That router fans out into public store pages, custom hamper flows, corporate inquiry flows, and dashboard/admin routes defined in `store/views.py` and related templates.

4. **Domain/application layer**
   - The `store` app contains the business logic and Django models for the catalog and ordering domain.
   - The migrations show the core entities evolved around: products, categories, banners, carts, favorites, hampers, hamper items, predefined bundles, corporate inquiries, and order items.

5. **Public customer-facing surfaces**
   - Customer pages are template-driven and include:
     - homepage and catalog browsing
     - product detail and search
     - favorites
     - corporate inquiry page and success page
     - custom hamper builder flow with step/review screens
   - These are backed by `store/views.py`, `forms.py`, and shared UI fragments in `templates/partials`.

6. **Admin and internal dashboard boundary**
   - There are two distinct privileged interfaces:
     - Django admin, mounted at a secret path via `ADMIN_PANEL_PATH`
     - a custom dashboard under `/dashboard/`
   - Dashboard templates live in `templates/dashboard/` and cover product/category/bundle/section management, orders, and corporate requests.
   - Access is restricted to superusers.

7. **Data persistence**
   - Locally, the repo includes `db.sqlite3`; on Render it is designed to use `DATABASE_URL`, implying a hosted database such as PostgreSQL.
   - Media files are stored under `core/media/`, with product and bundle assets separated into subfolders.
   - Static assets are handled through Django’s static pipeline, which is why the build step matters for admin CSS and other collected assets.

8. **Operational tooling and bootstrap commands**
   - The repo includes several management commands under `store/management/commands/` for operational tasks:
     - creating/ensuring an admin user
     - importing products
     - seeding the catalog
     - assigning categories
     - listing/setup/checking categories
   - These commands are part of the deployment and content-initialization workflow, not the request path.

9. **Category hierarchy subsystem**
   - Categories are a notable architectural feature, not just a label field.
   - Migrations add parent/child relationships, slug fixes, images, and hierarchy population logic.
   - There are supporting scripts like `check_category_slugs.py`, `verify_categories.py`, and `assign_categories.py`, indicating category integrity is maintained both in-app and through standalone checks.

10. **Custom hamper / bundle subsystem**
   - Hampers are a first-class product construct with pricing, steps, included items, and image support.
   - Predefined bundles exist alongside custom hamper creation, so the product model is extended into curated compositions rather than only single SKUs.

11. **Content and interaction flows**
   - The main data flows are:
     - catalog data → product/category pages
     - user selections → cart/favorites/hamper state
     - inquiry form submissions → corporate inquiry records
     - admin/dashboard edits → persisted catalog and category updates
   - Most flows stay inside Django’s request/response cycle and database-backed models.

12. **Deployment and environment**
   - `render.yaml`, `build.sh`, and `requirements.txt` show this is designed for **Render deployment**.
   - The README emphasizes running migrations and superuser bootstrap at startup, which means the runtime depends on environment variables such as `SECRET_KEY`, `DATABASE_URL`, `DEBUG`, and admin bootstrap credentials.

13. **Repository layout for diagramming**
   - A good architecture diagram should show:
     - the Django runtime at the center
     - public browser traffic into `core/urls.py`
     - `store/views.py` and templates as the presentation layer
     - `store/models.py` plus migrations as the persistence/domain layer
     - management commands and scripts as an operational side lane
     - media/static storage as external file storage
     - Render/Postgres as deployment/database infrastructure

Main entry points: [`delights_backend/core/store/views.py`](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/views.py) (Views), [`delights_backend/core/store/models.py`](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/models.py) (Models), [`delights_backend/core/core/settings.py`](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/settings.py) (Settings), [`render.yaml`](https://github.com/aditya-bachhav/wrappdelights/blob/main/render.yaml) (Render deploy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_runtime["Django runtime"]
  node_node_wsgi["WSGI entry<br/>django entrypoint<br/>[wsgi.py]"]
  node_node_asgi["ASGI entry<br/>django entrypoint<br/>[asgi.py]"]
  node_node_settings["Settings<br/>django config<br/>[settings.py]"]
  node_node_urls["URL router<br/>request routing<br/>[urls.py]"]
end

subgraph group_group_store["Store app"]
  node_node_models[("Models<br/>[models.py]")]
  node_node_views["Views<br/>request handlers<br/>[views.py]"]
  node_node_forms["Forms<br/>form layer<br/>[forms.py]"]
  node_node_admin["Admin<br/>[admin.py]"]
  node_node_ctx["Context"]
end

subgraph group_group_templates["Templates"]
  node_node_base_tpl["Base layout<br/>shared template<br/>[base.html]"]
  node_node_public_tpl["Public pages<br/>template set<br/>[home.html]"]
  node_node_dash_tpl["Dashboard UI<br/>template set<br/>[dashboard.html]"]
  node_node_partials["Partials<br/>template fragments<br/>[navbar.html]"]
end

subgraph group_group_ops["Ops & data"]
  node_node_migrations["Migrations<br/>schema history<br/>[0001_initial.py]"]
  node_node_cmds["Commands<br/>[import_products.py]"]
  node_node_scripts["Scripts"]
  node_node_media[("Media files<br/>asset storage")]
  node_node_db[("SQLite DB<br/>local database<br/>[db.sqlite3]")]
  node_node_deploy["Render deploy<br/>deployment<br/>[render.yaml]"]
  node_node_build["Build step<br/>build script<br/>[build.sh]"]
  node_node_reqs["Dependencies<br/>python requirements<br/>[requirements.txt]"]
end

node_node_wsgi -->|"loads"| node_node_settings
node_node_asgi -->|"loads"| node_node_settings
node_node_urls -->|"dispatches to"| node_node_views
node_node_urls -->|"mounts admin"| node_node_admin
node_node_views -->|"reads/writes"| node_node_models
node_node_views -->|"validates"| node_node_forms
node_node_views -->|"renders"| node_node_public_tpl
node_node_views -->|"renders"| node_node_dash_tpl
node_node_views -->|"composes"| node_node_partials
node_node_ctx -->|"feeds"| node_node_base_tpl
node_node_models -->|"evolves via"| node_node_migrations
node_node_admin -->|"customizes"| node_node_dash_tpl
node_node_cmds -->|"operates on"| node_node_models
node_node_scripts -->|"verifies"| node_node_models
node_node_deploy -->|"invokes"| node_node_build
node_node_build -->|"installs"| node_node_reqs
node_node_deploy -->|"provisions"| node_node_db
node_node_models -->|"persists to"| node_node_db
node_node_models -->|"references"| node_node_media
node_node_cmds -.->|"bootstrap workflow"| node_node_deploy
node_node_settings -->|"connects to"| node_node_db
node_node_settings -->|"serves"| node_node_media

click node_node_wsgi "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/wsgi.py"
click node_node_asgi "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/asgi.py"
click node_node_settings "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/settings.py"
click node_node_urls "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/urls.py"
click node_node_models "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/models.py"
click node_node_views "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/views.py"
click node_node_forms "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/forms.py"
click node_node_admin "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/admin.py"
click node_node_ctx "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/context_processors.py"
click node_node_base_tpl "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/base.html"
click node_node_public_tpl "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/home.html"
click node_node_dash_tpl "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/dashboard/dashboard.html"
click node_node_partials "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/partials/navbar.html"
click node_node_migrations "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/migrations/0001_initial.py"
click node_node_cmds "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/management/commands/import_products.py"
click node_node_scripts "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/assign_categories.py"
click node_node_media "https://github.com/aditya-bachhav/wrappdelights/tree/main/delights_backend/core/media/products"
click node_node_db "https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/db.sqlite3"
click node_node_deploy "https://github.com/aditya-bachhav/wrappdelights/blob/main/render.yaml"
click node_node_build "https://github.com/aditya-bachhav/wrappdelights/blob/main/build.sh"
click node_node_reqs "https://github.com/aditya-bachhav/wrappdelights/blob/main/requirements.txt"

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_node_wsgi,node_node_asgi,node_node_settings,node_node_urls toneBlue
class node_node_models,node_node_views,node_node_forms,node_node_admin,node_node_ctx toneAmber
class node_node_base_tpl,node_node_public_tpl,node_node_dash_tpl,node_node_partials toneMint
class node_node_migrations,node_node_cmds,node_node_scripts,node_node_media,node_node_db,node_node_deploy,node_node_build,node_node_reqs toneRose
```

## Components

### Django runtime

Server-side Django project, URL routing, and deployment entrypoints

- [WSGI entry](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/wsgi.py): django entrypoint · Gunicorn-oriented server entrypoint · `delights_backend/core/core/wsgi.py`
- [ASGI entry](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/asgi.py): django entrypoint · Async entrypoint kept alongside WSGI · `delights_backend/core/core/asgi.py`
- [Settings](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/settings.py): django config · Project configuration and environment wiring · `delights_backend/core/core/settings.py`
- [URL router](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/core/urls.py): request routing · Central fan-out for public, custom hamper, corporate, dashboard, and admin routes · `delights_backend/core/core/urls.py`

### Store app

Domain logic, request handlers, forms, and admin customization

- [Models](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/models.py): domain models · Catalog, category, hamper, bundle, cart, favorite, inquiry, and order data model · `delights_backend/core/store/models.py`
- [Views](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/views.py): request handlers · Public pages, hamper flow, corporate inquiries, and dashboard handlers · `delights_backend/core/store/views.py`
- [Forms](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/forms.py): form layer · Validated inputs for customer and internal workflows · `delights_backend/core/store/forms.py`
- [Admin](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/admin.py): django admin · Admin registrations and custom admin hooks · `delights_backend/core/store/admin.py`
- [Context](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/context_processors.py): template context · Shared template context processors · `delights_backend/core/store/context_processors.py`

### Templates

Shared shell plus public and dashboard presentation templates

- [Base layout](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/base.html): shared template · Common site shell used by public and dashboard pages · `delights_backend/core/store/templates/base.html`
- [Public pages](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/home.html): template set · Homepage, products, search, favorites, corporate, and custom hamper screens · `delights_backend/core/store/templates/home.html`
- [Dashboard UI](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/dashboard/dashboard.html): template set · Privileged management screens for products, categories, bundles, orders, and inquiries · `delights_backend/core/store/templates/dashboard/dashboard.html`
- [Partials](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/templates/partials/navbar.html): template fragments · Reusable navbar, footer, and product card fragments · `delights_backend/core/store/templates/partials/navbar.html`

### Ops & data

Migrations, management commands, scripts, media, database, and deployment

- [Migrations](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/migrations/0001_initial.py): schema history · Schema evolution for products, categories, hampers, bundles, inquiries, favorites, and orders · `delights_backend/core/store/migrations/0001_initial.py`
- [Commands](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/store/management/commands/import_products.py): ops commands · Catalog import, seeding, category setup, and admin bootstrap commands · `delights_backend/core/store/management/commands/import_products.py`
- [Scripts](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/assign_categories.py): ops scripts · Standalone category checks and assignment helpers · `delights_backend/core/assign_categories.py`
- [Media files](https://github.com/aditya-bachhav/wrappdelights/tree/main/delights_backend/core/media/products): asset storage · Uploaded product and bundle assets · `delights_backend/core/media/products`
- [SQLite DB](https://github.com/aditya-bachhav/wrappdelights/blob/main/delights_backend/core/db.sqlite3): local database · Local development database snapshot · `delights_backend/core/db.sqlite3`
- [Render deploy](https://github.com/aditya-bachhav/wrappdelights/blob/main/render.yaml): deployment · Render build and runtime configuration · `render.yaml`
- [Build step](https://github.com/aditya-bachhav/wrappdelights/blob/main/build.sh): build script · Deployment build and collect-static step · `build.sh`
- [Dependencies](https://github.com/aditya-bachhav/wrappdelights/blob/main/requirements.txt): python requirements · Python package set for the monolith · `requirements.txt`

## Connections

- WSGI entry → Settings: loads · WSGI bootstraps project configuration
- ASGI entry → Settings: loads · ASGI bootstraps the same settings
- URL router → Views: dispatches to · Routes public, custom hamper, corporate, and dashboard requests into view handlers
- URL router → Admin: mounts admin · Exposes Django admin at a protected path
- Views → Models: reads/writes · Request handlers operate on catalog and ordering data
- Views → Forms: validates · Form-backed customer, hamper, and inquiry submissions
- Views → Public pages: renders · Customer-facing browsing, search, favorites, corporate, and hamper flows
- Views → Dashboard UI: renders · Dashboard management screens for privileged users
- Views → Partials: composes · Public and dashboard pages reuse shared fragments
- Context → Base layout: feeds · Shared context supports the site shell and fragments
- Models → Migrations: evolves via · Schema and domain changes are captured in migrations
- Admin → Dashboard UI: customizes · Admin surfaces use custom templates and widgets
- Commands → Models: operates on · Commands import, seed, and normalize catalog data
- Scripts → Models: verifies · Standalone scripts check and repair category integrity
- Render deploy → Build step: invokes · Render deploy relies on build-time preparation
- Build step → Dependencies: installs · Build step depends on the Python package set
- Render deploy → SQLite DB: provisions · Deployment uses an external database in production
- Models → SQLite DB: persists to · Domain data is stored in the database
- Models → Media files: references · Products and bundles use uploaded media assets
- Commands → Render deploy: bootstrap workflow · Commands support startup and content initialization
- Settings → SQLite DB: connects to · Settings select local SQLite or DATABASE_URL-backed storage
- Settings → Media files: serves · Settings configure media handling for uploaded assets
