# openboard-org/openboard architecture

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

- Interactive diagram: https://gitdiagram.com/openboard-org/openboard
- Repository: https://github.com/openboard-org/openboard

## Overview

##### Main components (modules) as shown in the file tree
- Core Layer (src/core): Contains the central application logic, board controller, document management, persistence, settings, idle timer, and overall application lifecycle (UBApplication, UBBoardController, etc.).
- GUI Layer (src/gui & src/customWidgets): Manages the user interface, including palettes, toolbars, dialogs, custom widgets, and the main window (UBMainWindow). Web tools and tools for interactive whiteboard functions reside here.
- Adaptor & API Layers (src/adaptors and src/api): Provide import/export functionalities (e.g., for PDF, images, various document formats) and integration with web widgets and external content. They also expose OpenBoard’s widget APIs (UBWidgetMessageAPI, UBW3CWidgetAPI).
- Document and Board Modules (src/document and src/board): Handle board documents, their rendering and manipulation on the interactive whiteboard.
- Network and Resources (src/network, resources directory): Enable tasks like content downloading, online publishing, and podcast-related functionalities (the podcast module under src/podcast, with subdirectories for different OS/media support).
- PDF and Multimedia Support (src/pdf, src/pdf-merger, src/podcast components): These modules handle PDF rendering/merging and multimedia encoding/decoding via adapters for FFmpeg, QuickTime, or Windows Media.
- Platform-Specific and Build Infrastructure: The project uses CMake (with cmake directories and CMakeLists.txt in most modules) to configure builds across Windows, macOS, and Linux. There are also dedicated release scripts (in release_scripts) for packaging across platforms.

##### Relationships and interactions
- The Core layer acts as the backbone, initiating and coordinating interactions between the GUI, Domain, and API layers.
- The GUI components relay user inputs to the Core, which in turn updates the Domain (graphics items, board content) and persists changes via the Document modules.
- Adaptors and API modules interface with external systems (importing/exporting documents, widgets integration, network requests) and interact with the Core to integrate these functionalities.
- The PDF and multimedia modules are connected both to the presentation layer (to display PDFs or video) and to the adaptor layers (to handle file conversion or encoding).

##### Important architectural patterns/design principles
- Layered architecture: Clearly separate the presentation (GUI), business logic (Core & Domain), and integration layers (Adaptors/API).
- Modular design: Each module (e.g., domain, core, network, podcasts) is encapsulated in its directory with dedicated CMake projects, promoting separation of concerns.
- Cross-platform design: There are platform-specific implementations (for example, in src/frameworks and in the release_scripts) and conditional compilations via CMake to support Windows, macOS, and Linux.
- Plugin/extensibility mechanism: The Web Widget support and the “plugins” directory indicate a system that supports dynamic widget integration while keeping core functionality independent.

##### Relevant technologies, frameworks, and libraries
- C++ and Qt (versions 5 and 6) are the primary language and GUI framework.
- CMake is used across the project for building on different platforms.
- External dependencies (via cmake/Dependency* files) such as FFmpeg, OpenSSL, Poppler, QuaZip, and others, which are integrated through our dependency management scripts.
- The file tree also shows support for multimedia, network, and PDF libraries.

– GUI → Core (user input processing)
– Core ←→ Domain (managing board state and undo/redo)
– Core → Adaptors/API (import/export and external communications)
- Optionally, include a section indicating the build and deployment tools (CMake, release_scripts) and OS-specific folders, to show cross-platform support.
- Detail any external dependencies by listing them on the periphery (e.g., Qt, FFmpeg, Poppler).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        GUI1("UI Components"):::presentation
        GUI2("Custom Widgets"):::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        CORE("Core Layer"):::business
        DOMAIN("Domain Layer"):::business
        DOC("Document Module"):::business
        BOARD("Board Module"):::business
    end

    %% Integration Layer
    subgraph "Integration Layer"
        ADAPTORS("Adaptors"):::integration
        API("API"):::integration
        PDF("PDF Rendering"):::integration
        MERGER("PDF Merger"):::integration
        PODCAST("Podcast Module"):::integration
        NET("Network & Resources"):::integration
    end

    %% Build & Platform Layer
    subgraph "Build & Platform"
        PLATFORM("Platform & Build Infrastructure"):::platform
    end

    %% External Dependencies
    EXTERNAL("External Dependencies (Qt,FFmpeg,Poppler,etc.)"):::external

    %% Connections
    GUI1 -->|"user_input"| CORE
    GUI2 -->|"user_input"| CORE
    CORE <-->|"state_sync"| DOMAIN
    CORE -->|"update_doc"| DOC
    CORE -->|"update_board"| BOARD
    CORE -->|"import_export"| ADAPTORS
    CORE -->|"import_export"| API
    API -->|"render_pdf"| PDF
    API -->|"merge_pdf"| MERGER
    API -->|"handle_podcast"| PODCAST
    API -->|"network_req"| NET
    ADAPTORS -->|"network_req"| NET
    GUI1 -->|"display_content"| PDF
    GUI2 -->|"display_content"| PDF

    PLATFORM ---|"builds"| CORE
    PLATFORM ---|"builds"| GUI1
    PLATFORM ---|"builds"| GUI2
    PLATFORM ---|"builds"| DOMAIN
    PLATFORM ---|"builds"| DOC
    PLATFORM ---|"builds"| BOARD
    PLATFORM ---|"builds"| ADAPTORS
    PLATFORM ---|"builds"| API
    PLATFORM ---|"builds"| PDF
    PLATFORM ---|"builds"| MERGER
    PLATFORM ---|"builds"| PODCAST
    PLATFORM ---|"builds"| NET

    EXTERNAL ---|"provides"| GUI1
    EXTERNAL ---|"provides"| API
    EXTERNAL ---|"provides"| PDF

    %% Click Events
    click CORE "https://github.com/openboard-org/openboard/tree/master/src/core"
    click GUI1 "https://github.com/openboard-org/openboard/tree/master/src/gui"
    click GUI2 "https://github.com/openboard-org/openboard/tree/master/src/customWidgets"
    click DOMAIN "https://github.com/openboard-org/openboard/tree/master/src/domain"
    click ADAPTORS "https://github.com/openboard-org/openboard/tree/master/src/adaptors"
    click API "https://github.com/openboard-org/openboard/tree/master/src/api"
    click DOC "https://github.com/openboard-org/openboard/tree/master/src/document"
    click BOARD "https://github.com/openboard-org/openboard/tree/master/src/board"
    click NET "https://github.com/openboard-org/openboard/tree/master/src/network"
    click PDF "https://github.com/openboard-org/openboard/tree/master/src/pdf"
    click MERGER "https://github.com/openboard-org/openboard/tree/master/src/pdf-merger"
    click PODCAST "https://github.com/openboard-org/openboard/tree/master/src/podcast"
    click PLATFORM "https://github.com/openboard-org/openboard/tree/master/cmake"
    click PLATFORM "https://github.com/openboard-org/openboard/tree/master/release_scripts"

    %% Styles
    classDef presentation fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef business fill:#F9E79F,stroke:#7D6608,stroke-width:2px;
    classDef integration fill:#A9DFBF,stroke:#1D8348,stroke-width:2px;
    classDef platform fill:#F5CBA7,stroke:#B03A2E,stroke-width:2px;
    classDef external fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
```
