# programming-paradox/amazon architecture

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

- Interactive diagram: https://gitdiagram.com/programming-paradox/amazon
- Repository: https://github.com/programming-paradox/amazon

## Overview

##### Main Components

A. Frontend Layer:
- Static Files Component (CSS, JS, Images)
- Template Layer (Django Templates)
- User Interface Components:
- Home Interface
- Shop Interface
- Cart Interface
- Blog Interface
- Authentication Interfaces

B. Backend Layer:
- Django Applications:
- Home App (Main application)
- Shop App (Product management)
- Cart App (Shopping cart functionality)
- Blog App
- Phone Verification App

C. Database Layer:
- PostgreSQL Database
- Model Relationships:
- Products
- Orders
- Users
- Cart Items
- Wishlists
- SMS Verification

**[Client Layer] → [Application Layer] → [Data Layer]**

##### Component Relationships to Highlight

- Authentication flow
- Shopping flow
- Cart management
- Order processing
- Phone verification flow

##### Core Framework Layer
**[Django Core (Amazon Project)]**
- ↓
**[URL Routing (urls.py)]**
- ↓
**[Settings & Configurations]**

##### Application Modules
**[Home App] ← → [Shop App] ← → [Cart App]**
- ↕            ↕              ↕
**[Templates] → [Views] → [Models] → [Database]**

##### Authentication Flow
**[User Interface] → [Phone Verify App] → [SMS Service]**
- ↓
**[Authentication] → [User Management]**

##### Important Elements

- Static File Management
- Media File Handling
- Template Inheritance Structure
- Database Models and Relationships
- Authentication Flow
- Shopping Cart System
- Order Management
- Product Catalog
- Search Functionality
- Phone Verification System

##### Technical Details to Note

- Django MTV (Model-Template-View) pattern
- Custom user authentication with phone verification
- Shopping cart implementation
- Product filtering system
- Order tracking system
- Wishlist functionality
- Static and media file handling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client_Layer
        UI["User Interface"]:::frontend
        Static["Static Files"]:::frontend
        click Static "https://github.com/programming-paradox/Amazon/tree/main/static/home"
        Templates["Template Layer"]:::frontend
        click Templates "https://github.com/programming-paradox/Amazon/tree/main/templates"
        
        subgraph UI_Components
            HomeUI["Home Interface"]:::frontend
            click HomeUI "https://github.com/programming-paradox/Amazon/tree/main/templates/home"
            ShopUI["Shop Interface"]:::frontend
            click ShopUI "https://github.com/programming-paradox/Amazon/tree/main/templates/Shop"
            CartUI["Cart Interface"]:::frontend
            click CartUI "https://github.com/programming-paradox/Amazon/blob/main/templates/Shop/cart.html"
            AuthUI["Authentication Interface"]:::frontend
            click AuthUI "https://github.com/programming-paradox/Amazon/blob/main/templates/home/login.html"
            BlogUI["Blog Interface"]:::frontend
        end
    end

    subgraph Application_Layer
        Django["Django Core (Amazon)"]:::backend
        click Django "https://github.com/programming-paradox/Amazon/blob/main/Amazon/settings.py"
        
        subgraph Apps
            HomeApp["Home App"]:::backend
            click HomeApp "https://github.com/programming-paradox/Amazon/tree/main/Home"
            ShopApp["Shop App"]:::backend
            click ShopApp "https://github.com/programming-paradox/Amazon/tree/main/Shop"
            CartApp["Cart App"]:::backend
            click CartApp "https://github.com/programming-paradox/Amazon/tree/main/cart"
            BlogApp["Blog App"]:::backend
            click BlogApp "https://github.com/programming-paradox/Amazon/tree/main/Blog"
            PhoneVerify["Phone Verification App"]:::backend
            click PhoneVerify "https://github.com/programming-paradox/Amazon/tree/main/phone_verify"
        end
        
        subgraph Core_Components
            URLs["URL Routing"]:::backend
            click URLs "https://github.com/programming-paradox/Amazon/blob/main/Amazon/urls.py"
            Settings["Settings & Config"]:::backend
            ProductFilter["Product Filtering"]:::backend
            click ProductFilter "https://github.com/programming-paradox/Amazon/blob/main/Shop/filters.py"
        end
    end

    subgraph Data_Layer
        DB[(PostgreSQL Database)]:::database
        
        subgraph Models
            ProductsDB["Products"]:::database
            OrdersDB["Orders"]:::database
            UsersDB["Users"]:::database
            CartDB["Cart Items"]:::database
            WishlistDB["Wishlists"]:::database
            SMSDB["SMS Verification"]:::database
        end
    end

    %% External Services
    SMS["SMS Service"]:::external

    %% Relationships
    UI --> Templates
    UI --> Static
    Templates --> Apps
    HomeApp --> DB
    ShopApp --> DB
    CartApp --> DB
    BlogApp --> DB
    PhoneVerify --> SMS
    PhoneVerify --> DB
    Django --> URLs
    Django --> Settings
    ShopApp --> ProductFilter

    %% 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 external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        Database["Database Component"]:::database
        External["External Service"]:::external
    end
```
