Back to Projects
rchat
CompletedRustTokioTCP+3 more

rchat

LAN-based terminal chat app in Rust with async TCP networking, private messages, and server-controlled identity.

Timeline

1 Week

Role

Backend / Systems Developer

Team

Solo

Status
Completed

Technology Stack

Rust
Tokio
TCP
JSON Protocol
Async I/O
Terminal UI

Key Challenges

  • Managing concurrent client sessions without shared-state race conditions
  • Designing a clean text protocol while keeping messages human-readable
  • Implementing private messaging and user discovery with predictable behavior
  • Keeping terminal output structured when multiple events arrive rapidly

Key Learnings

  • Actor-style architecture with Tokio channels and task isolation
  • Reliable client lifecycle handling in TCP chat systems
  • Identity enforcement at the server layer to prevent spoofing
  • How to build practical networking tools with minimal dependencies

rchat: Async LAN Chat in Rust

Overview

rchat is a lightweight terminal chat system for local networks. It is composed of a Rust server and client binaries connected over asynchronous TCP.

The main goal was to build a robust chat architecture with clear message routing and practical command support while keeping the user experience simple in terminal environments.

Key Capabilities

  • LAN multi-user chat over TCP
  • Server-controlled identity in username@ip format
  • Private messaging with /pm
  • Connected user listing with /who
  • Clean disconnect flow via /quit or /exit

Architecture Notes

Hub-Centric Routing

The server uses a central hub task to manage clients and broadcast logic. This follows an actor-like approach where state is owned in one place and communication happens through channels.

Dedicated Per-Client Tasks

Each client connection has isolated async tasks for I/O handling. This reduces coupling and improves fault boundaries when one client disconnects unexpectedly.

JSON Message Protocol

Messages are serialized in JSON with type, sender, content, and timestamp fields. This keeps protocol evolution straightforward and debuggable.

Security Tradeoffs

rchat intentionally prioritizes local-network simplicity:

  • No TLS by default
  • No user authentication layer
  • Not intended for internet exposure

The server still enforces identity structure to block trivial impersonation from client-supplied payloads.

What This Project Demonstrates

rchat shows strong systems fundamentals in a compact codebase:

  • Async concurrency with Tokio
  • Protocol-oriented communication
  • Separation of concerns between routing, transport, and client UX

It is a solid foundation for future enhancements such as authentication, encryption, persistence, and moderated channels.

Design & Developed by Harsh Surani
© 2026. All rights reserved.