Code Monkey home page Code Monkey logo

simplechat's Introduction

Simple Chat

Simple Chat service using Hexagonal Architecture with Go


How to run

Use Makefile targets

Short version if you have all the tools installed and configured (never happens :) ) (it will start a local web page http://localhost:8081 that you can connect to play with chat)

make setup

Create containers to run the service with docker compose

make infra-up

Run local infra setup - executes terraform code against LocalStack

make infra-local #

Executes tests and creates coverage report against local infra

make cover


Architecture

  • Handler: http with WebSocket
  • Repository: DynamoDB
  • Notifier: RabbitMQ
  • Moderator: Ignore (just passthrough the message, no moderation done)
sequenceDiagram 
    title: Connect Flow
    Client -->> WebSocket: Connect(uID, roomID)
    WebSocket -->> ChatService: Register(uID, roomID)
    ChatService -->> Notifier: Register(uID, roomID, receiver)
    Notifier ->> ChatService: Registered 
    ChatService --> WebSocket: Registered
    WebSocket -> Client: Connected 

sequenceDiagram 
    title: Send Message Flow
    Client -->> WebSocket: Send(message, roomID)
    WebSocket -->> ChatService: Send(message, roomID)    
    ChatService -->> Moderator: Check(message)
    Moderator ->> ChatService: ModeratedMessage
    ChatService -->> Repository: Store(ModeratedMessage)
    Repository ->> ChatService: ModeratedMessageStored
    ChatService -->> Notifier: Broadcast(ModeratedMessage, GroupId)
    Notifier ->> ChatService: Sent OK
    ChatService ->> WebSocket: Sent
    WebSocket ->> Client: Sent

TODO

  • Implement a Presence component that embeds the notification system
  • Integrate a mock framework (gomock)
  • Add logging
  • Integrate Golang Linters
  • Implement WebSocket Handler
  • Add Grafana, Prometheus to Docker Compose
  • Separated UnitTest from Integration Tests (with local infra)
  • Improve tests that cover errors
  • Add CICD with Github Actions
  • Add Configuration (Consul, Vault)
  • Add metricts
  • Add rate limiting
  • Add Load Tests Local
  • Add Load Tests Cloud
  • Add deployment on ECS
  • Add deployment on K8S
  • Add deployment on Nomad
  • Explore coverage report in Github [https://github.com/johejo/go-cover-view]

FIX

  • - Remove dependency of AWS CLI by running in a container

simplechat's People

Contributors

posilva avatar

Stargazers

Yosia Agustadewa avatar  avatar  avatar JFKongphop avatar

Watchers

 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.