Architecture

Where the work runs.
Where the data goes.

Shellbell keeps execution on your computer. The phone renders the session and sends input. Terminal access waits for verified direct WebRTC, through a TURN server when a network blocks the direct path. The relay coordinates the connection and never carries terminal content.

Explore the data flow

Connection paths
Your computer

Computer service

Reads your terminal.
Encrypts screen updates.
Accepts authenticated input.

Keys stay here
WebRTC
data channel
Encrypted
terminal traffic
Your phone

Mobile app

Decrypts screen updates.
Renders the terminal.
Encrypts your replies.

Keys stay here
Your chosen relaySetup & coordination

Once WebRTC connects, screens, history and input travel directly between your devices. The relay stays connected for pairing, encrypted signaling, revocation and push. It never carries terminal content.

Your terminal content stays end-to-end encrypted on both paths and never passes through the relay. Transport details

Three components.
Different responsibilities.

A phone connection gives you access to the existing session. It doesn’t move the process or start another shell.

Computer service

Adapts iTerm2, tmux, or Herdr sessions. Captures the watched screen, reads history in chunks, and passes acknowledged input to the terminal backend.

Execution & session state

Mobile app

Displays Chat, Terminal and Reading views, switches sessions, and sends input. Pairing keys stay local. Terminal content is held in memory while in use.

Rendering & control

Relay

Authenticates devices, handles pairing and encrypted signaling, issues short-lived TURN credentials, and attempts native push delivery. It carries no terminal content and has no terminal decryption keys.

Coordination & delivery

How a direct route takes over.

Terminal access waits for a verified direct connection. When a network blocks it, WebRTC can route the same encrypted channel through a TURN server instead.

  1. Find and authenticate.

    Both devices connect outward to the chosen relay. Existing pairing identities establish an encrypted session.

  2. Negotiate privately.

    WebRTC offers, answers, and network candidates travel in encrypted signaling. The devices check certificates and fresh keys before agreeing to switch.

  3. Stream directly. Recover when needed.

    Screens, history, and input move onto the data channel, directly or through TURN. A lost route pauses the terminal while WebRTC retries; the relay never carries terminal data.

What stays connected after the switch?

Both relay WebSockets stay open for coordination, revocation, signaling, and push, but no terminal bytes pass through them. STUN handles address discovery. When the relay offers TURN, signed-in devices receive 24-hour credentials, and networks that block a direct path relay the encrypted data channel through TURN. The phone can reach TURN over UDP, TCP or TLS on port 443; the computer uses UDP only.

Can I turn TURN off?

Yes. TURN is on by default so a phone on a restrictive network can still reach your computer. A TURN server can’t read your terminal, but it sees both devices’ addresses, when they connect and how much data passes. To keep terminal data off TURN servers entirely, turn it off on the computer: in the Mac app, Settings → General → Allow TURN fallback; on a headless computer, shellbell config set turn off. Then restart the service.

With TURN off, the relay gives neither the computer nor its phones any TURN server, so no route through one can exist. As a second check, the computer accepts only routes it can show are direct and sends no terminal data until it has. The phone needs no setting. A self-hosted relay needs version 0.3.0 or newer for this. The cost: from networks that block direct connections, such as some mobile carriers, hotel Wi-Fi or company networks, your phone can’t reach the computer until it moves to another network.

Turning TURN off
What happens to input during a reconnect?

The computer checks the pairing and session before passing input to the backend. Request identifiers and acknowledgements support recovery. Input with an uncertain outcome is not automatically replayed during a route switch.

A live terminal when you open it.
Native push when you leave.

The phone doesn’t keep a terminal connection running in the background. This limits background work without requiring constant polling.

App in the foreground

Stream the session you’re viewing.

The computer coalesces screen changes into bounded updates. History loads in chunks. The remote terminal keeps its own size instead of resizing to the phone.

App in the background

Close the live connections.

Attention events use Google FCM on Android or Apple APNs on iOS. Open the alert to reconnect. Actual battery use depends on the phone and how you use it.

Native notification design

Approval creates the trust.

Pairing grants control of sessions exposed by the computer’s OS user. Approve only devices you trust.

A temporary invitation, then local keys.

The QR code carries a public identity, relay address, temporary gate token, and separate pairing secret. The default window lasts five minutes. The relay receives a gate hash rather than that separate secret. After approval, both devices save pairing keys locally.

Pairing protocol Stored-data inventory

Read the contracts.

The source documentation goes beyond this overview into transport, storage, lifecycle, and security decisions.

Want the relay under your own account?

Compare the supplied runtimes and the operational responsibilities that come with self hosting.

Self hosting and organizations