# b2storefront/connector architecture

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

- Interactive diagram: https://gitdiagram.com/b2storefront/connector
- Repository: https://github.com/b2storefront/connector

## Overview

##### Main Components

a. Core Integration Layer
- Represented by the root-level 'connectors' directory
- Bigcommerce.js and shopify.js as primary connector interfaces

- Shopify Module
- Admin API
- Bulk API
- GraphQL Queries (Products, Collections, Redirections)
- BigCommerce Module
- Oro Commerce Module
- Admin API
- MySQL Integration
- Strapi CMS Module
- ReviewsIO Module
- Bitbucket Integration

c. Helper Services Layer
- URL Generation Service
- Platform Resolution Service
- Webhook Handler
- Draft Mode Manager
- Category Management
- Slugification Service

##### Relationship Flows

- Helper services connected to both connectors and platform sources
- Webhook flows from external platforms to the webhook handler

##### Architecture Patterns to Highlight

- Adapter Pattern: Show how connectors standardize different platform interfaces
- Service Layer Pattern: Demonstrate helper services as a separate architectural layer
- API Integration Pattern: Illustrate different API types (REST, GraphQL, Bulk) for each platform

##### Specific Implementation Details

Create sections showing:
- Query Management for Shopify
- Authentication flows for each platform
- Data transformation pipelines
- Platform-specific helper utilities

##### External Dependencies

Connections to:
- E-commerce platforms (Shopify, BigCommerce)
- CMS systems (Strapi)
- Version control (Bitbucket)
- Review systems (ReviewsIO)

##### The centralized management of platform-specific logic

Remember to:
- Keep platform-specific implementations visually grouped
- Clear boundaries between internal and external services
- Version or environment indicators where relevant
- Document any rate limiting or quota considerations

This architecture appears to be designed for flexibility and extensibility, allowing easy addition of new platforms while maintaining a consistent interface through the connector layer.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Integration Layer"]
        BC["BigCommerce Connector"]
        SH["Shopify Connector"]
    end

    subgraph Platforms["Platform Sources"]
        direction TB
        subgraph ShopifyPlatform["Shopify"]
            SHIM["Shopify Implementation"]
            SHADM["Admin API"]
            SHBULK["Bulk API"]
            SHGQL["GraphQL Queries"]
        end

        subgraph OtherPlatforms["Other Platforms"]
            BCIM["BigCommerce Implementation"]
            ORIM["Oro Commerce Implementation"]
            ORADM["Oro Admin API"]
            ORMYSQL["Oro MySQL"]
            STRAPI["Strapi CMS"]
            REVIEW["ReviewsIO"]
            BITBUCKET["Bitbucket"]
        end
    end

    subgraph Helpers["Helper Services"]
        URL["URL Generator"]
        PRES["Platform Resolver"]
        WEBHOOK["Webhook Handler"]
        DRAFT["Draft Mode Manager"]
        CAT["Category Management"]
        SLUG["Slugification Service"]
    end

    subgraph Queries["Shopify Queries"]
        COLQ["Collections Query"]
        PRODQ["Products Query"]
        REDQ["Redirections Query"]
    end

    subgraph PlatformHelpers["Platform Helpers"]
        SHHELP["Shopify Helper"]
        ORHELP["Oro Helpers"]
    end

    %% Core to Platform connections
    BC --> BCIM
    SH --> SHIM

    %% Shopify internal connections
    SHIM --> SHADM
    SHIM --> SHBULK
    SHIM --> SHGQL
    SHGQL --> COLQ
    SHGQL --> PRODQ
    SHGQL --> REDQ
    SHIM --> SHHELP

    %% Oro internal connections
    ORIM --> ORADM
    ORIM --> ORMYSQL
    ORIM --> ORHELP

    %% Helper connections
    Core --> Helpers
    Platforms --> Helpers

    %% Click events for component mapping
    click BC "https://github.com/b2storefront/connector/blob/main/connectors/bigcommerce.js"
    click SH "https://github.com/b2storefront/connector/blob/main/connectors/shopify.js"
    click SHIM "https://github.com/b2storefront/connector/blob/main/sources/shopify/shopify.js"
    click SHADM "https://github.com/b2storefront/connector/blob/main/sources/shopify/shopify-admin-api.js"
    click SHBULK "https://github.com/b2storefront/connector/blob/main/sources/shopify/shopify-bulk-api.js"
    click SHGQL "https://github.com/b2storefront/connector/tree/main/sources/shopify/queries"
    click BCIM "https://github.com/b2storefront/connector/blob/main/sources/bigcommerce/bigcommerce.js"
    click ORIM "https://github.com/b2storefront/connector/blob/main/sources/oro/oro.js"
    click ORADM "https://github.com/b2storefront/connector/blob/main/sources/oro/oro-admin-api.js"
    click ORMYSQL "https://github.com/b2storefront/connector/blob/main/sources/oro/oro-mysql.js"
    click STRAPI "https://github.com/b2storefront/connector/blob/main/sources/strapi/strapi.js"
    click REVIEW "https://github.com/b2storefront/connector/blob/main/sources/reviewsio/reviewsio.js"
    click BITBUCKET "https://github.com/b2storefront/connector/blob/main/sources/bitbucket/bitbucket.js"
    click URL "https://github.com/b2storefront/connector/blob/main/helpers/generate-url.js"
    click PRES "https://github.com/b2storefront/connector/blob/main/helpers/platform-resolver.js"
    click WEBHOOK "https://github.com/b2storefront/connector/blob/main/helpers/webhooks.js"
    click DRAFT "https://github.com/b2storefront/connector/blob/main/helpers/draft-mode.js"
    click CAT "https://github.com/b2storefront/connector/blob/main/helpers/bigcommerce/category-helper.js"
    click SLUG "https://github.com/b2storefront/connector/blob/main/helpers/slugify.js"
    click COLQ "https://github.com/b2storefront/connector/blob/main/sources/shopify/queries/collections.js"
    click PRODQ "https://github.com/b2storefront/connector/blob/main/sources/shopify/queries/products.js"
    click REDQ "https://github.com/b2storefront/connector/blob/main/sources/shopify/queries/redirections.js"
    click SHHELP "https://github.com/b2storefront/connector/blob/main/sources/shopify/shopify-helper.js"
    click ORHELP "https://github.com/b2storefront/connector/blob/main/sources/oro/oro-helpers.js"

    classDef core fill:#2374ab
    classDef platform fill:#48a9a6
    classDef helper fill:#f4d03f
    classDef query fill:#9b59b6
    classDef platformHelper fill:#95a5a6

    class BC,SH core
    class SHIM,SHADM,SHBULK,SHGQL,BCIM,ORIM,ORADM,ORMYSQL,STRAPI,REVIEW,BITBUCKET platform
    class URL,PRES,WEBHOOK,DRAFT,CAT,SLUG helper
    class COLQ,PRODQ,REDQ query
    class SHHELP,ORHELP platformHelper
```
