Skip to content

A real-time terminal-based chat application built with Rust. Features a beautiful TUI (Terminal User Interface) client powered by Cursive and an async TCP server using Tokio.

Notifications You must be signed in to change notification settings

Paiman-Rasoli/AWESOME-Chat-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 AWESOME Chat App

A real-time terminal-based chat application built with Rust. Features a beautiful TUI (Terminal User Interface) client powered by Cursive and an async TCP server using Tokio.

Rust

✨ Features

  • Real-time messaging - Instant message delivery using TCP sockets
  • Beautiful TUI client - Clean terminal interface with colors and panels
  • Multi-user support - Multiple clients can connect and chat simultaneously
  • Server notifications - Join/leave messages when users connect or disconnect
  • Timestamps - Every message shows when it was sent
  • Easy launcher - Interactive menu to start server and clients

📁 Project Structure

chat-app/
├── src/
│   ├── main.rs          # Launcher menu
│   └── bin/
│       ├── server.rs    # Chat server
│       └── client.rs    # Chat client (TUI)
├── Cargo.toml
├── .env                 # Optional: HOST and PORT config
└── README.md

🛠️ Prerequisites

  • Rust (1.75 or later recommended)
  • Cargo (comes with Rust)

🚀 Quick Start

Using the Launcher (Recommended)

The easiest way to run the app is using the built-in launcher:

cargo run

This will show an interactive menu:

╔════════════════════════════════╗
║      🚀 CHAT APP LAUNCHER      ║
╠════════════════════════════════╣
║  1. Start Server (new window)  ║
║  2. Start Client (new window)  ║
║  3. Exit                       ║
╚════════════════════════════════╝
  1. Press 1 to start the server (opens in a new terminal window)
  2. Press 2 to start a client (enter your username, opens in a new window)
  3. Repeat step 2 to add more chat participants!

Manual Execution

You can also run the server and client directly:

Start the server:

cargo run --bin server

Start a client (in a separate terminal):

cargo run --bin client <username>

Example:

cargo run --bin client Alice
cargo run --bin client Bob

⚙️ Configuration

Create a .env file in the project root to customize the host and port:

HOST=127.0.0.1
PORT=8082

Default values if .env is not provided:

  • HOST: 127.0.0.1
  • PORT: 8082

🎮 Client Controls

Key Action
Enter Send message
Esc Quit client
/help Show available commands
/quit Exit the chat

📦 Dependencies

Crate Purpose
tokio Async runtime for networking
cursive Terminal UI framework
serde / serde_json Message serialization
chrono Timestamps
dotenv Environment configuration

🏗️ Architecture

┌─────────────┐     TCP      ┌─────────────┐
│   Client    │◄────────────►│   Server    │
│   (TUI)     │              │  (Tokio)    │
└─────────────┘              └─────────────┘
                                   │
┌─────────────┐     TCP            │
│   Client    │◄───────────────────┤
│   (TUI)     │                    │
└─────────────┘                    │
                                   │
┌─────────────┐     TCP            │
│   Client    │◄───────────────────┘
│   (TUI)     │
└─────────────┘
  • Server: Accepts connections, broadcasts messages to all connected clients
  • Client: Connects to server, displays messages in a beautiful TUI

📝 License

This project is open source and available under the MIT License.


Made with ❤️ and Rust 🦀

About

A real-time terminal-based chat application built with Rust. Features a beautiful TUI (Terminal User Interface) client powered by Cursive and an async TCP server using Tokio.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages