# lichtblick-suite/lichtblick architecture

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

- Interactive diagram: https://gitdiagram.com/lichtblick-suite/lichtblick
- Repository: https://github.com/lichtblick-suite/lichtblick

## Overview

##### Main Components
- User Interface (UI) Layer:
– Desktop Renderer & Web Frontend: The “desktop” directory (with main, preload, renderer code and Electron configuration) shows how the desktop version is built. The “web” folder contains code for the web app.
– Presentation Components and Panels: The “packages/suite-base” folder includes many React components (panels, controls, providers, layout managers, etc.) that define how data is visualized. Also, packages like “packages/theme” are used to style the UI.
- Core Application Logic:
– Players & Data Sources: Note the “players” directories (e.g. FoxgloveWebSocketPlayer, IterablePlayer, TopicAliasingPlayer, etc.) and “dataSources” folders that manage input from robotics messages.
– Services & Utilities: The “services” subfolders (both in suite-base and within desktop/web) handle layout loading, file system interactions, message pipeline processing, and integration with the Electron native environment.
- Build, Testing, and Infrastructure:
– CI/CD and Build Configuration: Folders like “ci”, various “.github/workflows” configurations, Dockerfile, and Webpack configuration files indicate continuous integration/deployment processes.
– Benchmark and Testing: The “benchmark” directory and “src/test” folders indicate testing frameworks and performance monitoring.
– Package Management and Mono Repo Structure: The “packages” folder (with many sub‑packages for types, hooks, logging, etc.) shows the modular architecture and sharing of common functionalities.

##### Component Relationships and Data Flow
- How UI components (panels, controls, and widgets) use context providers to communicate application state and configuration.
- Bidirectional flow between the “players” (which process incoming robotics messages) and the UI panels (which display realtime data).
- That both desktop and web apps use a shared core (for example in “packages/suite-base”) to implement common visualization functionality.
- How external services and libraries (dependencies such as Foxglove integration, Git LFS downloads, and even patched third-party modules) are integrated via build scripts and configuration files.

##### Architectural Patterns and Technology Choices
- The project follows a modular, component-based architecture where many smaller packages (with well‑defined APIs) are assembled to create the full application.
- Separation of concerns is clear: UI (React components and panels), data processing (players and message pipelines), and native integration (Electron desktop environment).
- Use of context providers for global state management (e.g. AppContext, CurrentLayoutContext) and hook-based state management in React.
- Both client‐side and desktop-specific build processes are present. The mono repo with Yarn workspaces supports shared business logic across platforms.

##### Essential Architectural Elements
- Detail the multi-platform structure (desktop and web clients).
- Mono repository layout with shared packages and libraries.
- Present external integration points (such as version control, Git LFS, and CI/CD pipelines).

– How user interaction in the UI leads to data being processed by players and forwarded via providers,
– How configuration, state, and UI logic is shared across desktop and web through a unified core,
– And how the build and integration pipelines support a robust development and production environment.

## Diagram (Mermaid)

```mermaid
graph TD
    %% UI Layer
    subgraph "User Interfaces"
        subgraph "Desktop UI (Electron App)"
            dMain["Desktop Main Process"]:::ui
            dPreload["Desktop Preload"]:::ui
            dRenderer["Desktop Renderer"]:::ui
            dQuick["Desktop Quicklook"]:::ui
            dSuite["Suite Desktop"]:::ui
        end
        subgraph "Web UI (Browser App)"
            webUI["Web UI"]:::ui
        end
    end

    %% Core Application
    subgraph "Core Application"
        subgraph "Presentation Components & Panels"
            presentation["Components & Panels"]:::core
        end
        subgraph "Theming & Styling"
            theming["Theming & Styling"]:::core
        end
        subgraph "Players & Data Sources"
            players["Players & Data Sources"]:::core
        end
        subgraph "Providers & Contexts"
            providers["Providers & Contexts"]:::core
        end
        subgraph "Services & Utilities"
            services["Services & Utilities"]:::core
        end
    end

    %% Infrastructure
    subgraph "Infrastructure"
        cd["CI/CD & Build Configurations"]:::infra
        bench["Benchmarking"]:::infra
    end

    %% Relationships between UI and Core
    dRenderer -->|"sendsUIEvents"| presentation
    webUI -->|"loadsComponents"| presentation
    presentation -->|"usesStateFrom"| providers
    players -->|"feedsDataTo"| presentation
    players -->|"updatesContexts"| providers

    %% Desktop internal communications (Electron IPC)
    dMain -->|"initIPC"| dPreload
    dPreload -->|"communicates"| dRenderer
    dMain -->|"controls"| dSuite
    dSuite -->|"renders"| dRenderer

    %% Infrastructure interactions
    cd -->|"buildsDesktop"| dMain
    cd -->|"buildsWeb"| webUI
    bench -->|"monitorsPlayers"| players

    %% Legend (for color coding and arrow directions)
    subgraph "Legend"
        L1["UI Layer (Pink)"]:::ui
        L2["Core Application (Blue)"]:::core
        L3["Infrastructure (Green)"]:::infra
        L4["Arrows denote data flow and inter-dependencies"]
    end

    %% Click Events for Component Mapping
    click dMain "https://github.com/lichtblick-suite/lichtblick/tree/main/desktop/main"
    click dPreload "https://github.com/lichtblick-suite/lichtblick/tree/main/desktop/preload"
    click dRenderer "https://github.com/lichtblick-suite/lichtblick/tree/main/desktop/renderer"
    click dQuick "https://github.com/lichtblick-suite/lichtblick/tree/main/desktop/quicklook"
    click dSuite "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-desktop/src"
    click webUI "https://github.com/lichtblick-suite/lichtblick/tree/main/web"
    click presentation "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-base/src/components"
    click presentation "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-base/src/panels"
    click theming "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/theme/src"
    click players "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-base/src/players"
    click players "https://github.com/lichtblick-suite/lichtblick/tree/main/benchmark/src/players"
    click providers "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-base/src/context"
    click providers "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-base/src/providers"
    click services "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-base/src/services"
    click services "https://github.com/lichtblick-suite/lichtblick/tree/main/packages/suite-base/src/util"
    click cd "https://github.com/lichtblick-suite/lichtblick/tree/main/.github/workflows"
    click cd "https://github.com/lichtblick-suite/lichtblick/tree/main/ci"
    click cd "https://github.com/lichtblick-suite/lichtblick/tree/main/Dockerfile"
    click cd "https://github.com/lichtblick-suite/lichtblick/blob/main/webpack.config.ts"
    click bench "https://github.com/lichtblick-suite/lichtblick/tree/main/benchmark"

    %% Styles
    classDef ui fill:#ffccff,stroke:#333,stroke-width:2px;
    classDef core fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef infra fill:#ccffcc,stroke:#333,stroke-width:2px;
```
