# taruntyagi1/insta architecture

> Architecture diagram of the GitHub repository taruntyagi1/insta, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/taruntyagi1/insta
- Repository: https://github.com/taruntyagi1/insta

## Overview

##### Main System Components

a) Frontend Layer:
- Website templates (templates/website/)
- Dashboard interface (dashboard/)
- Customer interface (customer/templates/)
- Static assets (static/)

b) Backend Layer:
- Core Django Application
- Multiple Django Apps:
- accounts (User management)
- catalogue (Product management)
- order (Order processing)
- basket (Shopping cart)
- checkout (Payment processing)
- customer (Customer management)
- voucher (Discount system)
- shipping (Shipping management)

c) Database Layer:
- PostgreSQL database (as specified in README)

##### Architectural Patterns to Highlight

a) MVC/MTV Pattern:
- Models (each app's models.py)
- Views (each app's views.py)
- Templates (template directories)

b) RESTful API Architecture:
- API endpoints (catalogue/api/, customer/api/)
- Serializers (api/v1/serializers.py)
- API Views (api/v1/views.py)

##### Component Relationships

Interactions:

a) User Flow:
- Authentication flow (accounts → customer)
- Shopping flow (catalogue → basket → checkout → order)
- Payment processing flow (checkout → payment gateway)

b) Data Flow:
- Product management (catalogue → partner)
- Order processing (basket → order → shipping)
- Customer management (accounts → customer → address)

##### Design Elements

Use these visual elements:

- Blue: Frontend components
- Green: Backend services
- Yellow: Database
- Red: External services/APIs

- Rectangles: Core components
- Hexagons: API endpoints

##### Implementation Details

a) Django Apps Structure:
- Core apps (accounts, catalogue, order)
- Supporting apps (shipping, voucher)
- Admin interface (dashboard)

b) Static Asset Management:
- Media files (media/)
- Static files (static/)
- Template structure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Legend"
        L1[Frontend Component]:::frontend
        L2[Backend Service]:::backend
        L3[(Database)]:::database
        L4{API Endpoint}:::api
        L5[External Service]:::external
    end

    subgraph "Frontend Layer"
        WebTemp["Website Templates"]:::frontend
        DashUI["Dashboard Interface"]:::frontend
        CustUI["Customer Interface"]:::frontend
        StaticAssets["Static Assets"]:::frontend
        
        subgraph "Static Resources"
            CSS["CSS Files"]:::frontend
            JS["JavaScript Files"]:::frontend
            Images["Image Files"]:::frontend
            Fonts["Font Files"]:::frontend
        end
    end

    subgraph "Backend Layer"
        subgraph "Core Services"
            Accounts["Accounts Service"]:::backend
            Catalogue["Catalogue Service"]:::backend
            Order["Order Service"]:::backend
            Basket["Basket Service"]:::backend
            Checkout["Checkout Service"]:::backend
            Customer["Customer Service"]:::backend
            Voucher["Voucher Service"]:::backend
            Shipping["Shipping Service"]:::backend
        end

        subgraph "API Layer"
            CatalogueAPI{"Catalogue API"}:::api
            CustomerAPI{"Customer API"}:::api
            Serializers["API Serializers"]:::backend
            APIViews["API Views"]:::backend
        end
    end

    subgraph "Database Layer"
        DB[(PostgreSQL)]:::database
        MediaStorage["Media Storage"]:::database
    end

    subgraph "External Services"
        Email["Email Service"]:::external
        Payment["Payment Gateway"]:::external
    end

    %% Relationships
    WebTemp --> Catalogue
    DashUI --> Catalogue
    CustUI --> Customer
    StaticAssets --> |Serves| CSS & JS & Images & Fonts

    Accounts --> DB
    Catalogue --> DB
    Order --> DB
    Basket --> DB
    Customer --> DB
    Voucher --> DB
    Shipping --> DB

    Catalogue --> CatalogueAPI
    Customer --> CustomerAPI
    CatalogueAPI & CustomerAPI --> Serializers
    Serializers --> APIViews

    Basket --> Checkout
    Checkout --> Payment
    Checkout --> Order
    Order --> Shipping
    Customer --> Email

    %% Click Events
    click WebTemp "https://github.com/taruntyagi1/Insta/tree/master/templates/website/"
    click DashUI "https://github.com/taruntyagi1/Insta/tree/master/dashboard/"
    click CustUI "https://github.com/taruntyagi1/Insta/tree/master/customer/templates/customer/"
    click StaticAssets "https://github.com/taruntyagi1/Insta/tree/master/static/"
    click CSS "https://github.com/taruntyagi1/Insta/tree/master/static/css/"
    click JS "https://github.com/taruntyagi1/Insta/tree/master/static/js/"
    click Images "https://github.com/taruntyagi1/Insta/tree/master/static/images/"
    click Fonts "https://github.com/taruntyagi1/Insta/tree/master/static/fonts/"
    click Accounts "https://github.com/taruntyagi1/Insta/tree/master/accounts/"
    click Catalogue "https://github.com/taruntyagi1/Insta/tree/master/catalogue/"
    click Order "https://github.com/taruntyagi1/Insta/tree/master/order/"
    click Basket "https://github.com/taruntyagi1/Insta/tree/master/basket/"
    click Checkout "https://github.com/taruntyagi1/Insta/tree/master/checkout/"
    click Customer "https://github.com/taruntyagi1/Insta/tree/master/customer/"
    click Voucher "https://github.com/taruntyagi1/Insta/tree/master/voucher/"
    click Shipping "https://github.com/taruntyagi1/Insta/tree/master/shipping/"
    click CatalogueAPI "https://github.com/taruntyagi1/Insta/tree/master/catalogue/api/v1/"
    click CustomerAPI "https://github.com/taruntyagi1/Insta/tree/master/customer/api/v1/"
    click MediaStorage "https://github.com/taruntyagi1/Insta/tree/master/media/"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
```
