# dragonman225/jade architecture

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

- Interactive diagram: https://gitdiagram.com/dragonman225/jade
- Repository: https://github.com/dragonman225/jade

## Overview

##### Project type and purpose
- Jade is a client-side, canvas-based note-taking application shipped as both a web app and an Electron desktop app.
- Core purpose: allow users to create and connect “blocks” of content on a canvas, supporting rich text, embed tools, and conceptual relations.
- Plugin-first architecture: features (tools like text editor, image embed, search) are implemented as self-contained “factories.”

##### File structure
- Top‐level config: eslint, prettier, tsconfig, Webpack configs for web dev/prod and Electron.
- src/
- factories – Plug-ins (tools) that render various block types (ProseMirror text, Slate text, image, embeds, status bar, etc.) and implement their own styles, hooks, and utilities.
- platforms – Abstractions over persistence and runtime differences: web uses localStorage, Electron uses IPC+SQLite (better-sqlite3). Also startup scripts per platform.
- assets, initial-content, theme, env – static assets and initial data.
- No separate backend server: data is stored in the browser or local SQLite via Electron IPC.

##### Key points from README
- The app is experimental, focused on UX research around canvas interactions and plugin-first architecture.
- Two targets: web (demo) and Electron (desktop) – both share the same core code.
- Emphasis on exploring canvas APIs, rich text, and extensibility.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        CR["Canvas Renderer"]:::ui
        B["Block Component"]:::ui
        BD["BlockDriver"]:::ui
        BL["Block List"]:::ui
        AC["Arrow Component"]:::ui
        AL["Arrow List"]:::ui
        CD["Concept Driver"]:::ui
        CL["Concept Loader"]:::ui
        CMS["Context Menu Service"]:::ui
        CMB["Context Menu for Block"]:::ui
        CMR["Context Menu for Relation"]:::ui
    end

    %% Plugin Layer
    subgraph "Plugin Layer"
        HT["Header Toolbar (Factory)"]:::plugin
        PMT["PMText Factory"]:::plugin
        ST["SlateText Factory"]:::plugin
        IMG["Image Embed Factory"]:::plugin
        TWT["Tweet Embed Factory"]:::plugin
        IFT["Iframe Embed Factory"]:::plugin
        STL["Search Tool Factory"]:::plugin
        RT["Recent Items Tool Factory"]:::plugin
        IT["Insight Tool Factory"]:::plugin
        SB["Status Bar Factory"]:::plugin
    end

    %% State Store
    subgraph "State Store"
        ASC["App State Context"]:::state
        SYS["System Context"]:::state
        RA["Reducer & Actions"]:::state
        PS["PubSub Utility"]:::state
    end

    %% Persistence/Platform
    subgraph "Persistence/Platform"
        WP["Web Persistence (localStorage)"]:::persist
        IP["Electron IPC Boundary"]:::persist
        SQ["Electron SQLite Persistence"]:::persist
        OEW["openExternal (Web)"]:::persist
        OEE["openExternal (Electron)"]:::persist
    end

    %% Build & Dev Tools
    subgraph "Build & Dev Tools"
        WDEV["Webpack Web (dev/prod)"]:::build
        WELE["Webpack Electron"]:::build
        TSW["tsconfig.json"]:::build
        TSE["tsconfig.electron.json"]:::build
        PKG["CLI & Scripts"]:::build
    end

    %% Relationships
    CR -->|"dispatch Action"| RA
    B -->|"dispatch Action"| RA
    BD -->|"dispatch Action"| RA
    BL -->|"dispatch Action"| RA
    AC -->|"dispatch Action"| RA

    RA -->|"update Context"| ASC
    ASC -->|"provide state"| CR
    SYS -->|"provide system state"| CMS

    %% Plugins register with Canvas
    HT -->|"register"| CR
    PMT -->|"register"| CR
    ST -->|"register"| CR
    IMG -->|"register"| CR
    TWT -->|"register"| CR
    IFT -->|"register"| CR
    STL -->|"register"| CR
    RT -->|"register"| CR
    IT -->|"register"| CR
    SB -->|"register"| CR

    %% Persistence calls
    CR -->|"save/load"| WP
    CR -->|"save/load"| IP
    IP -->|"IPC call"| SQ

    %% External URL
    CMS -->|"open URL"| OEW
    CMS -->|"open URL"| OEE

    %% Build tools feeding into app
    WDEV --> CR
    WELE --> IP
    TSW --> CR
    TSE --> IP
    PKG --> WDEV
    PKG --> WELE

    %% Click Events
    click CR "https://github.com/dragonman225/jade/blob/main/src/core/components/CanvasBase.tsx"
    click B "https://github.com/dragonman225/jade/blob/main/src/core/components/Block.tsx"
    click BD "https://github.com/dragonman225/jade/blob/main/src/core/components/BlockDriver.tsx"
    click BL "https://github.com/dragonman225/jade/blob/main/src/core/components/BlockList.tsx"
    click AC "https://github.com/dragonman225/jade/blob/main/src/core/components/Arrow.tsx"
    click AL "https://github.com/dragonman225/jade/blob/main/src/core/components/ArrowList.tsx"
    click CD "https://github.com/dragonman225/jade/blob/main/src/core/components/ConceptDriver.tsx"
    click CL "https://github.com/dragonman225/jade/blob/main/src/core/components/ConceptLoader.tsx"
    click CMS "https://github.com/dragonman225/jade/blob/main/src/core/components/ContextMenu/ContextMenu.tsx"
    click CMB "https://github.com/dragonman225/jade/blob/main/src/core/components/ContextMenu/ContextMenuForBlock.tsx"
    click CMR "https://github.com/dragonman225/jade/blob/main/src/core/components/ContextMenu/ContextMenuForRelation.tsx"
    click HT "https://github.com/dragonman225/jade/blob/main/src/factories/HeaderTool/index.tsx"
    click PMT "https://github.com/dragonman225/jade/blob/main/src/factories/PMText/index.tsx"
    click ST "https://github.com/dragonman225/jade/blob/main/src/factories/SlateText/index.tsx"
    click IMG "https://github.com/dragonman225/jade/blob/main/src/factories/Image/index.tsx"
    click TWT "https://github.com/dragonman225/jade/blob/main/src/factories/Embed/Tweet.tsx"
    click IFT "https://github.com/dragonman225/jade/blob/main/src/factories/Embed/Iframe.tsx"
    click STL "https://github.com/dragonman225/jade/blob/main/src/factories/SearchTool/index.tsx"
    click RT "https://github.com/dragonman225/jade/blob/main/src/factories/RecentTool/index.tsx"
    click IT "https://github.com/dragonman225/jade/blob/main/src/factories/InsightTool/index.tsx"
    click SB "https://github.com/dragonman225/jade/blob/main/src/factories/Status/index.tsx"
    click ASC "https://github.com/dragonman225/jade/blob/main/src/core/store/appStateContext.ts"
    click SYS "https://github.com/dragonman225/jade/blob/main/src/core/store/systemContext.ts"
    click RA "https://github.com/dragonman225/jade/blob/main/src/core/store/reducer.ts"
    click PS "https://github.com/dragonman225/jade/blob/main/src/core/utils/pubsub.ts"
    click WP "https://github.com/dragonman225/jade/blob/main/src/platforms/web/db-localstorage.ts"
    click IP "https://github.com/dragonman225/jade/blob/main/src/platforms/electron/ipc.ts"
    click SQ "https://github.com/dragonman225/jade/blob/main/src/platforms/electron/db-sqlite3.ts"
    click OEW "https://github.com/dragonman225/jade/blob/main/src/platforms/web/openExternal.ts"
    click OEE "https://github.com/dragonman225/jade/blob/main/src/platforms/electron/openExternal.ts"
    click WDEV "https://github.com/dragonman225/jade/blob/main/webpack.config.web.dev.js"
    click WELE "https://github.com/dragonman225/jade/blob/main/webpack.config.electron.js"
    click TSW "https://github.com/dragonman225/jade/blob/main/tsconfig.json"
    click TSE "https://github.com/dragonman225/jade/blob/main/tsconfig.electron.json"
    click PKG "https://github.com/dragonman225/jade/blob/main/package.json"

    %% Styles
    classDef ui fill:#D0E6FF,stroke:#004080,stroke-width:1px
    classDef plugin fill:#E6FFE6,stroke:#006600,stroke-width:1px
    classDef state fill:#FFE6CC,stroke:#CC6600,stroke-width:1px
    classDef persist fill:#F0E6FF,stroke:#660099,stroke-width:1px
    classDef build fill:#E0E0E0,stroke:#404040,stroke-width:1px
```
