Skip to content

Repository files navigation

SerialPeer

SerialPeer is a Nuxt 4 Web Serial console with live peer-to-peer sharing. A host connects a serial device, creates a session, and sends its invitation link to up to five guests. Guests can watch the output immediately and can write to the device only after the host grants control.

Features

  • Connect to serial devices, monitor decoded output, and send ASCII or HEX data.
  • Share live serial output over an encrypted WebRTC data channel.
  • Join from an invitation link or session ID, with an explicit confirmation before connecting.
  • Keep every guest read-only by default; hosts approve, revoke, or remove each guest independently.
  • Replay a bounded window of output for guests that join late or reconnect.
  • Record and export logs locally, and manage local quick or timed commands.
  • Use English or Chinese, light/dark/system themes, and an installable PWA interface.
  • Keep the serial monitor and sender in view while desktop tools live in a resizable sidebar and mobile tools open from a bottom drawer.

Requirements

  • Node.js 22.12 or a newer supported LTS release
  • npm
  • Chrome or Edge for the host (Web Serial and WebRTC support)
  • A WebRTC-capable modern browser for guests that only watch or send remotely
  • HTTPS in production; http://localhost is accepted during local development

Web Serial support varies by platform. In particular, Firefox and Safari cannot host a serial session. Mobile USB support also depends on the browser and device. The host must grant serial-port access from a user gesture.

Install and run

git clone https://github.com/0x1abin/serialpeer.git
cd serialpeer
npm ci
cp .env.example .env
npm run dev

Open http://localhost:3000.

For a production build:

npm run build
npm run preview

Static generation remains available through npm run generate.

Share a serial session

  1. On the host, connect a serial device from Connection Settings.
  2. Choose Share session and create a session.
  3. Share the generated link or QR code. Treat the invitation link as a secret: possession of its high-entropy session ID allows a guest to ask to join.
  4. A guest opens the link, confirms their display name, and explicitly joins. They can now see new output but cannot send data.
  5. The guest requests control. The host can grant or revoke it from the participant list. The host can also remove a guest or end the whole session.

Serial traffic uses WebRTC. The default PeerJS Cloud service provides signalling only: it helps browsers discover each other but does not receive the serial data channel. When a direct route cannot be established and you configure TURN, the TURN server may relay the still-encrypted WebRTC traffic.

The current sharing scope is intentionally narrow. SerialPeer does not sync files, saved log files, quick-command sets, timed-command sets, serial settings, or output captured before sharing began. Guest logs and saved commands remain local to that guest.

PeerJS and ICE configuration

Without configuration, SerialPeer uses PeerJS Cloud for signalling and the PeerJS default ICE configuration. Production deployments can point the client at a self-hosted PeerServer and provide their own ICE/TURN servers:

Environment variable Purpose Default
NUXT_PUBLIC_PEER_HOST PeerServer hostname; leave empty for PeerJS Cloud empty
NUXT_PUBLIC_PEER_PORT PeerServer port provider default
NUXT_PUBLIC_PEER_PATH PeerServer HTTP path /
NUXT_PUBLIC_PEER_SECURE Use TLS for signalling (true/false) true
NUXT_PUBLIC_PEER_ICE_SERVERS_JSON JSON array of RTCIceServer entries PeerJS defaults

Example for a local PeerServer:

NUXT_PUBLIC_PEER_HOST=peer.example.com
NUXT_PUBLIC_PEER_PORT=443
NUXT_PUBLIC_PEER_PATH=/peerjs
NUXT_PUBLIC_PEER_SECURE=true
NUXT_PUBLIC_PEER_ICE_SERVERS_JSON=[{"urls":"stun:stun.example.com:3478"},{"urls":"turn:turn.example.com:3478","username":"temporary-user","credential":"temporary-password"}]

Use short-lived TURN credentials in a real deployment. Long-lived credentials stored in a public Nuxt runtime configuration are visible to every browser.

Tests

Unit tests cover protocol validation and the bounded replay buffer. The browser test starts an official local PeerServer plus Nuxt, injects a Web Serial device at the browser boundary, and drives two isolated browser contexts through the real sharing UI.

npm run typecheck
npm test
npx playwright install chromium
npm run test:e2e

The end-to-end test never calls PeerJS Cloud and does not require physical serial hardware.

Tech stack

License

This project is licensed under the MIT License. See LICENSE when present in the source distribution.

About

A web-based serial port debugging tool built with Nuxt 3, providing a modern interface for serial communication.

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages