# heyman/heynote architecture

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

## Overview

##### Main Components

a) Application Layer:
- Electron Main Process
- Electron Renderer Process
- IPC Communication Bridge

b) Frontend Components:
- Vue.js Application Core
- Editor Components
- Settings Interface
- Buffer Management

c) Core Services:
- Language Detection Service
- Formatting Service
- Math/Calculator Service
- Currency Conversion Service
- File System Integration

**┌─ Desktop Application (Electron Container) ─────────────────────┐**

- ┌─ Main Process ──┐         ┌─ Renderer Process ─────────┐  │

- Auto Updates  │         │    ┌─ Vue.js App ───────┐  │  │
- File System   │◄──IPC──►│    │                    │  │  │
- Menu Handling │         │    │  - Components      │  │  │
- Window Mgmt   │         │    │  - Stores          │  │  │
- ┘         │    │  - Router          │  │  │
- ┘  │  │

- ┌─ Editor Core ───────┐ │  │
- CodeMirror       │ │  │
- Language Support │ │  │
- Themes          │ │  │
- ┘ │  │
- ┘  │
- ┘

##### Key Elements to Highlight

a) Process Communication:
- IPC (Inter-Process Communication) between main and renderer processes
- File system interactions
- Store management flow

b) Editor Features:
- Language detection workflow
- Syntax highlighting system
- Block management
- Math/Currency processing

c) Data Flow:
- File saving/loading
- Settings management
- Buffer synchronization

##### Implementation Details

- Numbered annotations for complex workflows

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Desktop["Desktop Application - Electron Container"]
        subgraph Main["Main Process"]
            MainProcess["Electron Main Process"]:::main
            AutoUpdate["Auto Update System"]:::main
            FileSystem["File System Integration"]:::main
            MenuHandler["Menu Handler"]:::main
        end

        subgraph Renderer["Renderer Process"]
            subgraph VueApp["Vue.js Application"]
                AppCore["Vue.js App Core"]:::vue
                Settings["Settings Interface"]:::vue
                BufferSelector["Buffer Selector"]:::vue
                Store["Store Management"]:::vue
            end

            subgraph Editor["Editor Core"]
                EditorCore["CodeMirror Integration"]:::editor
                BlockMgmt["Block Management"]:::editor
                ThemeMgmt["Theme Management"]:::editor
            end

            subgraph Services["Core Services"]
                LangDetect["Language Detection"]:::service
                Formatter["Formatting Service"]:::service
                Calculator["Math Calculator"]:::service
                Currency["Currency Converter"]:::service
            end
        end

        IPC["IPC Bridge"]:::communication
    end

    %% Connections
    MainProcess <--> IPC
    IPC <--> AppCore
    AppCore --> Settings
    AppCore --> BufferSelector
    AppCore --> Store
    AppCore --> EditorCore
    EditorCore --> BlockMgmt
    EditorCore --> ThemeMgmt
    EditorCore --> Services
    MainProcess --> AutoUpdate
    MainProcess --> FileSystem
    MainProcess --> MenuHandler

    %% Styling
    classDef main fill:#2196F3,color:white
    classDef vue fill:#42b883,color:white
    classDef editor fill:#FF9800,color:white
    classDef service fill:#9C27B0,color:white
    classDef communication fill:#757575,color:white

    %% Click Events
    click MainProcess "https://github.com/heyman/heynote/blob/main/electron/main/index.ts"
    click AppCore "https://github.com/heyman/heynote/blob/main/src/components/App.vue"
    click EditorCore "https://github.com/heyman/heynote/blob/main/src/editor/editor.js"
    click Settings "https://github.com/heyman/heynote/blob/main/src/components/settings/Settings.vue"
    click BufferSelector "https://github.com/heyman/heynote/blob/main/src/components/BufferSelector.vue"
    click Store "https://github.com/heyman/heynote/blob/main/src/stores/heynote-store.js"
    click LangDetect "https://github.com/heyman/heynote/blob/main/src/editor/language-detection/autodetect.js"
    click Formatter "https://github.com/heyman/heynote/blob/main/src/editor/block/format-code.js"
    click Calculator "https://github.com/heyman/heynote/blob/main/public/math.js"
    click Currency "https://github.com/heyman/heynote/blob/main/src/currency.js"
    click FileSystem "https://github.com/heyman/heynote/blob/main/electron/main/file-library.js"
    click IPC "https://github.com/heyman/heynote/blob/main/electron/preload/index.js"
    click ThemeMgmt "https://github.com/heyman/heynote/tree/main/src/editor/theme"
    click BlockMgmt "https://github.com/heyman/heynote/tree/main/src/editor/block"
    click AutoUpdate "https://github.com/heyman/heynote/blob/main/electron/main/auto-update.js"
    click MenuHandler "https://github.com/heyman/heynote/blob/main/electron/main/menu.js"
```
