/rust-chat-server

Room based Chat Server and TUI implementation in Rust

Primary LanguageRustMIT LicenseMIT

Rust Chat Server

This project serves as a learning exercise in Rust, Tokio, Channels, and TUI (Terminal User Interface) programming. It features a room-based chat server with a Terminal User Interface (TUI), utilizing technologies such as Tokio, Ratatui, and a Redux-inspired architecture.

TUI Demo

Note: This project is not suitable for production use. It's designed strictly for educational purposes.

Setup Instructions

To get the project up and running, follow these steps:

  1. Clone the repository: git clone git@github.com:Yengas/rust-chat-server.git
  2. Make sure you have Rust and Cargo installed.
  3. Change to the project directory: cd rust-chat-server
  4. Start the server: cargo run --bin server
  5. Launch one or more TUI instances: cargo run --bin tui

Project Overview

The project utilizes Rust Workspaces to divide itself into three sub-projects, each with its own README that details the concepts and architecture. Below is a brief overview:

  • comms: This sub-project houses a library crate that provides Events and Commands used for server-client communication. It also offers client/server socket utilities, enabled via feature flags, to assist in serializing and deserializing events and commands.
  • server: Built on the Tokio Runtime and using Tokio Channels, this sub-project implements a single-instance chat server that manages room states and user participation.
  • tui: Leveraging Ratatui, this sub-project implements a terminal-based user interface. Users can connect to a chat server, join rooms, and send/receive messages. The code follows a Redux-inspired structure to separate state management from TUI rendering.

License

The project is distributed under the MIT License.