MCPcopy Index your code
hub / github.com/Yengas/rust-chat-server

github.com/Yengas/rust-chat-server @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
200 symbols 333 edges 39 files 31 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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.

Extension points exported contracts — how you extend this code

Component (Interface)
(no doc) [6 implementers]
tui/src/ui_management/components/component.rs
ComponentRender (Interface)
(no doc) [6 implementers]
tui/src/ui_management/components/component.rs
HasUsageInfo (Interface)
(no doc) [3 implementers]
tui/src/ui_management/pages/chat_page/section/usage.rs
SectionActivation (Interface)
(no doc) [2 implementers]
tui/src/ui_management/pages/chat_page/section/mod.rs

Core symbols most depended-on inside this repo

write
called by 6
comms/src/transport/server.rs
assert_event_serialization
called by 5
comms/src/event.rs
split_tcp_stream
called by 5
comms/src/transport/server.rs
assert_command_serialization
called by 4
comms/src/command.rs
insert
called by 4
server/src/room_manager/room/user_registry.rs
recv
called by 4
server/src/session/chat_session.rs
is_empty
called by 3
tui/src/ui_management/components/input_box.rs
get_room_data
called by 3
tui/src/ui_management/pages/chat_page/chat_page.rs

Shape

Method 113
Class 44
Function 30
Enum 9
Interface 4

Languages

Rust100%

Modules by API surface

tui/src/ui_management/pages/chat_page/chat_page.rs21 symbols
tui/src/ui_management/pages/chat_page/components/room_list.rs17 symbols
tui/src/ui_management/components/input_box.rs16 symbols
tui/src/ui_management/pages/chat_page/components/message_input_box.rs13 symbols
comms/src/event.rs13 symbols
tui/src/ui_management/pages/mod.rs11 symbols
tui/src/state_store/state.rs11 symbols
comms/src/command.rs10 symbols
tui/src/ui_management/pages/connect_page/connect_page.rs9 symbols
server/examples/stress_test.rs8 symbols
server/src/room_manager/room/user_session_handle.rs7 symbols
tui/src/termination.rs6 symbols

For agents

$ claude mcp add rust-chat-server \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact