npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hmawla/termserver

v1.0.9

Published

Share your terminal sessions with mobile devices over your local network

Readme

termserver

Node.js Tests Android Build

Share your terminal sessions with mobile devices over your local network.

Run htop, npm run dev, copilot ., or any command on your machine, then view and optionally control it from your phone, hands-free.

Requirements

  • Node.js ≥ 18
  • Linux or macOS (Windows: ConPTY via node-pty — experimental)
  • The companion Flutter mobile app (Android/iOS) — see termserver_app/

Installation

npm install -g @hmawla/termserver

node-pty requires native compilation. Make sure you have a C++ build toolchain:

  • Linux/macOS: build-essential / Xcode Command Line Tools
  • Windows: Visual Studio Build Tools

Quick Start

# 1 — Pair your phone (first time only)
termserver pair

# 2 — Run a command in a shared session
termserver -c "htop"

Commands

termserver pair

Generates a QR code and starts the daemon. Scan the QR with the mobile app to pair your device. The daemon keeps running after pairing — press Ctrl+C to stop it.

termserver pair

If the phone uses manual entry (IP + port) instead of scanning the QR, the matching code is printed when the phone initiates the request.

Note: If the daemon is already running you must stop it first (Ctrl+C), then re-run termserver pair.


termserver -c <command>

Runs a command in a shared PTY session. If a daemon is already running the session attaches to it; otherwise a temporary daemon is started and torn down when the command exits.

termserver -c "htop"
termserver -c "bash"
termserver -c "npm run dev"
termserver -c "copilot ."

Paired mobile devices see a live list of active sessions and can connect to any of them.


termserver daemon

Starts the daemon in the foreground without creating a pairing or running a command. Useful if you want the daemon running permanently and will pair separately.

termserver daemon

termserver devices

Lists all paired devices with their IDs and pairing timestamps.

termserver devices

termserver unpair <id>

Revokes a paired device by ID (get the ID from termserver devices).

termserver unpair abc123

How It Works

Your machine                          Phone
──────────────────                    ──────────────────
termserver pair                       Scan QR  ──────────────────────┐
  └─ starts daemon                    OR enter IP + port             │
  └─ creates pairing ◄────────────────────────────────── POST /pair/complete
                                      saves device token             │
termserver -c "htop"                                                 │
  └─ creates PTY session              connects to session ────────────┘
  └─ streams output ──────────────────────────────────── WS /ws/sessions/:id
  └─ optional resize ◄──────────────────────────────────
  1. Daemon — Express + WebSocket server (default port 8787), started on demand.
  2. Pairing — One-time QR/code exchange issues a persistent per-device bearer token.
  3. Sessions — Commands run in a PTY; output is buffered and streamed over WebSocket. Multiple clients can observe simultaneously; one at a time can hold control.
  4. Resize — When a phone connects it resizes the PTY to its screen size; when it disconnects the PTY is restored to its pre-connection dimensions.
  5. Config — Paired devices and port preference are stored in ~/.config/termserver/ (via conf).

REST API

| Method | Path | Auth | Description | |--------|------|------|-------------| | POST | /pair/initiate | — | Start manual pairing (returns sessionToken) | | POST | /pair/complete | — | Complete pairing with code + token | | GET | /devices | Admin | List all paired devices | | DELETE | /devices/:id | Bearer | Revoke a device (self or admin) | | GET | /sessions | Bearer | List active sessions | | GET | /sessions/:id | Bearer | Get session details | | POST | /sessions | Admin | Create a new session |

WebSocket API

| Path | Auth | Description | |------|------|-------------| | /ws/sessions/:id?token=… | Bearer | Terminal I/O stream | | /ws/events?token=… | Bearer | Session lifecycle events |

Messages — Client → Server

| Type | Payload | Description | |------|---------|-------------| | input | { data: string } | Send keystrokes | | resize | { cols, rows } | Resize the PTY | | request_control | — | Request exclusive write access | | release_control | — | Release exclusive write access |

Messages — Server → Client

| Type | Payload | Description | |------|---------|-------------| | output | { data: string } | Terminal output | | session_info | { cols, rows } | Current PTY dimensions on connect | | session_closed | { exitCode } | Process exited | | sessions_list | { sessions: [] } | Full session list (on connect + changes) |

Mobile App

The companion Flutter app lives in termserver_app/. It handles:

  • Pairing via QR scan or manual IP + port entry
  • Session browser — live list of sessions on the connected device
  • Terminal emulator — full xterm-compatible view with resize
  • Special-keys bar — Esc, Tab, arrows, Home/End, PgUp/PgDn, Ctrl/Alt combos
  • Multi-device — save and switch between multiple paired machines
  • Rename / unpair from the app

Download APK

Pre-built Android APKs are uploaded as GitHub Actions artifacts on every version bump. Open the latest successful Flutter Android Build run and download the artifact named termserver-android-v<version>.

Build from source

cd termserver_app
flutter pub get
flutter run

License

MIT