Sign inSign up

lamngockhuong/termote

By lamngockhuong

โ€ขUpdated 3 months ago

Remote control CLI tools (Claude Code, GitHub Copilot, any terminal) from mobile/desktop via PWA

Image
0

4.9K

lamngockhuong/termote repository overview

Termote

Release CI License GHCR Docker Pulls

Go React TypeScript PWA

Termote - Launched on J2TEAM Launch ย  Termote trรชn Unikorn.vn

Remote control CLI tools (Claude Code, GitHub Copilot, any terminal) from mobile/desktop via PWA.

Termote = Terminal + Remote

๐Ÿ‡ป๐Ÿ‡ณ Tiแบฟng Viแป‡tโ  | ๐Ÿ‡จ๐Ÿ‡ณ ็ฎ€ไฝ“ไธญๆ–‡โ  | ๐Ÿ‡ฏ๐Ÿ‡ต ๆ—ฅๆœฌ่ชžโ  | ๐Ÿ‡ฐ๐Ÿ‡ท ํ•œ๊ตญ์–ดโ  | ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑolโ  | ๐Ÿ‡ง๐Ÿ‡ท Portuguรชs (BR)โ  | ๐Ÿ‡ซ๐Ÿ‡ท Franรงaisโ  | ๐Ÿ‡ฉ๐Ÿ‡ช Deutschโ  | ๐Ÿ‡ท๐Ÿ‡บ ะ ัƒััะบะธะนโ  | ๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesiaโ 

โ Features

  • Session switching: Multiple tmux sessions with create/edit/delete
  • Session tabs: Horizontal tab bar for quick window switching
  • Mobile-friendly: Virtual keyboard toolbar (Tab/Ctrl/Shift/arrows, expandable)
  • Gesture support: Swipe for Ctrl+C, Tab, history navigation
  • Command history: Recall previously sent commands with search
  • Quick actions: Floating menu for common operations (clear, cancel, exit)
  • Connection indicator: Real-time server status with auto-detect disconnect
  • Update checker: Automatic new version notification from GitHub releases
  • PWA: Installable to homescreen, offline-capable
  • Persistent sessions: tmux keeps sessions alive
  • Collapsible sidebar: Desktop UI with toggleable session sidebar
  • Fullscreen mode: Immersive terminal experience
  • Config persistence: Auto-save installation settings with AES-256 encrypted password

โ Screenshots

Mobile Terminal ย ย  Session Sidebar

โ Architecture

flowchart TB
    subgraph Client["Client (Mobile/Desktop)"]
        PWA["PWA - React + TypeScript"]
        Gestures["Gesture Controls"]
        Keyboard["Virtual Keyboard"]
    end

    subgraph Server["tmux-api Server :7680"]
        Static["Static Files"]
        Proxy["WebSocket Proxy"]
        API["REST API /api/tmux/*"]
        Auth["Basic Auth"]
    end

    subgraph Backend["Backend Services"]
        ttyd["ttyd :7681"]
        tmux["tmux"]
        Shell["Shell"]
        Tools["CLI Tools"]
    end

    Gestures --> PWA
    Keyboard --> PWA
    PWA --> Static
    PWA <--> Proxy
    PWA --> API
    Auth -.-> Static & Proxy & API
    Proxy <--> ttyd
    API --> tmux
    ttyd --> tmux --> Shell --> Tools

โ Quick Start

๐Ÿ“– New to Termote? Check out the Getting Started Guideโ  for a complete walkthrough with examples.

./scripts/termote.sh                   # Interactive menu
./scripts/termote.sh install container # Container mode (docker/podman)
./scripts/termote.sh install native    # Native mode (host tools)
./scripts/termote.sh link              # Create 'termote' global command
make test                              # Run tests

After link, use termote from anywhere: termote health, termote install native --lan

Tip: Install gumโ  for enhanced interactive menus (optional, bash fallback available)

โ Installation

macOS/Linux:

# Download and prompt before install (defaults to native mode)
curl -fsSL https://raw.githubusercontent.com/lamngockhuong/termote/main/scripts/get.sh | bash

# Auto-install without prompt
curl -fsSL .../get.sh | bash -s -- --yes

# Download only (no install)
curl -fsSL .../get.sh | bash -s -- --download-only

# Auto-update with saved config
curl -fsSL .../get.sh | bash -s -- --update

# Install specific version
curl -fsSL .../get.sh | bash -s -- --version 0.0.4

# With explicit mode and options
curl -fsSL .../get.sh | bash -s -- --yes --container --lan
curl -fsSL .../get.sh | bash -s -- --yes --native --tailscale myhost

# Force new password (ignore saved config)
curl -fsSL .../get.sh | bash -s -- --yes --container --fresh

Windows (PowerShell):

Note: If script execution is disabled on your system, run this first:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
# Download and prompt before install (defaults to native mode)
irm https://raw.githubusercontent.com/lamngockhuong/termote/main/scripts/get.ps1 | iex

# Auto-install without prompt
$env:TERMOTE_AUTO_YES = "true"; irm .../get.ps1 | iex

# With explicit mode
$env:TERMOTE_MODE = "container"; irm .../get.ps1 | iex

# Auto-update with saved config
$env:TERMOTE_UPDATE = "true"; irm .../get.ps1 | iex
โ Docker
# All-in-one (auto-generates credentials, check logs: docker logs termote)
docker run -d --name termote -p 7680:7680 ghcr.io/lamngockhuong/termote:latest

# With custom credentials
docker run -d --name termote -p 7680:7680 \
  -e TERMOTE_USER=admin -e TERMOTE_PASS=secret \
  ghcr.io/lamngockhuong/termote:latest

# Without auth (local dev only)
docker run -d --name termote -p 7680:7680 \
  -e NO_AUTH=true \
  ghcr.io/lamngockhuong/termote:latest

# With volume for persistence
docker run -d --name termote -p 7680:7680 \
  -v termote-data:/home/termote \
  ghcr.io/lamngockhuong/termote:latest

# Mount custom workspace directory
docker run -d --name termote -p 7680:7680 \
  -v ~/projects:/workspace \
  ghcr.io/lamngockhuong/termote:latest

# With Tailscale HTTPS (requires Tailscale on host)
docker run -d --name termote -p 7680:7680 \
  -e TERMOTE_USER=admin -e TERMOTE_PASS=secret \
  ghcr.io/lamngockhuong/termote:latest
sudo tailscale serve --bg --https=443 http://127.0.0.1:7680
# Access at: https://your-hostname.tailnet-name.ts.net
โ From Release
# Download latest release
VERSION=$(curl -s https://api.github.com/repos/lamngockhuong/termote/releases/latest | grep tag_name | cut -d '"' -f4)
wget https://github.com/lamngockhuong/termote/releases/download/${VERSION}/termote-${VERSION}.tar.gz
tar xzf termote-${VERSION}.tar.gz
cd termote-${VERSION#v}

# Install (interactive menu or with mode)
./scripts/termote.sh install
./scripts/termote.sh install container
โ From Source
git clone https://github.com/lamngockhuong/termote.git
cd termote
./scripts/termote.sh install container

Note: termote.sh is the unified CLI supporting install (builds from source, uses pre-built artifacts when available), uninstall, and health commands.

โ Deployment Modes

flowchart LR
    subgraph Container["Container Mode"]
        direction TB
        C1["Docker/Podman"] --> C2["tmux-api :7680"] --> C3["ttyd :7681"] --> C4["tmux"]
    end

    subgraph Native["Native Mode"]
        direction TB
        N1["Host System"] --> N2["tmux-api :7680"] --> N3["ttyd :7681"] --> N4["tmux + Host Tools"]
    end

    User["User"] --> Container & Native
ModeDescriptionUse CasePlatform
--containerContainer modeSimple deployment, isolated envmacOS, Linux
--nativeAll nativeHost tool access (claude, gh)macOS, Linux
โ Options
FlagDescription
--lanExpose to LAN (default: localhost only)
--tailscale <host[:port]>Enable Tailscale HTTPS
--no-authDisable basic authentication
--port <port>Host port (default: 7680, Windows: 7690)
--freshForce new password prompt (ignore saved config)
--updateAuto-update with saved config
--version <ver>Install specific version (with or without v)
Environment VariableDescription
WORKSPACEHost directory to mount (default: ./workspace)
TERMOTE_USERBasic auth username (default: auto-generated)
TERMOTE_PASSBasic auth password (default: auto-generated)
NO_AUTHSet to true to disable authentication

Scripts auto-detect podman or docker โ€” both work identically.

./scripts/termote.sh install container             # localhost with basic auth
./scripts/termote.sh install container --no-auth   # localhost without auth
./scripts/termote.sh install container --lan       # LAN accessible
# Access: http://localhost:7680

# Custom workspace directory (mounted to /workspace in container)
WORKSPACE=~/projects ./scripts/termote.sh install container
WORKSPACE=/path/to/code make install-container

Security note: Avoid mounting $HOME directly โ€” sensitive directories like .ssh, .gnupg will be accessible in container. Mount specific project directories instead.

Use when you need access to host binaries (claude, git, etc):

# Linux
sudo apt install ttyd tmux
# Or: sudo snap install ttyd
./scripts/termote.sh install native

# macOS
brew install ttyd tmux go
./scripts/termote.sh install native
# Access: http://localhost:7680
โ With Tailscale HTTPS (all modes)

Uses tailscale serve for automatic HTTPS (no manual cert management):

# Tailscale only (default port 443)
./scripts/termote.sh install container --tailscale myhost.ts.net

# Custom port
./scripts/termote.sh install native --tailscale myhost.ts.net:8765

# Tailscale + LAN accessible
./scripts/termote.sh install container --tailscale myhost.ts.net --lan

# Access: https://myhost.ts.net (or :8765 for custom port)
โ Uninstall
./scripts/termote.sh uninstall container   # Container mode
./scripts/termote.sh uninstall native      # Native mode
./scripts/termote.sh uninstall all         # Everything
โ Updating
# Option 1: Auto-update with saved config
curl -fsSL .../get.sh | bash -s -- --update

# Option 2: Re-run one-liner (compares versions, prompts before install)
curl -fsSL .../get.sh | bash

# Option 3: Manual update
./scripts/termote.sh uninstall [container|native]
git pull origin main                    # If installed from source
./scripts/termote.sh install [container|native] [--lan] [--tailscale ...]

โ Platform Support

PlatformContainerNativeCLI Script
Linuxโœ“โœ“termote.sh
macOSโœ“โœ“termote.sh
Windowsโœ“โœ“termote.ps1

Windows Support: Container mode requires Docker Desktop or Podman Desktop; native mode requires psmux. Report any issues on GitHub.

โ Windows Native Mode

Windows native mode uses psmuxโ  (tmux-compatible terminal multiplexer for Windows):

# Install psmux
winget install psmux

# Run Termote
.\scripts\termote.ps1 install native
.\scripts\termote.ps1 install container  # Or container mode with Docker Desktop

# Update & logs
.\scripts\termote.ps1 update             # Self-update to latest release
.\scripts\termote.ps1 logs follow        # Tail all logs live

By default, install native downloads the fork/MSVC ttyd buildโ  (works on the latest Windows); pass -Ttyd official to use the upstream tsl0922/ttyd build instead.

โ Mobile Usage

ActionGesture
Cancel/interruptSwipe left (Ctrl+C)
Tab completionSwipe right
History upSwipe up
History downSwipe down
PasteLong press
Font sizePinch in/out

Virtual toolbar provides: Tab, Esc, Ctrl, Shift, Arrow keys, and common key combos. Supports Ctrl+Shift combinations (paste, copy). Toggle between minimal and expanded mode for additional keys (Home, End, Delete, etc.).

โ Project Structure

termote/
โ”œโ”€โ”€ Makefile                # Build/test/deploy commands
โ”œโ”€โ”€ Dockerfile              # Docker mode (tmux-api + ttyd)
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ entrypoint.sh           # Docker entrypoint
โ”œโ”€โ”€ docs/                   # Documentation
โ”‚   โ””โ”€โ”€ images/screenshots/ # App screenshots
โ”œโ”€โ”€ pwa/                    # React PWA
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ components/
โ”‚       โ”œโ”€โ”€ contexts/
โ”‚       โ”œโ”€โ”€ hooks/
โ”‚       โ”œโ”€โ”€ types/
โ”‚       โ””โ”€โ”€ utils/
โ”œโ”€โ”€ tmux-api/               # Go server
โ”‚   โ”œโ”€โ”€ main.go             # Entry point
โ”‚   โ”œโ”€โ”€ serve.go            # Server (PWA, proxy, auth)
โ”‚   โ””โ”€โ”€ tmux.go             # tmux API handlers
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ termote.sh          # Unix CLI (install/uninstall/health)
โ”‚   โ”œโ”€โ”€ termote.ps1         # Windows PowerShell CLI
โ”‚   โ”œโ”€โ”€ get.sh              # Unix online installer (curl | bash)
โ”‚   โ””โ”€โ”€ get.ps1             # Windows online installer (irm | iex)
โ”œโ”€โ”€ tests/                  # Test suite
โ”‚   โ”œโ”€โ”€ test-termote.sh
โ”‚   โ”œโ”€โ”€ test-termote.ps1    # Windows tests
โ”‚   โ”œโ”€โ”€ test-get.sh
โ”‚   โ””โ”€โ”€ test-entrypoints.sh
โ””โ”€โ”€ website/                # Astro Starlight docs site
    โ””โ”€โ”€ src/content/docs/   # MDX documentation

โ Development

make build          # Build PWA and tmux-api
make test           # Run all tests
make health         # Check service health
make clean          # Stop containers

# E2E tests (requires running server)
./scripts/termote.sh install container  # Start server first
pnpm --filter termote test:e2e       # Run Playwright tests
pnpm --filter termote test:e2e:ui    # Run with UI debugger

Manual Testing: See Self-Test Checklistโ 

โ Troubleshooting

โ Session not persisting
  • Check tmux: tmux ls
  • Verify ttyd uses -A flag (attach-or-create)
โ WebSocket errors
  • Check tmux-api logs: docker logs termote
  • Verify ttyd is running on port 7681
โ Mobile keyboard issues
  • Ensure viewport meta tag is present
  • Test on real device, not emulator
โ Native mode: processes not starting
ps aux | grep ttyd         # Check if ttyd is running
ps aux | grep tmux-api     # Check if tmux-api is running
lsof -i :7680              # Verify port is in use

โ Security Notes

  • Default: localhost only - not exposed to LAN unless --lan flag used
  • Basic auth enabled by default - use --no-auth to disable for local dev
  • Built-in brute-force protection - rate limiting (5 attempts/min per IP)
  • Use HTTPS (Tailscale) for production
  • Restrict to trusted networks/VPN

โ Other Projects

ProjectDescription
GitHub Flexโ A cross-browser extension (Chrome & Firefox) that enhances GitHub's interface with productivity features
TabRestโ Chrome extension that automatically unloads inactive tabs to free memory
Specpinโ Pin living, Git-versioned business specs onto the elements of your running web UI (browser extension + Go sidecar)

โ License

MIT

Tag summary

Content type

Image

Digest

sha256:376c31d0dโ€ฆ

Size

95.8 MB

Last updated

3 months ago

docker pull lamngockhuong/termote