# alyssaxuu/flowy architecture

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

- Interactive diagram: https://gitdiagram.com/alyssaxuu/flowy
- Repository: https://github.com/alyssaxuu/flowy

## Overview

##### Main Components Identification
The system has two primary components:
- Core Engine (`/engine` directory)
- Demo Implementation (`/demo` directory)

**Start with the core engine components:**
**┌─────────────────────────────────────┐**
- Flowy Engine            │
- ┬─────────────────┤
- flowy.js      │    flowy.css    │
- (Core Logic)    │  (Styling)      │
- ┴─────────────────┘

**┌─────────────────────────────────────────────┐**
- Drag & Drop Engine             │
- ┬─────────────────┬────────────┤
- Block       │ Snapping        │ Canvas      │
- Management  │ System          │ Management  │
- ┴─────────────────┴────────────┘

**┌──────────────┐    ┌──────────────┐    ┌──────────────┐**
- User Input   │ -> │Block Creation│ -> │ Block        │
- (Drag & Drop) │    │& Positioning │    │ Relationship │
- ┘    └──────────────┘    └──────────────┘

##### Integration Points

How the library integrates with host applications:
**┌─────────────┐**
- Host App   │
- ┤
- Flowy Init  │ --> Canvas Element
- Callbacks   │ --> Block Elements
- ┘

##### Additional Notes

- The vanilla JavaScript nature (no dependencies)
- The simplicity of integration
- The event-driven architecture
- The separation of styling and logic

- All symbols used
- Line styles
- Component relationships

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Engine Layer"]
        Engine["Flowy Engine"]
        CoreLogic["Core Logic"]
        CoreStyle["Core Styling"]
        
        Engine --> CoreLogic
        Engine --> CoreStyle
    end
    
    subgraph Functional["Functional Components Layer"]
        DragDrop["Drag & Drop Engine"]
        BlockMgmt["Block Management"]
        Snapping["Snapping System"]
        Canvas["Canvas Management"]
        
        DragDrop --> BlockMgmt
        DragDrop --> Snapping
        DragDrop --> Canvas
    end
    
    subgraph DataFlow["Data Flow Layer"]
        UserInput["User Input"]
        BlockCreation["Block Creation & Positioning"]
        BlockRelation["Block Relationship"]
        
        UserInput --> BlockCreation
        BlockCreation --> BlockRelation
    end
    
    subgraph Integration["Integration Layer"]
        HostApp["Host Application"]
        FlowyInit["Flowy Initialization"]
        Callbacks["Event Callbacks"]
        
        HostApp --> FlowyInit
        HostApp --> Callbacks
    end
    
    subgraph Demo["Demo Implementation"]
        DemoUI["Demo Interface"]
        DemoLogic["Demo Logic"]
        DemoStyle["Demo Styling"]
        DemoAssets["Demo Assets"]
        
        DemoUI --> DemoLogic
        DemoUI --> DemoStyle
        DemoUI --> DemoAssets
    end
    
    Core --> Functional
    Functional --> DataFlow
    DataFlow --> Integration
    Integration --> Demo
    
    classDef core fill:#2374ab
    classDef functional fill:#48a9a6
    classDef dataflow fill:#e4572e
    classDef integration fill:#8f3985
    classDef demo fill:#17bebb
    
    class Core,Engine,CoreLogic,CoreStyle core
    class Functional,DragDrop,BlockMgmt,Snapping,Canvas functional
    class DataFlow,UserInput,BlockCreation,BlockRelation dataflow
    class Integration,HostApp,FlowyInit,Callbacks integration
    class Demo,DemoUI,DemoLogic,DemoStyle,DemoAssets demo
    
    click Engine "https://github.com/alyssaxuu/flowy/tree/master/engine"
    click CoreLogic "https://github.com/alyssaxuu/flowy/blob/master/engine/flowy.js"
    click CoreStyle "https://github.com/alyssaxuu/flowy/blob/master/engine/flowy.css"
    click DemoUI "https://github.com/alyssaxuu/flowy/blob/master/demo/index.html"
    click DemoLogic "https://github.com/alyssaxuu/flowy/blob/master/demo/main.js"
    click DemoStyle "https://github.com/alyssaxuu/flowy/blob/master/demo/styles.css"
    click DemoAssets "https://github.com/alyssaxuu/flowy/tree/master/demo/assets"
```
