TermChat is an open-source terminal chat client with end-to-end encrypted one-to-one sessions. Clients discover one another through a relay, then exchange ephemeral X25519 public keys and encrypt chat data locally with AES-256-GCM.
The relay assigns temporary six-character IDs and forwards protocol packets. It does not receive private keys, shared secrets, or plaintext chat messages.
The default client relay is the deployed Cloudflare Worker:
wss://termchat-relay.meetkhamar3501.workers.dev/ws
Health check: https://termchat-relay.meetkhamar3501.workers.dev/health
chmod +x bin/termchat-linux
./bin/termchat-linuxThe client uses the current Cloudflare relay automatically. To select another relay:
./bin/termchat-linux -server wss://example.com/wsRequirements: Go 1.23 or newer.
git clone https://github.com/viveksec/termchat.git
cd termchat
go run ./cmd/clientOr build a local binary:
mkdir -p bin
go build -o bin/termchat ./cmd/client
./bin/termchatThe bin/ directory contains builds for:
| File | Platform |
|---|---|
termchat-linux-amd64 |
Linux x86_64 |
termchat-linux-arm64 |
Linux ARM64 |
termchat-macos-amd64 |
macOS Intel |
termchat-macos-arm64 |
macOS Apple Silicon |
termchat-windows-amd64.exe |
Windows x86_64 |
termchat-windows-arm64.exe |
Windows ARM64 |
Run the binary that matches the operating system and architecture. Release builds can be regenerated with:
./build-cross-platform.sh- Start the client on two machines.
- Each client receives a temporary ID shown in the user list.
- On one client, enter
/connect USER_ID. - Accept the request on the other client.
- Verify the safety number out of band with
/verifyorCtrl+V. - Send messages after the encrypted session is established.
Commands:
| Command | Purpose |
|---|---|
/connect USER_ID |
Request a session with another online user |
/disconnect or /leave |
End the current session |
/sendfile PATH |
Send an encrypted file to the peer |
/verify |
Display the session safety number |
/whoami |
Display your temporary user ID |
/clear |
Clear chat history |
/panic |
Show the privacy screen |
/help |
Show built-in help |
Press F1 for help and Ctrl+C to exit. Use -log FILE when troubleshooting connection problems:
./bin/termchat-linux -log /tmp/termchat.logThe server can also be selected with TERMCHAT_SERVER:
export TERMCHAT_SERVER=wss://example.com/ws
./bin/termchat-linuxThe repository includes a self-hosted Go relay for local development or a server you operate yourself:
go run ./cmd/server -addr :8080In another terminal:
go run ./cmd/client -server ws://localhost:8080/wsThe Go relay supports PORT, PUBLIC_HOST, and PUBLIC_TLS for deployment environments. For Docker-based deployments, see Dockerfile and docker-compose.yml. The included render.yaml is an optional Render deployment configuration.
The production relay is implemented with a Cloudflare Worker and Durable Object. Deployment and local Worker development instructions are in cloudflare/README.md.
cd cloudflare
npm install
npx wrangler login
npx wrangler deployClients connect to the deployed Worker at its /ws path using wss://.
Run all Go tests:
go test ./...Run the demo:
go run ./cmd/demoThe protocol and cryptography packages have focused unit tests. The relay tests cover connection IDs, user-list broadcasts, routing, and an encrypted session flow.
cmd/client/ Terminal client and WebSocket connection manager
cmd/server/ Go WebSocket relay
cmd/demo/ Protocol and encryption demonstration
pkg/crypto/ X25519, key derivation, AES-GCM, and safety numbers
pkg/protocol/ Shared JSON packet types
cloudflare/ Cloudflare Worker relay and Durable Object
scripts/test-relay/Relay test utility
bin/ Cross-platform client and relay binaries
- Chat payloads are encrypted before they are sent to the relay.
- Each client creates an ephemeral X25519 key pair for its process session.
- AES-GCM authenticates encrypted messages and file chunks.
- The safety number should be compared through a separate trusted channel.
- The relay still sees connection metadata such as temporary IDs, timing, and packet routing fields.
TermChat is provided under the MIT License.