๐ What I built
MeshChat is a terminal-based chat server written in Python (asyncio) that lets anyone join a shared chat room using nothing more than:
nc <host> <port>
# or
telnet <host> <port>
No client binaries.
No accounts.
No setup on the user side.
If you can open a terminal, you can chat.
Repository: https://github.com/cristianrubioa/meshchat
๐ก Why I built it
Sometimes you just need a quick local chat room:
- A small team on the same network
- A classroom or lab
- A hackathon
- A home LAN
I wanted something that felt like an old-school LAN chat, but with:
- modern async Python
- a clean CLI
- colorful output
- basic safety (rate limits, message caps)
MeshChat turns a TCP port into a friendly shared room.
โจ Features
- Zero client setup โ connect via
ncortelnet - Colorful UI โ each user gets a unique ANSI color
- Chat commands:
/who/me/help/quit
- Optional message history
- Rate limiting (anti-spam)
- Async I/O with
asyncio - Typer-based CLI
- Rich terminal formatting
- Environment + CLI configuration
- Tested with
pytestandpytest-asyncio
๐ง How GitHub Copilot CLI helped
I used GitHub Copilot CLI as my โterminal pair programmerโ during the entire build.
Biggest productivity wins:
1. Architecture scaffolding
Copilot CLI helped propose a clean modular layout:
- network server
- room state
- client lifecycle
- UI formatting
- command handling
This let me move fast from a prototype to a maintainable package.
2. Async networking flows
Copilot CLI assisted with:
asyncio.start_server- client connect / disconnect handling
- broadcast fan-out
- graceful cleanup
These parts are easy to get wrong โ Copilot accelerated iteration a lot.
3. UX polish
Instead of manually researching Rich + ANSI patterns, I prompted Copilot CLI for:
- per-user colors
- action messages (
/me) - formatted system events
Result: better terminal UX with less friction.
4. Guardrails
Copilot CLI helped implement:
- nickname limits
- max message length
- rate limiting windows
- max users
This made MeshChat safer by default.
5. Tests
I used Copilot CLI to generate pytest-asyncio skeletons and refine edge cases like:
- multiple clients
- broadcast correctness
- command parsing
- reconnect behavior
Example prompts (high level)
- โGenerate an asyncio TCP chat server with shared rooms.โ
- โAdd a Typer CLI with port, room name, history options.โ
- โSuggest a clean Python package structure for this project.โ
- โWrite pytest-asyncio tests for multi-client broadcast.โ
โก Quick start
Install
poetry install
Run server
poetry run meshchat
or
poetry run meshchat --port 2323 --room-name "My Room" --history
Join
nc localhost 2323
# or
telnet localhost 2323
๐ฌ Chat commands
| Command | Description |
|---|---|
/who |
List connected users |
/me <action> |
Action message |
/help |
Show help |
/quit |
Disconnect |
๐งฑ Architecture (high level)
meshchat/
โโโ chatserver/
โ โโโ core/ # room, client, message logic
โ โโโ network/ # asyncio TCP server
โ โโโ ui/ # ANSI/Rich formatting
โ โโโ main.py # CLI entry point
โโโ test/
Flow:
- TCP server accepts connections
- Each socket becomes a Client
- All clients join a shared Room
- Messages broadcast to everyone
- Formatter styles output
๐ Inspiration
Inspired by the Go project chat-tails. repo
MeshChat is a Python-first reimplementation with its own:
- async architecture
- CLI UX
- rate limiting
- configuration system
- development guide
๐ฎ Whatโs next
- Optional room passwords
- Multiple rooms (channels)
- Docker image
- Presence events (join/leave notifications)
- Server-side logging
๐ Final thoughts
This project was a great way to explore whatโs possible when AI meets the terminal.
Using GitHub Copilot CLI directly from my shell made experimentation fast, fun, and surprisingly productive โ especially for async networking and CLI tooling.
Thanks for reading!
Happy hacking ๐
Top comments (0)