Self-hosting the CC Pocket relay

Self-hosting changes who operates the routing service. It does not move Claude Code, Codex, or your repository off your computer.

Last verified July 13, 2026Infrastructure guideMIT source
Architecture

Phone or desktop client → WebSocket relay → daemon on your computer → Claude Code or Codex CLI. Content is end-to-end encrypted between client and daemon.

The four components

ComponentWhere it runsResponsibility
ClientPhone, tablet, or another computerShows sessions, sends input, and displays approval requests
RelayPublic serverAuthenticates connections and routes encrypted frames
DaemonYour coding computerMaintains the encrypted endpoint and drives the local CLI
Coding agentYour coding computerClaude Code or Codex reads and edits the selected project

Hosted relay or your relay?

The default service minimizes setup. Running your own relay gives you operational control over availability, logs, network policy, updates, and retained routing records. End-to-end encryption is still necessary in either case because the relay remains outside the trusted content endpoints.

Self-hosting does not eliminate metadata visible to the relay operator: source IPs, connection times, account-to-device routing, and ciphertext size and timing remain observable.

Deployment shape

The repository provides a Java 17 relay distribution, a hardened systemd unit, and a Caddy reverse-proxy example. The reference layout binds the Kotlin/Ktor relay to loopback, stores routing state in SQLite, and lets Caddy provide public TLS and WebSocket proxying.

  1. Build the relay distribution from the tagged source.
  2. Run it as a dedicated, unprivileged service account with a persistent SQLite directory.
  3. Place a TLS reverse proxy in front of the loopback listener.
  4. Point the daemon and client pairing flow at your wss:// relay URL.
  5. Monitor the health endpoint, logs, certificate renewal, storage, and upgrade process.

Use the version-matched deployment files rather than copying commands from this overview.

What you become responsible for

Self-hosting is an infrastructure task. Incorrect TLS, database permissions, proxy timeouts, or upgrade procedures can cause outages. Review the deployment and security documents before exposing a relay publicly.

Primary sources

  1. CC Pocket relay deployment runbook and service files.
  2. CC Pocket security and trust model.
  3. Relay source code.