Building a simple IRC with Rust

I was recently invited as tech speaker to sahyadri engineering college to conduct a workshop on rustlang and to make use of AWS if possible.
And I then began to think of right use case that can show the capablity of Rustlang along with its suitability with AWS. Initial thoughts are to make use of AWS lambda and trigger a rustlang function, but felt that it is not enough and useful to the students straigtaway. Suddenly struck to my mind, is to build an IRC server using rocket web framework for both client and the server.

Why IRC?

Unlike stackoverflow, an IRC(Internet Relay Chat) is a realtime group chat platform where anyone could pose a question or start a discussion and instantly get helped by the community. On the bright side, It is one kind of knowledge sharing platform where people can collaborate and learn from each other.

There are two parts for an IRC,
one is the server which holds metadata of the clients registered to it(kind of nameserver) and also takes responsibility for broadcasting the messages.
Second is the client side, where it stores the session id and also message history.

Infra Setup:

APIs implemented

Server side APIs:

    => GET /
=> GET /register/<name>/<ip>
=> POST /broadcast
=> GET /logout/<id>/<name>/<ip>

Client side APIs:

    => GET /
=> GET /<user>
=> GET /register/<name>
=> GET /send/<message>
=> GET /receive/<user_name>/<message>/<time>
=> GET /get/messages/<count>
=> GET /logout


1. Create a VM in AWS EC2 console:

Connecting to the VM

2. Installing essential packages

3. Running the irc server on the machine

cd rust-irc/rust-irc-server/

docker build -t rust-irc-server:1.0 .
docker run -it --name rust-irc-server -p 80:80 -d rust-irc-server:1.0

Repeat the steps 1 & 2 to create one more VM for the Client

4. Running the IRC client on the machine

cd rust-irc/rust-irc/

docker run -it --name rust-irc -p 80:80 -d rust-irc:1.0

5. Checking with postman client

Next steps:



Project doesn’t implement the real IRC protocol, it simply uses REST to emulate this behavior.

Go, Rust, Erlang, Java at work || Blogging, Open source tools, Embedded systems, Industrial robotics as hobby