# abduvik/wp-wix-clone architecture

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

- Interactive diagram: https://gitdiagram.com/abduvik/wp-wix-clone
- Repository: https://github.com/abduvik/wp-wix-clone

## Overview

##### Main Components Identification

The system consists of two main plugins working together:
- Wix Host Plugin (Management/Control Panel)
- Wix Client Plugin (Individual tenant instances)

##### Key Architectural Elements

A. Host Plugin Components:
- API Layer
- SingleLogin
- TenantsAuthKeys
- Core Services
- EncryptionService
- HttpService
- WPCSService (WordPress Core Services)
- WPCSTenant Management
- Features
- Tenant Subscription Management
- UI Components for Settings and Administration
- WooCommerce Integration

B. Client Plugin Components:
- API Layer
- SingleLogin
- Core Services
- DecryptionService
- HttpService
- Features
- Secure Host Connection
- Tenant Settings UI

**[Infrastructure Layer]**
- Docker Container
- Kubernetes (k8s)

**[Platform Layer]**
- WordPress Core
- WooCommerce
- WPCS (WordPress Core Services)

**[Application Layer]**
- Host Plugin
- API Components
- Core Services
- Feature Modules
- Client Plugin
- API Components
- Core Services
- Feature Modules

##### Key Relationships to Highlight

- Host-Client Communication:
- Encryption/decryption flow between host and client
- Single login mechanism
- Tenant authentication process

- Integration Points:
- WooCommerce checkout flow
- WPCS service connections
- Tenant subscription management

##### Development Environment

A separate section showing:
- Docker container structure
- File sync mechanism (fswatch/rsync)
- Build process flow

- Abbreviations used

This will create a comprehensive system design that accurately represents the WordPress-based SaaS clone architecture while maintaining clarity and usefulness for technical discussions.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef infrastructure fill:#b3d1ff,stroke:#333
    classDef platform fill:#b3ffb3,stroke:#333
    classDef host fill:#ffcc99,stroke:#333
    classDef client fill:#e6b3ff,stroke:#333
    classDef api fill:#ffe6b3,stroke:#333
    classDef feature fill:#ffb3b3,stroke:#333

    %% Infrastructure Layer
    subgraph Infrastructure
        Docker["Docker Container"]
        K8s["Kubernetes (k8s)"]
    end

    %% Platform Layer
    subgraph Platform
        WP["WordPress Core"]
        WC["WooCommerce"]
        WPCS["WPCS Services"]
    end

    %% Host Plugin
    subgraph HostPlugin["Host Plugin"]
        subgraph HostAPI["API Layer"]
            SL["SingleLogin"]:::api
            TAK["Tenants Auth Keys"]:::api
        end

        subgraph HostCore["Core Services"]
            ES["Encryption Service"]
            HS["Http Service"]
            WPCSS["WPCS Service"]
            WPCST["WPCS Tenant Management"]
        end

        subgraph HostFeatures["Features"]
            TSM["Tenant Subscription Management"]
            WCI["WooCommerce Integration"]
            WAS["WPCS Admin Settings"]
            ACS["Account Subscriptions UI"]
            WPV["WooCommerce WPCS Products"]
        end
    end

    %% Client Plugin
    subgraph ClientPlugin["Client Plugin"]
        subgraph ClientAPI["API Layer"]
            CSL["SingleLogin"]:::api
        end

        subgraph ClientCore["Core Services"]
            DS["Decryption Service"]
            CHS["Http Service"]
        end

        subgraph ClientFeatures["Features"]
            SHC["Secure Host Connection"]
            TSU["Tenant Settings UI"]
        end
    end

    %% Relationships
    Docker --> WP
    WP --> WC
    WP --> WPCS
    HostPlugin --> WP
    ClientPlugin --> WP
    ES --> DS
    SL --> CSL
    WPCSS --> WPCS
    WCI --> WC

    %% Click Events
    click SL "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Api/SingleLogin.php"
    click TAK "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Api/TenantsAuthKeys.php"
    click ES "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Core/EncryptionService.php"
    click HS "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Core/HttpService.php"
    click WPCSS "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Core/WPCSService.php"
    click WPCST "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Core/WPCSTenant.php"
    click TSM "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Features/TenantsSubscription.php"
    click WCI "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Features/UiWcTenantsCheckout.php"
    click WAS "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Features/UiWPCSAdminSettings.php"
    click ACS "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Features/UiAccountSubscriptionsSettings.php"
    click WPV "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-host/src/Features/UiWcWPCSProductVersions.php"
    click CSL "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-client/src/Api/SingleLogin.php"
    click DS "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-client/src/Core/DecryptionService.php"
    click CHS "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-client/src/Core/HttpService.php"
    click SHC "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-client/src/Features/SecureHostConnection.php"
    click TSU "https://github.com/abduvik/wp-wix-clone/blob/master/packages/wix-client/src/Features/UiWPCSAdminTenantSettings.php"
    click Docker "https://github.com/abduvik/wp-wix-clone/blob/master/docker-compose.yml"

    %% Legend
    subgraph Legend
        L1["Infrastructure"]:::infrastructure
        L2["Platform"]:::platform
        L3["Host Components"]:::host
        L4["Client Components"]:::client
        L5["API Components"]:::api
    end
```
