# imlukedewitt/abify architecture

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

- Interactive diagram: https://gitdiagram.com/imlukedewitt/abify
- Repository: https://github.com/imlukedewitt/abify

## Overview

##### Main Components

A. Apps-Script Layer
- Google Apps Script frontend interface
- Sheet/Spreadsheet handling components
- Server-side helpers and models

B. ABify Core
- Controllers for import operations
- Data source handlers
- Workflow engine
- Payload processors
- Model layer

C. Redis Layer
- Data persistence
- Caching layer
- Key-value store

**[Google Sheets Interface]**
- ↕
- [ABify Core]
- ↕
- [Redis Storage]

##### Detailed Component Breakdown

a) Top Layer (Apps-Script):
- Sub-components:
- Sheet Handler
- Spreadsheet Manager
- ABify Client
- Results Handler

b) Middle Layer (ABify Core):
- Major components:
- Importer Controller
- Data Sources (CSV, JSON)
- Workflow Engine
- Payload Processors
- Buffer Management
- Step Execution Engine

c) Bottom Layer (Redis):
- Include:
- Local Keystore
- Redis Client
- Data Persistence

##### Connection and Data Flow

- Bidirectional flow between Apps Script and ABify Core
- Data flow from Data Sources through the Workflow Engine
- Storage operations between ABify Core and Redis
- Callback handling paths

##### Technical Details

Annotations for:
- Ruby-based backend services
- Google Apps Script integration points
- Redis storage patterns
- API interaction points with Maxio AB

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#a8d1f0,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef storage fill:#FFE5B4,stroke:#000
    classDef workflow fill:#D8BFD8,stroke:#000
    classDef payload fill:#F0E68C,stroke:#000
    classDef data fill:#E6E6FA,stroke:#000

    %% Apps-Script Layer
    subgraph Apps
        GAS["Google Apps Script Interface"]
        SH["Sheet Handler"]
        SM["Spreadsheet Manager"]
        AC["ABify Client"]
        RH["Results Handler"]
    end

    %% ABify Core Layer
    subgraph Core
        IC["Importer Controller"]
        
        subgraph DataSources
            DS["Data Sources"]
            CSV["CSV Handler"]
            JSON["JSON Handler"]
        end
        
        subgraph WorkflowEngine
            WE["Workflow Engine"]
            CW["Customer Workflows"]
            SW["Subscription Workflows"]
            CPW["Component Workflows"]
        end
        
        subgraph PayloadProcessors
            PP["Payload Processors"]
            CP["Customer Payloads"]
            SP["Subscription Payloads"]
            CPP["Component Payloads"]
        end
        
        BM["Buffer Management"]
        SE["Step Execution Engine"]
    end

    %% Redis Layer
    subgraph Storage
        RL["Redis Storage Layer"]
        LK["Local Keystore"]
        RC["Redis Client"]
    end

    %% Connections
    GAS --> SH
    GAS --> SM
    GAS --> AC
    AC --> RH
    
    AC --> IC
    IC --> DS
    DS --> CSV
    DS --> JSON
    
    IC --> WE
    WE --> CW
    WE --> SW
    WE --> CPW
    
    WE --> PP
    PP --> CP
    PP --> SP
    PP --> CPP
    
    WE --> BM
    BM --> SE
    
    SE --> LK
    LK --> RC
    RC --> RL

    %% Click Events
    click GAS "https://github.com/imlukedewitt/abify/blob/main/Apps-Script/app.js"
    click SH "https://github.com/imlukedewitt/abify/blob/main/Apps-Script/server/models/sheet.js"
    click SM "https://github.com/imlukedewitt/abify/blob/main/Apps-Script/server/models/spreadsheet.js"
    click AC "https://github.com/imlukedewitt/abify/blob/main/Apps-Script/server/models/abify.js"
    click RH "https://github.com/imlukedewitt/abify/blob/main/Apps-Script/server/helpers/results-handler.js"
    click IC "https://github.com/imlukedewitt/abify/blob/main/ABify/controllers/importer_controller.rb"
    click DS "https://github.com/imlukedewitt/abify/tree/main/ABify/models/data_sources/"
    click WE "https://github.com/imlukedewitt/abify/blob/main/ABify/workflows/workflow.rb"
    click PP "https://github.com/imlukedewitt/abify/blob/main/ABify/payloads/payloads.rb"
    click BM "https://github.com/imlukedewitt/abify/blob/main/ABify/models/buffer_step.rb"
    click SE "https://github.com/imlukedewitt/abify/blob/main/ABify/models/step.rb"
    click RL "https://github.com/imlukedewitt/abify/blob/main/Redis/app.rb"
    click LK "https://github.com/imlukedewitt/abify/blob/main/ABify/db/local_keystore.rb"
    click RC "https://github.com/imlukedewitt/abify/blob/main/ABify/db/redis_client.rb"
    click CW "https://github.com/imlukedewitt/abify/tree/main/ABify/workflows/customers/"
    click SW "https://github.com/imlukedewitt/abify/tree/main/ABify/workflows/subscriptions/"
    click CPW "https://github.com/imlukedewitt/abify/tree/main/ABify/workflows/components/"
    click CP "https://github.com/imlukedewitt/abify/blob/main/ABify/payloads/customers.rb"
    click SP "https://github.com/imlukedewitt/abify/blob/main/ABify/payloads/subscriptions.rb"
    click CPP "https://github.com/imlukedewitt/abify/blob/main/ABify/payloads/components.rb"

    %% Style Applications
    class GAS,SH,SM,AC,RH frontend
    class IC,BM,SE core
    class DS,CSV,JSON data
    class WE,CW,SW,CPW workflow
    class PP,CP,SP,CPP payload
    class RL,LK,RC storage
```
