WebChatDocsPrivate relay

Private relay

Source: docs/private-relay.md · USER

Users can run their own relay server and keep the same WebChat GUI, CLI, groups, files, voice, receive-language translation, floating language keyboard, and session behavior.

Server Setup

On the server:

cd /path/to/WebChat
cp relay/.env.example relay/.env.local
mkdir -p relay/data relay/pchat_uploads
WEBCHAT_RELAY_PORT=5110 ./start_relay.sh

The relay listens on:

http://SERVER_IP:5110

For real public use, put HTTPS in front of it with Caddy, Nginx, Cloudflare, or another reverse proxy:

https://chat-relay.example.com

Docker

cd /path/to/WebChat
cp relay/.env.example relay/.env.local
docker compose -f docker-compose.private-relay.yml up -d --build

Downloadable Package

Build a package for users to download and install:

scripts/package_private_relay.sh

More details:

docs/private-server-install.md

Production Notes

Set this in relay/.env.local for public servers:

PCHAT_DEV_EXPOSE_CODES=false

Configure SMTP so users can receive login codes:

SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USERNAME=webchat@example.com
SMTP_PASSWORD=change-me
SMTP_FROM=webchat@example.com

Keep these directories persistent:

relay/data
relay/pchat_uploads

Connect Users

In WebChat GUI:

  1. Open Settings.
  2. Open Advanced relay, phone bridge, translation.
  3. Choose Private Server Relay.
  4. Set Relay Server URL to your server URL.
  5. Save and sign in with email.

Or share a launch link:

scripts/private_relay_link.py \
  --site https://your-webchat-site.example.com/app/webchat/chat.html \
  --relay https://chat-relay.example.com

Users opening that link will use the private relay, while the rest of the app works the same.