DEV Community

Cover image for MeshChat โ€” A Zero-Install Terminal Chat Room Built with GitHub Copilot CLI
Cristian Rubio
Cristian Rubio

Posted on

MeshChat โ€” A Zero-Install Terminal Chat Room Built with GitHub Copilot CLI

GitHub Copilot CLI Challenge Submission

๐Ÿš€ 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>
Enter fullscreen mode Exit fullscreen mode

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 nc or telnet
  • 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 pytest and pytest-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
Enter fullscreen mode Exit fullscreen mode

Run server

poetry run meshchat
Enter fullscreen mode Exit fullscreen mode

or

poetry run meshchat --port 2323 --room-name "My Room" --history
Enter fullscreen mode Exit fullscreen mode

Join

nc localhost 2323
# or
telnet localhost 2323
Enter fullscreen mode Exit fullscreen mode

๐Ÿ’ฌ 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/
Enter fullscreen mode Exit fullscreen mode

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)