# ixrjog/ssh-shell-spring-boot architecture

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

- Interactive diagram: https://gitdiagram.com/ixrjog/ssh-shell-spring-boot
- Repository: https://github.com/ixrjog/ssh-shell-spring-boot

## Overview

##### Main Components
- Spring Boot Application Container – Represent the overall host application that uses this starter.
- Auto-configuration Module – Highlight the SshShellAutoConfiguration class (and related auto-config classes) that wires up the SSH shell functionality automatically when enabled.
- Command Processing and Shell Components – Identify groups of built-in commands (like actuator, jmx, system, datasource, postprocessors, tasks, etc.) as separate modules/components. Represent the SshShellHelper service that aids in command execution, printing output, reading input, and interactive operation.
- Authentication and Security – Illustrate the security aspects including:
○ Simple vs. Security authentication (using SshShellAuthenticationProvider and the custom authentication example).
○ Public key authentication (via authorized-public-keys configuration).
- Extension/Customization Points – Mark areas for custom commands (annotated with @SshShellComponent) and custom post processors, parameter providers, event listeners, and session managers.
- Sample Applications – (basic and complete samples) can be shown as optional examples or client modules for testing/integration.

##### Relationships and Interactions
- SshShellHelper as a common service invoked by command classes to interact with users (print, read, interactive modes) and also to signal events (like session management and key bindings).
- Directional flows: from the SSH client connection (external user) to the SSH server to the command dispatcher which subsequently routes to the appropriate command implementations.
- Authentication module to the SSH Server to indicate that every SSH session is verified either via a simple user/password check or via a custom AuthenticationProvider.

##### Architectural Patterns & Principles
- Use of auto-configuration (a key Spring Boot design principle) – showing how properties such as ssh.shell.enable and related configuration values influence which beans or commands get loaded.
- Modular design – each command group (actuator, jmx, system, datasource, postprocessors, tasks, etc.) and the interactive features are developed as separate components that are registered conditionally based on configuration.
- Extensibility – highlight extension points such as custom command components (annotated with @SshShellComponent), custom authentication providers, custom post processors, and event listener hooks.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Layer
    subgraph "External Layer"
        A["SSH Client"]:::external
    end

    %% Spring Boot Application Container
    subgraph "Spring Boot Application Container"
        B["Basic Sample Application"]:::app
        C["Complete Sample Application"]:::app
    end

    %% Auto-Configuration & SSH Server Layer
    subgraph "Auto-Configuration & SSH Server"
        D["Auto-Configuration (SshShellAutoConfiguration)"]:::infra
        E["SSH Server (SshShellRunnable)"]:::infra
        F["Terminal Delegate (SshShellTerminalDelegate)"]:::infra
    end

    %% Command Processing & Helper Services
    subgraph "Command & Helper Services"
        G["Built-in Command Processors"]:::command
        H["SshShellHelper"]:::command
    end

    %% Authentication & Security
    subgraph "Authentication & Security"
        I["Authentication Providers"]:::security
    end

    %% Extension & Customization
    subgraph "Extension & Customization"
        J["Custom Commands (@SshShellComponent)"]:::extension
        K["Custom Post Processors"]:::extension
        L["Event Listeners"]:::extension
    end

    %% Configuration & Dependencies
    subgraph "Configuration & Dependencies"
        M["Maven Configurations (pom.xml)"]:::config
        N["External Dependencies (Spring Boot, Spring Shell, Apache SSHD)"]:::external
    end

    %% Relationships and Interactions
    A -->|"SSHConnection"| E
    B -->|"Bootstraps"| D
    C -->|"Bootstraps"| D
    D -->|"Configures"| E
    D -->|"Registers"| G
    D -->|"SetsUp"| I
    E -->|"HandlesIO"| F
    E -->|"DispatchCommands"| H
    G -->|"UsesHelper"| H
    I -->|"SecuresSession"| E
    D -->|"Enables"| J
    D -->|"Enables"| K
    D -->|"Enables"| L
    H -->|"Feedback"| A
    M -->|"Configures"| D
    N -->|"Supports"| D

    %% Click Events
    click B "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/samples/basic/src/main/java/com/github/fonimus/ssh/shell/basic/BasicApplication.java"
    click C "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/samples/complete/src/main/java/com/github/fonimus/ssh/shell/complete/CompleteApplication.java"
    click D "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/starter/src/main/java/com/github/fonimus/ssh/shell/SshShellAutoConfiguration.java"
    click E "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/starter/src/main/java/com/github/fonimus/ssh/shell/SshShellRunnable.java"
    click F "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/starter/src/main/java/com/github/fonimus/ssh/shell/SshShellTerminalDelegate.java"
    click G "https://github.com/ixrjog/ssh-shell-spring-boot/tree/main/starter/src/main/java/com/github/fonimus/ssh/shell/commands"
    click H "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/starter/src/main/java/com/github/fonimus/ssh/shell/SshShellHelper.java"
    click I "https://github.com/ixrjog/ssh-shell-spring-boot/tree/main/starter/src/main/java/com/github/fonimus/ssh/shell/auth"
    click J "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/starter/src/main/java/com/github/fonimus/ssh/shell/commands/SshShellComponent.java"
    click K "https://github.com/ixrjog/ssh-shell-spring-boot/tree/main/starter/src/main/java/com/github/fonimus/ssh/shell/postprocess"
    click L "https://github.com/ixrjog/ssh-shell-spring-boot/tree/main/starter/src/main/java/com/github/fonimus/ssh/shell/listeners"
    click M "https://github.com/ixrjog/ssh-shell-spring-boot/blob/main/starter/pom.xml"

    %% Styles
    classDef external fill:#a2d2ff,stroke:#000,stroke-width:1px;
    classDef app fill:#bde0fe,stroke:#000,stroke-width:1px;
    classDef infra fill:#caffbf,stroke:#000,stroke-width:1px;
    classDef command fill:#ffd6a5,stroke:#000,stroke-width:1px;
    classDef security fill:#ffadad,stroke:#000,stroke-width:1px;
    classDef extension fill:#d0afff,stroke:#000,stroke-width:1px;
    classDef config fill:#eeeeee,stroke:#000,stroke-width:1px;
```
