@nickname4th/pura-cli
v0.1.6
Published
LAN Android device mirroring hub and developer CLI for distributed teams.
Downloads
144
Maintainers
Readme
pura

pura is a LAN Android device mirror for product and design teams. A central Hub shows all online Android devices, while each developer runs a local Agent that talks to their own USB-connected phone through ADB. Agents keep outbound connections to the Hub, so the Hub can run inside Docker without reaching back into developer laptops.
No login, no cloud, no public tunnel. It is meant for trusted office networks.
Quickstart
Start the Hub with Docker Compose:
docker compose up -dOpen the Hub:
http://<hub-lan-ip>:8787On each developer machine, connect an Agent. After this command starts, the Hub page shows every authorized Android device attached to this machine:
npx @nickname4th/pura-cli connect <hub-lan-ip>:8787 --name "Zhang San"On macOS, keep the Agent connected after login or terminal close. Install the CLI globally first so the background service has a stable executable path, then connect with --background:
npm install -g @nickname4th/pura-cli
pura-cli connect <hub-lan-ip>:8787 --name "Zhang San" --backgroundOpen the Hub page, find the device under devices to publish, and publish it from the web UI. Designers can then pick the published machine on the Hub homepage, open the live screen, and click on it with a mouse.
Project Site
The GitHub Pages site lives in site/ and is deployed by .github/workflows/pages.yml.
After publishing the repository, enable GitHub Pages with GitHub Actions as the source. The public URL will be:
https://liutianjie.github.io/pura/Requirements
- Node.js 20+ for developer Agents
- Android platform-tools:
adb - Android USB debugging enabled and authorized on each developer machine
- Docker and Docker Compose for Hub deployment
- Hub can reach every Agent over the LAN
- A modern browser
Installation
Developers can use pura without installing it permanently:
npx @nickname4th/pura-cli --helpOr install globally:
npm install -g @nickname4th/pura-cli
pura-cli --helpFor repository development:
npm install
npm run build
npm linkHub Deployment
Recommended Docker Compose deployment:
docker compose up -dThe included compose file builds the local image by default. To use a published GHCR image:
PURA_IMAGE=ghcr.io/liutianjie/pura:main docker compose up -dEquivalent Node.js deployment:
pura-cli hub --host 0.0.0.0 --port 8787Developer Agent
Each developer connects their local Agent to the Hub. Once connected, the Hub web UI lists all authorized local Android devices, including devices that are not published yet:
pura-cli connect 192.168.100.128:8787 --name "Zhang San"The Agent keeps an outbound control WebSocket to the Hub and continuously reports local ADB devices. Use the web UI to publish, rename, unpublish, and manage devices.
The Agent still exposes 8788 locally for diagnostics and standalone mode, but the Hub no longer depends on reverse HTTP access to that port. In normal Hub deployments, you should not need --public-url.
For diagnostics, you can still override the announced local URL:
pura-cli connect 192.168.100.128:8787 --name "Zhang San" --public-url http://192.168.100.45:8788The Agent heartbeat automatically recovers after Wi-Fi or Hub restarts as long as the Agent process is still running. On macOS, install the saved Agent connection as a LaunchAgent so it starts at login and restarts if the terminal is closed:
pura-cli connect 192.168.100.128:8787 --name "Zhang San" --backgroundCheck or remove the background service:
pura-cli auto-connect --status
pura-cli auto-connect --uninstallPublish Device
Connect a phone over USB and confirm it is authorized:
adb devices -lThen run or install the Agent:
pura-cli connect 192.168.100.128:8787 --name "Zhang San" --backgroundOpen the Hub page and publish the device from the web UI.
The CLI also has a shortcut for scripts:
pura-cli connect device --name "Zhang San Pixel 8" --owner "Zhang San" --note "login branch"If multiple Android devices are connected:
pura-cli connect device --serial RFCY10DHQ3P --name "Samsung S25" --owner "Li Si"Runtime Model
- Hub maintains online Agents and devices, serves the web UI, and proxies video WebSocket/tap requests.
- Agent runs on each developer machine and owns ADB, screen capture, tap execution, and device metadata.
- Agent opens outbound control/video WebSockets to the Hub. The Hub does not need to call back into Agent LAN addresses, which makes Docker/NAT/firewall deployment much more reliable.
- CLI commands:
pura-cli hubpura-cli connect <hub>pura-cli auto-connectpura-cli connect devicepura-cli devices
API
Hub:
POST /api/agents/heartbeatGET /api/devicesPOST /api/devices/:deviceId/sessionPOST /api/devices/:deviceId/tapPUT /api/devices/:deviceId/publicationDELETE /api/devices/:deviceId/publicationDELETE /api/sessions/:idWS /ws/sessions/:id/videoWS /ws/agents/:agentId/controlWS /ws/agents/:agentId/sessions/:agentSessionId/video
Agent:
GET /api/devicesPOST /api/devices/:serial/sessionPOST /api/devices/:serial/tapPUT /api/devices/:serial/publicationDELETE /api/devices/:serial/publicationDELETE /api/sessions/:idWS /ws/sessions/:id/video
Environment
ROLE=hub|agent|standaloneHOST=0.0.0.0PORT=8787HUB_URL=http://<hub-ip>:8787AGENT_IDAGENT_NAMEPUBLIC_URL=http://<agent-ip>:8788optional diagnostic URL; Hub control does not depend on itADB_PATH=adbSTREAM_SIZEoptional; unset uses native device resolutionSTREAM_BITRATE=8000000STREAM_TIME_LIMIT_SECONDS=180INCLUDE_TCP_DEVICES=trueDATA_DIR=data-agent
Publishing
The npm package is @nickname4th/pura-cli and installs the pura-cli binary.
Release flow:
- Update
versioninpackage.json. - Run
npm run check,npm run build, andnpm pack --dry-run. - Publish manually with
npm publish --access public, or push a tag likev0.1.3to use the release workflow. - The Docker workflow publishes
ghcr.io/liutianjie/pura:mainfrommainand builds bothlinux/amd64andlinux/arm64.
The release workflow requires an NPM_TOKEN repository secret.
Notes
- The current video path uses Android
screenrecordH.264 output. No Android app or root is required. - Mouse control supports tap, long press, scroll/swipe, system keys, text input, screenshots, and shared cursor annotations.
- Do not expose Hub or Agent ports directly to the public internet.
- Agent Docker is intentionally not the default because local USB/ADB access is much smoother with native
pura-cli. - Some Android builds enforce
screenrecordtime limits; the Agent restarts the stream automatically when it exits.
