Skip to content

Simple Chat service using Hexagonal Architecture with Go

Notifications You must be signed in to change notification settings

posilva/simplechat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Chat

Simple Chat service using Hexagonal Architecture with Go


How to run

Use Makefile targets

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 

Loading
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
Loading

TODO

  • Implement a Presence component that embeds the notification system
  • Improve tests that cover errors
  • Integrate a mock framework (gomock)
  • Separated UnitTest from Integration Tests (with local infra)
  • Integrate Golang Linters
  • Implement WebSocket Handler
  • Add CICD with Github Actions
  • Add Configuration (Consul, Vault)
  • Add logging
  • Add metricts
  • Add rate limiting
  • Add Load Tests Local
  • Add Load Tests Cloud
  • Add Grafana, Prometheus to Docker Compose
  • Add deployment on ECS
  • Add deployment on K8S
  • Add deployment on Nomad

FIX

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