# jaromaz/stws architecture

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

- Interactive diagram: https://gitdiagram.com/jaromaz/stws
- Repository: https://github.com/jaromaz/stws

## Overview

##### Main Components

a) Client Layer:
- Web Browser (entry point)
- noVNC Client (HTML5/JavaScript-based VNC client)

b) Container Layer:
- Docker Container
- Components inside the container:
- noVNC Server
- Websockify (WebSocket proxy)
- TightVNC Server
- X-Org Server
- SyncTERM (BBS Terminal)

**[Web Browser] → [noVNC Client Interface]**
- ↓
**[Docker Container]**
- [noVNC Server + Websockify]
- ↓
- [TightVNC Server]
- ↓
- [X-Org Server]
- ↓
- [SyncTERM]
- ↓
**[BBS Servers/Telnet]**

##### Important Elements to Highlight

a) Communication Flows:
- Port 6080 exposure for web access
- WebSocket tunneling of VNC protocol
- X11 display handling
- Telnet connectivity

b) Security Layer:
- Password authentication system
- Docker container isolation

##### Technical Details

- Protocol transitions:
- HTTP/WebSocket (Browser to noVNC)
- VNC protocol (noVNC to TightVNC)
- X11 protocol (TightVNC to X-Org)
- Telnet (SyncTERM to BBS)

##### Component Descriptions

- noVNC: HTML5 VNC client implementation
- Websockify: WebSocket to TCP proxy
- TightVNC: VNC server implementation
- X-Org: X Window System server
- SyncTERM: BBS terminal emulator

This architecture represents a unique combination of modern web technologies (noVNC, WebSocket) with traditional terminal services (VNC, X11, Telnet), all orchestrated within a Docker container for easy deployment and isolation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        NoVNCClient["noVNC Client Interface"]:::client
        ClientJS["Client-side JavaScript"]:::client
        ClientCSS["Client Styling"]:::client
    end

    subgraph "Docker Container"
        NoVNCServer["noVNC Server"]:::container
        Websockify["Websockify Proxy"]:::container
        TightVNC["TightVNC Server"]:::container
        XOrg["X-Org Server"]:::container
        SyncTERM["SyncTERM Terminal"]:::container
        Config["Container Configuration"]:::config
        EntryPoint["Container Entry Point"]:::config
        XConfig["X Window Configuration"]:::config
        STConfig["SyncTERM Configuration"]:::config
        STList["SyncTERM Server List"]:::config
        STPatch["SyncTERM Customization"]:::config
    end

    subgraph External
        BBS["BBS Servers/Telnet"]:::external
    end

    Browser --> NoVNCClient
    NoVNCClient --> ClientJS
    NoVNCClient --> ClientCSS
    NoVNCClient --> |"Port 6080"| NoVNCServer
    NoVNCServer --> Websockify
    Websockify --> |"VNC Protocol"| TightVNC
    TightVNC --> |"X11 Protocol"| XOrg
    XOrg --> SyncTERM
    SyncTERM --> |"Telnet"| BBS
    
    Config --> EntryPoint
    EntryPoint --> SyncTERM
    XConfig --> XOrg
    STConfig --> SyncTERM
    STList --> SyncTERM
    STPatch --> SyncTERM

    %% Click events for component mapping
    click NoVNCClient "https://github.com/jaromaz/stws/blob/master/syncterm/stws/noVNC/index.html"
    click ClientJS "https://github.com/jaromaz/stws/blob/master/syncterm/stws/noVNC/stws/js/stws.js"
    click ClientCSS "https://github.com/jaromaz/stws/blob/master/syncterm/stws/noVNC/stws/css/stws.css"
    click Config "https://github.com/jaromaz/stws/tree/master/Dockerfile"
    click EntryPoint "https://github.com/jaromaz/stws/blob/master/syncterm/stws/bin/entrypoint.sh"
    click SyncTERM "https://github.com/jaromaz/stws/blob/master/syncterm/stws/bin/syncterm.gz"
    click STConfig "https://github.com/jaromaz/stws/blob/master/syncterm/.syncterm/syncterm.ini"
    click STList "https://github.com/jaromaz/stws/blob/master/syncterm/.syncterm/syncterm.lst"
    click XConfig "https://github.com/jaromaz/stws/blob/master/syncterm/.xsession"
    click STPatch "https://github.com/jaromaz/stws/blob/master/syncterm/stws.patch"

    %% Styling
    classDef client fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef container fill:#90EE90,stroke:#333,stroke-width:2px
    classDef config fill:#FFE5CC,stroke:#333,stroke-width:2px
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Client Components"]:::client
        L2["Container Components"]:::container
        L3["Configuration Files"]:::config
        L4["External Services"]:::external
    end
```
