# xpipe-io/xpipe architecture

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

- Interactive diagram: https://gitdiagram.com/xpipe-io/xpipe
- Repository: https://github.com/xpipe-io/xpipe

## Overview

Based on both the file tree and the README, XPipe is a desktop-based, modular shell connection hub and remote file management application. Its primary purpose is to serve as an integrated “front door” to a wide variety of remote systems—via SSH, containers (Docker, Podman, LXD/incus), virtualization platforms (Proxmox, Hyper-V, KVM, VMware), Windows remote sessions, Kubernetes clusters, and even tunneling/secure vault features. It is built in Java and organized into multiple Gradle subprojects that separate core application logic, beacon communications, extensions, and additional functionality.

##### Main Components
- User Interface (UI) Module: This is the presentation layer offering multiple views:
– Connection hub view (organized hierarchical list of remote connections).
– Remote file browser view.
– Terminal launcher view.
– Scripting and vault management UI.
- Core Application Module: Located primarily in the “app” and “core” folders, this layer handles:
– Application bootstrap, configuration, and lifecycle.
– Connection management logic (processing and orchestrating different connection types).
– File system interactions and remote actions.
– Internationalization (lang) and resource handling.
- Beacon/Communication Module: This subproject (found in the “beacon” directory) seems responsible for:
– Establishing two-way communication between XPipe and remote endpoints.
– Handling various exchange protocols (for file system actions, shell session commands, authentication exchanges, etc.).
- Extension / Plugin System: XPipe is designed to be extensible and modular. The “ext” directory (with several subprojects like ext/base, ext/proc, ext/system, ext/uacc) contains:
– Additional actions, browser integrations, desktop integrations.
– Custom connection types and enhanced services that plug into the core.
- API Layer: XPipe exposes programmatic access via an HTTP API (documented in the OpenAPI spec). This component manages:
– The API endpoint component that allows external tooling (or even the internal extension system) to control XPipe programmatically.
- External Integration Layer: Represented as the various connection protocols (SSH, Docker, Kubernetes, etc.) that XPipe supports. This can be visualized as a set of “external services” which the core and its extensions integrate with.

##### Relationships and Interactions
- The UI layer interacts with the core application logic to launch terminal sessions, manage file transfers, and authenticate vault operations.
- The Core module acts as the brain, coordinating authentication, configuration, and invoking the right extension or beacon exchange for the requested remote connection.
- When a connection is requested (say, an SSH or container session), the core will trigger the appropriate extension (from ext/base, ext/system, …) and possibly consult the beacon module to manage low-level protocol exchanges.
- The API layer serves as an alternate path for commanding operations, allowing both UI components and external REST clients to manage connections and scripting functionalities.
- The extension framework is designed for modularity: new protocols or actions are implemented as separate modules (e.g., handling Incus, LXD, Podman, etc.) and plugged into the system during runtime.

##### Architectural Patterns and Design Principles
- Modular Design – Each major feature is clearly separated into its own module (app, beacon, core, ext/…).
- Layered Architecture – Presentation (UI) is separated from business logic (core) and from communication (beacon) and integration points (extensions).
- Extensibility – A plugin/extension system allows the addition of new connection types and custom commands.
- Loose coupling – The API and beacon modules encapsulate low-level details and communicate with the core via clearly defined interfaces.
- Separation of concerns – Each directory (for example, “app” handles main application logic and UI, “core” manages lower-level file operations and process management, “ext” handles custom actions) reinforces clean boundaries.

##### Technologies, Frameworks, and Libraries
- Java (with modularization, as seen by the presence of module-info.java files).
- Gradle as the build and dependency management tool.
- Various external libraries bundled under “lib” and via Gradle scripts, such as Jackson (for JSON), and others (possibly for SSH and process control).
- OpenAPI spec (openapi.yaml) for the API layer.

##### Essential Elements
– “User Interface” (with sub-components for connections hub, browser, terminal, scripting, and vault)
– “Core Application Logic” (with connection management, process handling, configuration, and localization)
– “Beacon Communication Module” (handling protocol exchanges and session orchestration)
– “Extensions/Plugins” (with subdivisions for base actions, system integrations, processing, etc.)
– “API Server” (HTTP interface for programmatic control)
– “External Systems” (SSH servers, container engines, VMs, Kubernetes clusters, etc.)
– From “Core Application Logic” to “Beacon Module” and to various “Extension Modules”.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Presentation Layer"
        UI["User Interface (UI Module)"]
    end

    subgraph "Business/Logic Layer"
        Core["Core Application Logic"]
        API["API Server (HTTP)"]
    end

    subgraph "Integration/Extension Layer"
        Beacon["Beacon Communication Module"]
        subgraph "Extensions/Plugins"
            ExtBase["Extension: Base Actions"]
            ExtProc["Extension: Process Management"]
            ExtSystem["Extension: System Integrations"]
            ExtUacc["Extension: User Access/Custom Actions"]
        end
    end

    subgraph "External Systems"
        External["External Systems (SSH, Containers, VMs, Kubernetes, etc.)"]
    end

    UI -->|"launches"| Core
    API -->|"commands"| Core
    Core -->|"protocolExchange"| Beacon
    Core -->|"invoke_base"| ExtBase
    Core -->|"invoke_proc"| ExtProc
    Core -->|"invoke_system"| ExtSystem
    Core -->|"invoke_uacc"| ExtUacc
    Beacon -->|"exchanges"| External
    ExtBase -->|"integrates"| External
    ExtProc -->|"integrates"| External
    ExtSystem -->|"integrates"| External
    ExtUacc -->|"integrates"| External

    classDef presentation fill:#cfe2f3,stroke:#0b5394,stroke-width:2px;
    classDef business fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef integration fill:#fce5cd,stroke:#b45f06,stroke-width:2px;
    classDef api fill:#ead1dc,stroke:#990033,stroke-width:2px;
    classDef external fill:#d0cece,stroke:#434343,stroke-width:2px;

    class UI presentation;
    class Core business;
    class API api;
    class Beacon integration;
    class ExtBase integration;
    class ExtProc integration;
    class ExtSystem integration;
    class ExtUacc integration;
    class External external;

    click UI "https://github.com/xpipe-io/xpipe/tree/master/app/src/main/java/io/xpipe/app"
    click Core "https://github.com/xpipe-io/xpipe/tree/master/app/src/main/java/io/xpipe/app/core"
    click Beacon "https://github.com/xpipe-io/xpipe/tree/master/beacon/src/main/java/io/xpipe/beacon"
    click ExtBase "https://github.com/xpipe-io/xpipe/tree/master/ext/base"
    click ExtProc "https://github.com/xpipe-io/xpipe/tree/master/ext/proc"
    click ExtSystem "https://github.com/xpipe-io/xpipe/tree/master/ext/system"
    click ExtUacc "https://github.com/xpipe-io/xpipe/tree/master/ext/uacc"
    click API "https://github.com/xpipe-io/xpipe/blob/master/openapi.yaml"
```
