# vnotex/vnote architecture

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

- Interactive diagram: https://gitdiagram.com/vnotex/vnote
- Repository: https://github.com/vnotex/vnote

## Overview

##### Project type and purpose
- VNote is a Qt-based, cross-platform (Linux, Windows, macOS) desktop note-taking application focusing on Markdown. It provides rich editing (text, Markdown, mind-map, PDF), note management, exporting, search, snippet management, task execution, image-hosting plugins, theming, and configuration persistence.

##### File structure
- Top‐level: CMakeLists.txt (build), .github (CI), package (deploy), scripts (versioning).
- src/ contains all C++ modules, grouped by domain:
- core/ – core services & data models (buffer providers, notebook manager, config manager, history, version control).
- widgets/ – UI layer (dialogs, editors, main window, panels).
- utils/ – shared helper functions (file, HTML, process, clipboard, web).
- imagehost/ – plugin backends for uploading images.
- search/ – file-system search engine.
- snippet/, task/, unitedentry/ – feature modules for snippets, external tasks, “Go-to” palette entries.
- export/ – exporters for web/html.
- tests/ – unit tests for core, utils, task.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        Widgets["Widgets & Editors"]:::ui
    end

    %% Application Framework
    subgraph "Application Framework"
        MainCPP["main.cpp"]:::app
        Application["Application (application.cpp)"]:::app
        CLI["CommandLineOptions"]:::app
    end

    %% Core Services
    subgraph "Core Services"
        BufferMgr["BufferManager"]:::core
        NotebookMgr["NotebookManager"]:::core
        ConfigMgr["ConfigurationManager"]:::core
        HistoryMgr["HistoryManager"]:::core
        VersionCtrl["VersionControllerFactory"]:::core
        SingleInst["SingleInstanceGuard"]:::core
    end

    %% Feature Modules
    subgraph "Feature Modules"
        SearchMod["Search Module"]:::feature
        SnippetMod["Snippet Module"]:::feature
        TaskMod["Task Module"]:::feature
        UnitedMod["Go-to Palette Entries"]:::feature
        ExportMod["Export Module"]:::feature
        ImageHostMod["Image Hosting Plugins"]:::feature
    end

    %% Utilities
    subgraph "Utilities"
        Utils["Utils (shared helpers)"]:::utils
    end

    %% Data Layer
    subgraph "Data Layer"
        FileSystem["File System"]:::data
        QRC["QRC Resources"]:::data
    end

    %% External Dependencies
    subgraph "External Dependencies"
        QtGui["Qt Widgets/Gui"]:::external
        QtWeb["QtWebEngine/WebKit"]:::external
        OSFS["OS File System"]:::external
        Network["Network Services"]:::external
    end

    %% Connections
    MainCPP -->|"bootstrap"| Application
    Application -->|"parse args"| CLI
    Application -->|"init| ConfigMgr"| ConfigMgr
    Application -->|"init| SingleInst"| SingleInst
    Application -->|"launch UI"| Widgets

    Widgets -->|"edit Markdown"| BufferMgr
    Widgets -->|"open notebook"| NotebookMgr
    Widgets -->|"invoke search"| SearchMod
    Widgets -->|"invoke snippet"| SnippetMod
    Widgets -->|"run task"| TaskMod
    Widgets -->|"go to entry"| UnitedMod
    Widgets -->|"export"| ExportMod
    Widgets -->|"upload image"| ImageHostMod

    BufferMgr -->|"read/write"| FileSystem
    NotebookMgr -->|"load/save"| FileSystem
    ConfigMgr -->|"load settings"| QRC
    HistoryMgr -->|"log edits"| FileSystem
    VersionCtrl -->|"version ops"| FileSystem
    SingleInst -->|"ensure single"| Application

    SearchMod -->|"search query"| FileSystem
    TaskMod -->|"execute"| OSFS
    ExportMod -->|"generate HTML"| QRC
    ImageHostMod -->|"upload API"| Network

    Utils -->|"provide helpers"| BufferMgr
    Utils -->|"provide helpers"| NotebookMgr
    Utils -->|"provide helpers"| SearchMod
    Utils -->|"provide helpers"| ImageHostMod

    Widgets -->|"use Qt"| QtGui
    Widgets -->|"use QtWebEngine"| QtWeb
    Application -->|"use QtCore"| QtGui
    Application -->|"use QtCore"| QtWeb

    FileSystem -->|"OS I/O"| OSFS

    %% Click Events
    click Widgets "https://github.com/vnotex/vnote/tree/master/src/widgets/"
    click MainCPP "https://github.com/vnotex/vnote/blob/master/src/main.cpp"
    click Application "https://github.com/vnotex/vnote/blob/master/src/application.cpp"
    click CLI "https://github.com/vnotex/vnote/blob/master/src/commandlineoptions.cpp"
    click BufferMgr "https://github.com/vnotex/vnote/blob/master/src/core/buffermgr.cpp"
    click BufferMgr "https://github.com/vnotex/vnote/tree/master/src/core/buffer/"
    click NotebookMgr "https://github.com/vnotex/vnote/blob/master/src/core/notebookmgr.cpp"
    click NotebookMgr "https://github.com/vnotex/vnote/tree/master/src/core/notebookbackend/"
    click NotebookMgr "https://github.com/vnotex/vnote/tree/master/src/core/notebook/"
    click ConfigMgr "https://github.com/vnotex/vnote/blob/master/src/core/configmgr.cpp"
    click HistoryMgr "https://github.com/vnotex/vnote/blob/master/src/core/historymgr.cpp"
    click VersionCtrl "https://github.com/vnotex/vnote/tree/master/src/core/versioncontroller/"
    click SingleInst "https://github.com/vnotex/vnote/blob/master/src/core/singleinstanceguard.cpp"
    click SearchMod "https://github.com/vnotex/vnote/tree/master/src/search/"
    click SnippetMod "https://github.com/vnotex/vnote/tree/master/src/snippet/"
    click TaskMod "https://github.com/vnotex/vnote/tree/master/src/task/"
    click UnitedMod "https://github.com/vnotex/vnote/tree/master/src/unitedentry/"
    click ExportMod "https://github.com/vnotex/vnote/tree/master/src/export/"
    click ImageHostMod "https://github.com/vnotex/vnote/tree/master/src/imagehost/"
    click Utils "https://github.com/vnotex/vnote/tree/master/src/utils/"
    click QRC "https://github.com/vnotex/vnote/blob/master/src/data/core/core.qrc"

    %% Styles
    classDef ui fill:#D6EAF8,stroke:#1B4F72,color:#1B4F72;
    classDef app fill:#D4EFDF,stroke:#1E8449,color:#1E8449;
    classDef core fill:#FCF3CF,stroke:#B7950B,color:#B7950B;
    classDef feature fill:#FADBD8,stroke:#C0392B,color:#C0392B;
    classDef utils fill:#F9E79F,stroke:#B9770E,color:#B9770E;
    classDef data fill:#EBEDEF,stroke:#5D6D7E,color:#5D6D7E;
    classDef external fill:#D1F2EB,stroke:#117A65,color:#117A65;
```
