Welcome to CodeChat, a real-time chat application designed to facilitate seamless communication through a terminal-based interface. Built with a focus on simplicity and efficiency, CodeChat leverages WebSockets for real-time messaging and is structured to provide a clear separation of concerns, making it both scalable and easy to maintain.
- Tview, for a better Terminal aspect.
- Web interface (Optional)
- Real-time Communication: Instantly send and receive messages with minimal latency.
- CLI-based Interface: Access and interact with the chat directly from your terminal.
- Scalable Architecture: Designed with a modular architecture that separates the client, server, and common utilities.
To get started with CodeChat, clone this repository to your local machine and follow the setup instructions below.
- Golang
- WebSocket support
-
Clone the repository:
git clone https://github.com/<yourusername>/CodeChat.git
-
Navigate to the cloned directory:
cd CodeChat
-
Build the application:
./build.sh
If you encounter a permission denied error, run
chmod +x build.sh
to make the script executable.
To start the ChatApp server, run:
./CodeChat server
To connect as a client from another terminal, run:
./CodeChat client
CodeChat is organized into several key components for clarity and ease of development:
cmd/
: Contains the CLI setup using CobraCLI, includingroot.go
for CLI environment setup andchat.go
for chat command definitions.internal/
:server/
: Contains server logic, WebSocket connection management (server.go
), and client handling (client.go
).client/
: Manages chat client functionality, WebSocket connections, and terminal UI rendering (ui.go
).
pkg/
:websocket/
: Provides utilities for WebSocket operations, like message encoding/decoding.common/
: Defines common data structures, such as message formats.
main.go
: The application's entry point, initializing and running Cobra commands.
Contributions to CodeChat are welcome!
CodeChat is open-sourced under the MIT License. See the LICENSE file for more details.