# giant-heart/recipes architecture

> Architecture diagram of the GitHub repository giant-heart/recipes, 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/giant-heart/recipes
- Repository: https://github.com/giant-heart/recipes

## Overview

##### Main Components

a) User Interface Layer:
- Command Palette (central control mechanism)
- Multiple Writing Surfaces (markdown, poem, plain)
- Help Screen
- Editor Screen

b) Core Application Logic:
- Recipe Engine (manages writing guides)
- State Management
- Storage Handler

c) External Integration:
- File System Interface
- Configuration Management

**┌─ UI Components ─────────────────────┐**
- ┌─────────┐ ┌────────┐ ┌─────────┐ │
- Command │ │Writing │ │  Help   │ │
- Palette │ │Surface │ │ Screen  │ │
- ┘ └────────┘ └─────────┘ │
- ┘

**┌─ Core Logic ──────────────────────┐**
- ┌─────────┐ ┌────────┐           │
- Recipe  │ │ State  │           │
- Engine  │ │Manager │           │
- ┘ └────────┘           │
- ┘

**┌─ Storage & Configuration ─────────┐**
- ┌─────────┐ ┌────────────────┐   │
- File   │ │ Configuration  │   │
- System  │ │   Manager     │   │
- ┘ └────────────────┘   │
- ┘

##### Important Relationships

- Command flow from Command Palette to Recipe Engine
- Data flow between State Manager and UI Components
- Storage operations between Core Logic and Storage Layer
- Configuration loading path

##### Technical Stack Indicators

Technology labels:
- ClojureScript as the primary language
- npm for package management
- Local file system integration
- Custom EDN configuration format

##### Key Design Patterns to Highlight

- Component-based architecture (shown in src/components structure)
- Interface-based design (shown in display and surface interfaces)
- State management pattern
- Export strategy pattern

Remember to:
- Keep the main flow clear and visible
- Version/date information
- Notes about configuration paths

- The inability to edit (write-only nature)
- The recipe-driven writing process
- The export-centric workflow
- The keyboard-based navigation system

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#e67e22,stroke:#d35400,color:white
    classDef display fill:#9b59b6,stroke:#8e44ad,color:white
    classDef surface fill:#1abc9c,stroke:#16a085,color:white
    classDef export fill:#f1c40f,stroke:#f39c12,color:black

    %% UI Layer
    subgraph UI
        CP["Command Palette"]:::ui
        HS["Help Screen"]:::ui
        ES["Editor Screen"]:::ui
        UIC["UI Components"]:::ui
    end

    %% Display System
    subgraph DisplaySystem
        MD["Markdown Display"]:::display
        PD["Poem Display"]:::display
        MLD["Multi Line Display"]:::display
    end

    %% Writing Surfaces
    subgraph Surfaces
        MS["Markdown Surface"]:::surface
        PS["Poem Surface"]:::surface
        SLS["Single Line Surface"]:::surface
        MLS["Multi Line Surface"]:::surface
    end

    %% Core Logic
    subgraph Core
        RE["Recipe Engine"]:::core
        SM["State Manager"]:::core
    end

    %% Export System
    subgraph ExportSystem
        ME["Markdown Export"]:::export
        ORE["Org-Roam Export"]:::export
    end

    %% Storage Layer
    subgraph Storage
        SH["Storage Handler"]:::storage
        RC["Recipe Configuration"]:::storage
    end

    %% Relationships
    CP --> RE
    CP --> SM
    ES --> Surfaces
    Surfaces --> DisplaySystem
    RE --> SM
    SM --> UIC
    SM --> SH
    RE --> RC
    DisplaySystem --> ExportSystem
    SH --> ExportSystem

    %% Click Events
    click CP "https://github.com/giant-heart/recipes/blob/main/src/components/renders/command_palette.cljs"
    click HS "https://github.com/giant-heart/recipes/blob/main/src/components/renders/screens/help.cljs"
    click ES "https://github.com/giant-heart/recipes/blob/main/src/components/renders/screens/editor.cljs"
    click UIC "https://github.com/giant-heart/recipes/blob/main/src/components/ui.cljs"
    click MD "https://github.com/giant-heart/recipes/blob/main/src/components/displays/markdown.cljs"
    click PD "https://github.com/giant-heart/recipes/blob/main/src/components/displays/poem.cljs"
    click MLD "https://github.com/giant-heart/recipes/blob/main/src/components/displays/multi_line.cljs"
    click MS "https://github.com/giant-heart/recipes/blob/main/src/components/surfaces/markdown.cljs"
    click PS "https://github.com/giant-heart/recipes/blob/main/src/components/surfaces/poem.cljs"
    click SLS "https://github.com/giant-heart/recipes/blob/main/src/components/surfaces/single_line.cljs"
    click MLS "https://github.com/giant-heart/recipes/blob/main/src/components/surfaces/multi_line.cljs"
    click RE "https://github.com/giant-heart/recipes/blob/main/src/components/writing_recipes.cljs"
    click SM "https://github.com/giant-heart/recipes/blob/main/src/components/state.cljs"
    click ME "https://github.com/giant-heart/recipes/blob/main/src/components/exporters/markdown.cljs"
    click ORE "https://github.com/giant-heart/recipes/blob/main/src/components/exporters/org_roam.cljs"
    click SH "https://github.com/giant-heart/recipes/blob/main/src/components/storage/local_files.cljs"
    click RC "https://github.com/giant-heart/recipes/blob/main/recipes/recipes.edn"

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        CORE_L["Core Components"]:::core
        STORAGE_L["Storage Components"]:::storage
        DISPLAY_L["Display Components"]:::display
        SURFACE_L["Surface Components"]:::surface
        EXPORT_L["Export Components"]:::export
    end
```
