MCPSERV.CLUB
WeTTY

WeTTY

Self-Hosted

Web terminal access over HTTP/HTTPS

Stale(68)
5.0kstars
0views
Updated May 28, 2025
WeTTY screenshot

Overview

Discover what makes WeTTY powerful

WeTTY is a lightweight, browser‑based terminal emulator that exposes an SSH session over HTTP/HTTPS using WebSockets. Built with Node.js (≥18) and leveraging the **xterm.js** library for terminal emulation, it provides a near‑native terminal experience in the browser with minimal latency. Unlike legacy solutions such as ajaxterm or anyterm, WeTTY’s WebSocket‑driven architecture eliminates the request/response overhead of Ajax polling and supports full terminal features (copy/paste, resize events, color schemes) out of the box.

WebSocket‑based SSH

xterm.js integration

Flexible authentication

HTTPS support

Overview

WeTTY is a lightweight, browser‑based terminal emulator that exposes an SSH session over HTTP/HTTPS using WebSockets. Built with Node.js (≥18) and leveraging the xterm.js library for terminal emulation, it provides a near‑native terminal experience in the browser with minimal latency. Unlike legacy solutions such as ajaxterm or anyterm, WeTTY’s WebSocket‑driven architecture eliminates the request/response overhead of Ajax polling and supports full terminal features (copy/paste, resize events, color schemes) out of the box.

Key Features

  • WebSocket‑based SSH: Real‑time bidirectional communication ensures low round‑trip latency and efficient data streaming.
  • xterm.js integration: Full terminal emulation with support for 256‑color palettes, Unicode, and mouse reporting.
  • Flexible authentication: Password or public‑key SSH login; optional custom ssh-config files and known hosts management.
  • HTTPS support: Built‑in TLS configuration (--ssl-key, --ssl-cert) for secure deployments.
  • Embedded mode: --allow-iframe flag permits embedding the terminal in external web pages or dashboards.

Technical Stack

LayerTechnology
RuntimeNode.js (ECMAScript 2020)
ServerExpress‑style HTTP server with WebSocket upgrade handling
Terminal Enginexterm.js (client‑side) + node-pty or native SSH process spawning
SSH ClientOpenSSH client binary invoked via child processes; optional ssh-keygen integration
ConfigurationJSON/YAML config files, command‑line flags (CLI)
Data PersistenceNone required; optional logging via stdout or external loggers

The server spawns a child process (ssh or /bin/login) per client connection, pipes its stdin/stdout to a WebSocket, and serves the static xterm.js bundle to the browser. The architecture is intentionally stateless beyond the per‑connection process, simplifying scaling.

Core Capabilities & APIs

  • Programmatic control: The CLI exposes flags for SSH host/port, user, authentication method, and custom commands (--command). Developers can wrap these in scripts or orchestrate via CI/CD pipelines.
  • Event hooks: The WebSocket server emits events (connection, close, error) that can be captured by custom middleware or monitoring tools.
  • Extensibility: While WeTTY itself has no plugin system, its open‑source nature allows developers to fork and integrate additional features (e.g., session recording, multi‑user support) by extending the Node.js codebase.
  • Security hooks: Ability to supply custom known-hosts files or SSH config overrides enables tight integration with existing PKI infrastructure.

Deployment & Infrastructure

  • Self‑hosting: Requires only Node.js, npm, and a working OpenSSH client. No external database or service.
  • Containerization: Official Docker images are available; the repository contains a Dockerfile that builds from Alpine, making it suitable for micro‑service architectures or Kubernetes deployments.
  • Scalability: Each terminal session consumes a child process, so horizontal scaling (e.g., via a reverse proxy like Nginx or Traefik) is straightforward. Load balancers can be configured to preserve WebSocket connections.
  • Resource footprint: Minimal RAM (≈30 MB per session) and CPU usage; ideal for lightweight dev environments or internal dashboards.

Integration & Extensibility

  • API Gateway: WeTTY can be exposed behind an API gateway, allowing token‑based authentication or OAuth integration before establishing the WebSocket.
  • Custom UI: The static assets can be modified or replaced; developers can embed the terminal in existing admin panels.
  • Webhooks: While not native, the event system can be extended to trigger external webhooks on session start/stop.
  • License: MIT, encouraging modification and redistribution without copyleft constraints.

Developer Experience

  • Documentation: Comprehensive README with CLI reference, configuration examples, and deployment notes. The docs/ directory contains deeper technical details.
  • Community: 41 contributors; active issue tracker and pull request flow. The MIT license lowers barriers to contribution.
  • Configuration: Simple command‑line flags cover most use cases; fallback to default /bin/login when run as root, or SSH to localhost otherwise.
  • Testing: The codebase includes unit tests for the WebSocket handler and SSH spawning logic, ensuring reliability across Node.js versions.

Use Cases

  1. Internal DevOps Dashboards: Embed a terminal in CI/CD portals to allow engineers to run commands on remote build agents without exposing SSH directly.
  2. Educational Platforms: Provide students with isolated shell sessions over HTTPS for coding exercises, leveraging WeTTY’s lightweight footprint.
  3. Remote Administration: Deploy a secure, HTTPS‑only shell for system administrators to manage servers from any browser.
  4. Embedded Systems: Run WeTTY on IoT devices (e.g., Raspberry Pi) to expose a terminal over the local network without installing full SSH servers.

Advantages Over Alternatives

  • Performance: WebSocket streaming reduces latency compared to Ajax polling used by older terminals.
  • Feature Richness: xterm.js offers a modern terminal UI, color schemes, and mouse support that legacy terminals lack.
  • Ease of Deployment: Zero‑config Docker images, no external services

Open SourceReady to get started?

Join the community and start self-hosting WeTTY today