# tajo/ladle architecture

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

- Interactive diagram: https://gitdiagram.com/tajo/ladle
- Repository: https://github.com/tajo/ladle

## Overview

##### Main Components

a) Core Application Layer
- Development Server (Vite-based)
- Build System
- CLI Interface
- Story Management System

b) Feature Modules
- Addon System
- Testing Infrastructure
- MSW Integration
- Configuration Management

##### Architecture Representation

**┌─────────────────────────────────────────────────────────┐**
- Ladle Platform                       │

- ┌─────────────┐    ┌──────────────┐   ┌──────────┐   │
- CLI Layer │    │  Dev Server  │   │  Build   │   │
- Interface  │───▶│  (Vite-based)│──▶│ System   │   │
- ┘    └──────────────┘   └──────────┘   │
- ▲                  ▲               ▲          │

- ┌─────────────────────────────────────────────────┐  │
- Story Management System            │  │
- ┘  │
- ▲                  ▲               ▲          │

- ┌──────────┐    ┌─────────────────┐  ┌──────────┐   │
- Addons  │    │    Testing      │  │   MSW    │   │
- System  │    │ Infrastructure  │  │ Support  │   │
- ┘    └─────────────────┘  └──────────┘   │

- ┘

##### Important Relationships to Highlight

a) Data Flow:
- Story files → Story Management System → Dev Server
- CLI commands → Build System
- Addons → Story Management System
- Testing Infrastructure → Story Management System

b) Integration Points:
- MSW integration with Story Management
- Addon system hooks into core components
- Configuration system affects all components

##### Implementation Details

- Vite-based architecture
- React component rendering pipeline
- Story file discovery and processing
- Configuration management system
- Testing infrastructure integration

##### Additional Elements

- Story file processing pipeline
- Addon system architecture
- Build process flow
- Testing infrastructure

Remember to:
- Use consistent naming conventions
- Version compatibility information
- Document key configuration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Platform["Ladle Platform"]
        subgraph CoreLayer["Core Application Layer"]
            CLI["CLI Interface"]:::core
            DevServer["Development Server"]:::core
            BuildSys["Build System"]:::core
            App["Core Application"]:::core
        end

        subgraph StoryLayer["Story Management Layer"]
            SMS["Story Management System"]:::story
            StoryProc["Story Processing Pipeline"]:::story
        end

        subgraph FeatureLayer["Feature Modules"]
            Addons["Addon System"]:::addon
            Testing["Testing Infrastructure"]:::testing
            MSW["MSW Integration"]:::support
            Config["Configuration Management"]:::support
        end

        %% Core Layer Relationships
        CLI --> DevServer
        DevServer --> BuildSys
        DevServer --> App
        
        %% Story Management Relationships
        StoryProc --> SMS
        SMS --> DevServer
        SMS --> App
        
        %% Feature Module Relationships
        Addons --> SMS
        Testing --> SMS
        MSW --> SMS
        Config --> CoreLayer
        Config --> StoryLayer
    end

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef story fill:#2ecc71,stroke:#27ae60,color:white
    classDef addon fill:#e67e22,stroke:#d35400,color:white
    classDef testing fill:#9b59b6,stroke:#8e44ad,color:white
    classDef support fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Click Events
    click CLI "https://github.com/tajo/ladle/blob/main/packages/ladle/lib/cli/cli.js"
    click BuildSys "https://github.com/tajo/ladle/blob/main/packages/ladle/lib/cli/build.js"
    click DevServer "https://github.com/tajo/ladle/blob/main/packages/ladle/lib/cli/vite-dev.js"
    click SMS "https://github.com/tajo/ladle/blob/main/packages/ladle/lib/cli/vite-plugin/generate/get-story-list.js"
    click Addons "https://github.com/tajo/ladle/tree/main/packages/ladle/lib/app/src/addons/"
    click MSW "https://github.com/tajo/ladle/blob/main/packages/ladle/lib/app/src/msw.tsx"
    click Config "https://github.com/tajo/ladle/blob/main/packages/ladle/lib/shared/default-config.js"
    click Testing "https://github.com/tajo/ladle/tree/main/e2e/playwright/"
    click StoryProc "https://github.com/tajo/ladle/tree/main/packages/ladle/lib/cli/vite-plugin/parse/"
    click App "https://github.com/tajo/ladle/blob/main/packages/ladle/lib/app/src/app.tsx"

    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        StoryComp["Story Management"]:::story
        AddonComp["Addon Component"]:::addon
        TestComp["Testing Component"]:::testing
        SupportComp["Support Component"]:::support
    end
```
