Skip to main content

A professional, globally-connected, E2E encrypted terminal chat for developers.

Project description

DevChat P2P

A terminal chat application for developers who work in the command line

Python 3.9+ License: MIT PyPI Platform

A globally connected, end-to-end encrypted terminal chat application.

Connect with any developer directly from your terminal. No accounts, no servers to manage, and no data collection. Just encrypted communication between two machines.

Built by Soumyadip Ghosh


Why DevChat

DevChat solves a few recurring problems for developers who prefer the terminal.

Problem How DevChat handles it
Sharing a code snippet with a remote colleague Markdown rendering with syntax highlighting
Not wanting to route private conversations through third-party chat apps End-to-end Fernet encryption, with keys held only on your machines
Chat apps cluttering project folders with config files All data stays in ~/.devchat/, leaving your workspace untouched
Firewalls and NATs blocking direct connections An MQTT relay that works across most networks
Sending files securely Chunked, encrypted file transfer built in

Features

  • Global connectivity through an MQTT relay over TLS (port 8883) that traverses most NAT and firewall setups
  • End-to-end encryption using Fernet symmetric encryption, with the shared key kept on your terminal
  • Encrypted file transfer with chunked delivery and progress tracking
  • Rich terminal UI built with Textual, including Markdown rendering and syntax highlighting
  • Message delivery receipts that track SENDING → DELIVERED → READ status in real time
  • Live typing indicators that show when your peer is typing, debounced to avoid noise
  • Persistent local history stored in ~/.devchat/history.db using SQLite with WAL mode
  • CSV export of your full chat history with a single command
  • Latency ping to measure connection round-trip time in milliseconds
  • Clean workspace with no files written to your project directories
  • Automatic reconnection that handles disconnects gracefully
  • Clipboard integration that copies auth tokens when a room is created

Installation

From PyPI (recommended)

pip install devchat-p2p

From source

# 1. Clone the repository
git clone https://github.com/dev-soumyadip/devchat-p2p.git
cd devchat-p2p

# 2. Install in editable mode
pip install -e .

Verify the installation

devchat --help

Expected output:

usage: devchat [-h] {config,history,export,host,join} ...

DevChat Professional Interface

positional arguments:
  {config,history,export,host,join}
    config              Set Global Identity
    history             Print local persistent chat history
    export              Export history to CSV in downloads folder
    host                Initialize a secure global room
    join                Connect to an existing room

options:
  -h, --help            show this help message and exit

Quick start

Step 1: Set your identity (optional but recommended)

devchat config --username "yourname" --email "your@email.com"

If you skip this step, you will appear as guest_xxxx@devchat.

Step 2: Host a secure room

devchat host

This creates a unique encrypted room, generates a secure auth token, and copies that token to your clipboard (or prints it to the terminal). Share the token with the person you want to chat with. If you lose it, run /copytoken inside the chat to copy it again.

Step 3: Join a room from the other machine

devchat join <AUTH_TOKEN>

Paste the token you received and you are connected.

Step 4: Start chatting

  • Type a message and press Enter to send it
  • Use Markdown syntax, which renders inline:
    • `inline code`, bold, italic
    • Code blocks with syntax highlighting (```python)
  • Press Ctrl+Q to quit

Command reference

CLI commands

Command Description Example
devchat host Create a new encrypted chat room devchat host
devchat join <token> Join an existing room using an auth token devchat join aBcD3F...
devchat config Set your global identity devchat config --username "alice"
devchat history Print all saved messages to the terminal devchat history
devchat export Export full chat history as CSV devchat export

Config options

Flag Description Example
--username Set your display name devchat config --username "alice"
--email Set your email (stored locally) devchat config --email "a@b.com"
--pubkey Store a public key reference devchat config --pubkey "ssh-rsa..."

In-chat commands

Command Description
/help Show all available in-chat commands
/file <path> Send a file, with live autocomplete
/send <path> Alias for /file
/copytoken Copy the auth token to the clipboard again
/ping Measure round-trip connection latency in ms
/status Show your identity and current room ID
/export Export chat history to a CSV file
/clear Clear the terminal chat display
/quit Exit the application

File autocomplete: when you type /file followed by any letters, DevChat shows real-time file suggestions from your current directory. It supports fuzzy matching, so typing main will find src/main.py.

Keyboard shortcuts

Shortcut Action
Enter Send message
Ctrl+Q Quit the application

File transfer

DevChat can send files of any type over the encrypted channel.

Sending a file

On Windows:

/file C:\Users\you\Documents\report.pdf

On macOS or Linux:

/send ~/Documents/report.pdf

How it works

  1. The file is split into 32KB chunks
  2. Each chunk is Base64 encoded, then Fernet encrypted, then sent over TLS MQTT
  3. The receiver sees a real-time progress bar
  4. Chunks are reassembled and verified on arrival
  5. The completed file is saved to ~/.devchat/downloads/

Security notes

  • Filenames are sanitized, which blocks path traversal attempts
  • Chunk integrity is verified before assembly
  • Data passes through Fernet encryption, then TLS, then MQTT

Data storage and privacy

All persistent data is stored in your home directory. Nothing is written to your project folders.

~/.devchat/
├── config.json        # Your identity (username, email)
├── history.db         # SQLite message history (WAL mode)
├── devchat.log        # Rotating application logs (5MB x 3)
└── downloads/         # Received files and CSV exports
    ├── report.pdf
    └── export_20260624_211500.csv
Item Location Purpose
Config ~/.devchat/config.json Stores username, email, and public key reference
Database ~/.devchat/history.db All messages with timestamps, status, and sender
Logs ~/.devchat/devchat.log Rotating debug and error logs
Downloads ~/.devchat/downloads/ Received files and CSV exports

Windows path: C:\Users\<you>\.devchat\

macOS and Linux path: /home/<you>/.devchat/ or /Users/<you>/.devchat/


Architecture overview

┌──────────────┐          TLS (8883)          ┌──────────────┐
│   DevChat A   │◄──── MQTT Broker ────►│   DevChat B   │
│   (Host)      │    broker.hivemq.com        │   (Joiner)   │
└──────┬────────┘                              └──────┬────────┘
       │                                              │
   Fernet E2E                                    Fernet E2E
   Encryption                                    Decryption
       │                                              │
   ┌───▼────┐                                   ┌─────▼─────┐
   │ SQLite  │ ~/.devchat/history.db             │  SQLite   │
   │  (WAL)  │                                   │  (WAL)    │
   └─────────┘                                   └───────────┘

Design decisions

Layer Technology Reasoning
Transport MQTT over TLS Traverses NAT and firewalls, and works behind many corporate proxies
Broker HiveMQ (public) Globally available with a reliable free tier
Encryption Fernet (AES-128-CBC with HMAC) Symmetric and fast, with the key shared through the token
UI framework Textual (Python) Rich terminal UI with Markdown and syntax highlighting
Storage SQLite with WAL Thread-safe and zero-config, with no external database
Token Base64(room_id:fernet_key) A single string that carries both routing and encryption info

System requirements

Requirement Minimum
Python 3.9 or higher
OS Windows 10+, macOS 10.15+, or any modern Linux distribution
Network Internet access with outbound TCP port 8883 for MQTT over TLS
Terminal Any modern terminal, such as Windows Terminal, iTerm2, or GNOME Terminal

Dependencies (installed automatically)

Package Purpose
textual Terminal UI framework
rich Markdown rendering and syntax highlighting
paho-mqtt MQTT client for global connectivity
cryptography Fernet end-to-end encryption
pyperclip Clipboard integration (optional)

Troubleshooting

Connection rejected or unable to connect

  • Check your internet connection
  • Confirm that outbound TCP port 8883 is open, since some corporate firewalls block it
  • Try a different network, such as a mobile hotspot, to isolate the issue

Token error when joining

  • Make sure you copied the entire token string
  • Tokens are single use per room, so a new token is generated if the host restarts
  • Avoid adding extra spaces or newlines when pasting

No clipboard support

  • On headless Linux servers, pyperclip may not work, so the token is printed to the terminal instead
  • On Linux, install xclip or xsel, for example sudo apt install xclip

Messages not appearing

  • Check ~/.devchat/devchat.log for error details
  • Confirm that both peers are using the same token
  • Run /ping, and if you receive a pong response, the connection is working

Usage examples

Quick chat between two developers

Developer A (host):

$ devchat config --username "alice"
[*] Configuration saved to ~/.devchat/config.json

$ devchat host
# UI launches, token is copied to clipboard
# Share the token with Developer B

Developer B (joiner):

$ devchat config --username "bob"
$ devchat join "dGhpcyBpcyBhIHNhbXBsZSB0b2tlbg=="
# UI launches, connected to Alice's room

Send a file

# Inside the chat UI, type:
/file ./my_script.py

# Output:
# [*] INITIATING TRANSFER: my_script.py
# [*] UPLOADING my_script.py ... 100%
# [*] UPLOAD COMPLETE: my_script.py

Export chat history

# From the CLI:
$ devchat export
[*] History successfully exported to ~/.devchat/downloads/export_20260624_211500.csv

# Or from inside the chat UI:
/export

Check connection quality

# Inside the chat UI:
/ping

# Output:
# [*] PONG received: 42.37ms latency

Roadmap

  • Multi-room support with tabs
  • Message reactions (emoji)
  • Code snippet mode (/code python)
  • Room persistence and rejoin
  • User presence (online, offline, idle)
  • WebSocket transport fallback (port 443)
  • Full-text message search (/search)
  • Message editing and deletion
  • Desktop notifications
  • Self-hosted broker option
  • Plugin and hook system

License

This project is licensed under the MIT License. See the LICENSE file for details.


Author

Soumyadip Ghosh

GitHub


If DevChat is useful to you, a star on the repository is appreciated.

Built with Python, Fernet, MQTT, and Textual.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devchat_p2p-1.0.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devchat_p2p-1.0.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file devchat_p2p-1.0.0.tar.gz.

File metadata

  • Download URL: devchat_p2p-1.0.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for devchat_p2p-1.0.0.tar.gz
Algorithm Hash digest
SHA256 42dae1262e992935d651ea24d93eb9b88d6a973a491694f33b715194a95c1f97
MD5 c79623ce35b5aa0ea482064c2aa2d3ce
BLAKE2b-256 6cb13f113517b8e68018787727a17f6481c131e17c6cfcc52be647ed2c81bc65

See more details on using hashes here.

File details

Details for the file devchat_p2p-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: devchat_p2p-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for devchat_p2p-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34c251034b0404ec3dac7740ad186921bb950fba665b7e9bbb5d4319bce6d265
MD5 e35fc9c754b8d445b1071a6d18f5447e
BLAKE2b-256 3ef3d95800d02e8308b62ea6d8a367b31313835774f136f260be7f72ac1ca721

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page