How to Create a Chat Application in Golang with Redis and ReactJS


A feature-rich chat application in Golang using Redis as a complete solution. Redis is used to store all user data, chats, contact lists, and many other things.

The Chat Application’s name is Kayee. It is slang you will hear in Jabalpur city for what’s up!

Introduction

In this tutorial, you will create a chat application in Golang, Redis as a Database layer, and ReactJS with Chakra UI for the front-end.

Let’s understand what you are going to build in this application.

  1. Redis Repository: Simple repository manages all the Redis operations.
  2. HTTP Server: A REST API server to serve user-specific functionalities, like registering and logging in.
  3. WebSocket Server: A real-time server to reflect changes immediately.
  4. Frontend(Client): A ReactJS application with Chakra UI Components.

Chat Features

  1. One-to-One chat
  2. Register User
  3. Login User
  4. Add Contact
  5. Contact List

Redis Stack Used

  1. SET
  2. SORTED SET
  3. REDISJSON
  4. REDISEARCH

You can find the complete GitHub Project link at the end of the article.

Architecture

The user will register and log in to the chat application using the HTTP server. The real-time messages will be sent via the WebSocket server and saved to Redis.

Basic Architecture of the Application’s different components
Basic Architecture

WebSocket Flow Diagram: An active connection will be alive between user 1 and user 2.