Git Product home page Git Product logo

go-chat's Introduction

Go Microservices Realtime Finance Chat Application with RabbitMQ, Websockets, JWT, Mux, Gorm(MySQL), And React

The goal of this exercise is to create a browser-based chat application using Go. This application allows several users to talk in one or more chatrooms and also to get stock quotes from an API using a specific command.

Requirement

The following tools are required to run the project

  • Go (Golang)
  • RabbitMQ
  • MySQL
  • Docker(optional)

Context

I use the poly repo ideology, hence, the project works in collaboration with two other repositories:


This service reads published stock bot requests to env.STKBT_RECEIVER_QUEUE queue on RabbitMQ and reads the processed stock response on env.STKBT_PUBLISHER_QUEUE queue on RabbitMQ.


Starting The App


Step 1 : Start RabbitMQ

RabbitMQ is the message broker between the bot service and the chat service. To run it with docker, run the folling command in your terminal:

docker run -d --hostname rabbitmq-svc --name rbbtmq -p 15672:15672 -p 5672:5672 rabbitmq:3.11.3-management


Step 2 : Update Env file

copy the .env.example to .env and update the entries.

Step 3 : Starting the app

run the folling command in your terminal go run cmd/main.go


Step 4 : Start Bot service app

visit this repo: https://github.com/ong-gtp/go-stockbot-rabbitmq.git on steps for stating the app


Step 5 : Start React frontend app

visit this repo https://github.com/ong-gtp/go-chat-react.git on steps for stating the react frontend app


REST Endpoints

The table below describes the endpoints available on the app:

#### Routes ⚡
| Routes                     | HTTP Methods | Params                         | Description                                      |
| :------------------------- | :----------- | :----------------------------- | :----------------------------------------------- |
| /v1/api/auth/signup        | POST         | `email` `password` `user_name` | Creates a new user and returns jwt session token |
| /v1/api/auth/login         | POST         | `email` `password`             | Logs in a user and returns the jwt session token |
| /v1/api/chat/create        | POST         | `name`                         | Creates a new chat room with the name provided   |
| /v1/api/chat/rooms         | POST         | none                           | returns a list of chat rooms                     |
| /v1/api/chat/room-messages | POST         | `roomId`                       | Returns the latest 50 messages in a chat room    |
| /v1/ws                     | GET          | none                           | websocket connection url                         |

App tests

Run the command below to execute tests

go test github.com/ong-gtp/go-chat/pkg/services

Useful Links

go-chat's People

Contributors

omept avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.