Chat gRPC is a real-time chat service built entirely in Rust using gRPC (Google Remote Procedure Call). It follows a microservice architecture with two main components:
-
Auth Service: Handles user authentication and registration.
-
Chat Service: Manages message broadcasting to all connected clients.
The project is fully asynchronous, ensuring high performance and responsiveness. A Terminal User Interface (TUI) is provided to interact with the service.
- make sure that you have docker installed
- make sure that you have rust installed
- install bunyan as below (this requires node to be installed first)
npm install -g bunyan
- Clone the repo with
git clone git@github.com:Atheer2104/chat-grpc.git
- change the directory with
cd chat-grpc
Now we will create PostgreSQL and Redis containers using docker, these containers can be stopped and restarted from the docker desktop for further usage.
- initialize PostgreSQL with
auth/scripts/init_db.sh
- Initialize Redis with
auth/scripts/init_redis.sh
- Create a separate terminal window and navigate to
cd chat-grpc/auth
and run the auth service with
cargo run --release --bin auth-server | bunyan
- create a separate terminal window and navigate to
cd chat-grpc/chat
and run chat service with
cargo run --release --bin chat-server | bunyan
Now you can start one or more clients by having a separate terminal window for each client navigating to cd chat-grpc/client
and starting the client with
cargo run --release --bin chat-client
Main Technologies used
- JWT - Used to serve as an access token allowing users to be able to chat
- PostgreSQL - Used to save user credentials and JWT access token
- Redis - Used to cache JWT auth token
- Tonic - A rust gRPC library, Used to implement the gRPC functionality
- Tokio - A rust Asynchronous runtime, Used to schedule and spawn asynchronous tasks
- Tracing - Used to write logs asynchronously
- Ratatui - Used to create Terminal User Interfac
The project is licensed under the MIT license
See LICENSE for more information.