# tomatophp/filament-ecommerce architecture

> Architecture diagram of the GitHub repository tomatophp/filament-ecommerce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tomatophp/filament-ecommerce
- Repository: https://github.com/tomatophp/filament-ecommerce

## Overview

##### Project Type and Purpose
This is a Laravel-based e-commerce plugin for FilamentPHP, designed to provide a complete e-commerce solution with extensive features including product management, order processing, and various payment methods.

##### Main Components

Core Components:
- Admin Panel (FilamentPHP Interface)
- Product Management System
- Order Management System
- Company/Branch Management
- Shipping Management
- Payment Processing System
- Authentication & Authorization (Filament Shield)

Supporting Services:
- Media Library (Spatie)
- Settings Management
- Coupon Service
- Gift Card Service
- Referral System

**┌─ Presentation Layer ─────────────────────┐**
- FilamentPHP Admin Interface           │
- Resource Pages                        │
- Widgets & Charts                      │
- Business Logic Layer ────────────────────┤
- ┌─ Core Services ─┐ ┌─ Support Services ┐│
- Products     │ │ - Coupons         ││
- Orders       │ │ - Gift Cards      ││
- Shipping     │ │ - Referrals       ││
- ┘ └─────────────────────┘│
- Data Access Layer ────────────────────────┤
- Eloquent Models                        │
- Database Migrations                    │
- ┘

##### Key Relationships

- Relationships between Products and Orders
- Connection between Shipping Vendors and Orders
- Integration points with external services (Media Library, Settings)

##### Implementation Details

Use these symbols:
- Rectangles: Main components
- Hexagons: Services
- Diamonds: Decision points in workflows

##### Additional Elements

A separate section showing:
- Settings management flow
- Order processing pipeline
- Product variant handling
- Media management integration

Remember to:
- Keep the main workflow clear and centered
- Related functionality together
- Clear boundaries between different subsystems
- Notes for important configuration options

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Presentation Layer"
        AdminInterface["FilamentPHP Admin Interface"]:::ui
        ResourcePages["Resource Pages"]:::ui
        Widgets["Widgets & Charts"]:::ui
    end

    subgraph "Business Logic Layer"
        subgraph "Core Services"
            Products["Product Management"]:::core
            Orders["Order Management"]:::core
            Shipping["Shipping Management"]:::core
            Companies["Company/Branch Management"]:::core
            Cart["Cart System"]:::core
        end

        subgraph "Support Services"
            Coupons["Coupon Service"]:::support
            GiftCards["Gift Card Service"]:::support
            Referrals["Referral System"]:::support
        end

        subgraph "Analytics Services"
            OrderAnalytics["Order Analytics"]:::analytics
            PaymentAnalytics["Payment Analytics"]:::analytics
            SourceAnalytics["Source Analytics"]:::analytics
        end
    end

    subgraph "Data Access Layer"
        Models[(Eloquent Models)]:::data
        Migrations[(Database Migrations)]:::data
    end

    %% Relationships
    AdminInterface --> Products
    AdminInterface --> Orders
    AdminInterface --> Companies
    AdminInterface --> Shipping
    
    Products --> Models
    Orders --> Models
    Companies --> Models
    Shipping --> Models
    Cart --> Models
    
    Coupons --> Orders
    GiftCards --> Orders
    Referrals --> Orders
    
    Orders --> OrderAnalytics
    Orders --> PaymentAnalytics
    Orders --> SourceAnalytics

    %% Click Events
    click Products "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/ProductResource.php"
    click Orders "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/OrderResource.php"
    click Companies "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/CompanyResource.php"
    click Shipping "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/ShippingVendorResource.php"
    click Cart "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/CartResource.php"
    click Coupons "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/CouponResource.php"
    click GiftCards "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/GiftCardResource.php"
    click Referrals "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Resources/ReferralCodeResource.php"
    click OrderAnalytics "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Widgets/OrderStateChart.php"
    click PaymentAnalytics "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Widgets/OrderPaymentMethodChart.php"
    click SourceAnalytics "https://github.com/tomatophp/filament-ecommerce/blob/master/src/Filament/Widgets/OrderSourceChart.php"

    %% Styles
    classDef ui fill:#6366f1,color:white
    classDef core fill:#3b82f6,color:white
    classDef support fill:#22c55e,color:white
    classDef analytics fill:#f59e0b,color:white
    classDef data fill:#64748b,color:white

    %% Legend
    subgraph Legend
        UI["UI Components"]:::ui
        Core["Core Services"]:::core
        Support["Support Services"]:::support
        Analytics["Analytics"]:::analytics
        Data["Data Storage"]:::data
    end
```
