Skip to content

geclos/node-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-chat

WIP

Motivation

Let's build a chat backend system! I've always been passionate about complex backend systems and distributed services and so this provides the perfect excuse to build such a system and refresh my devops skills along the way.

Goals:

  • NodeJS API.
  • Server-client connection with websockets.
  • Message queuing and distribution with rabbitMQ.
  • containerization with docker and store it in ECS.
  • Serve everything with EC2, behind an ALB with auto-scaling.
  • Multi A-Z support.

Current status

Currently the API broadcasts to every node connected to it but the basic building blocks in which I was more interested in are already built.

I followed design principles detailed in this article.

Basically, there's two permanent queues along which all messages flow through. This allows the system to not block IO and perform slower tasks (e.g: user authentication, permission checking, database querying, etc...) between queues. Eventually, I want to separate both queues and the worker in independent services so that I could scale all of them horizontally to meet demand.

Then there's N temporary queues for N users connected, all managed through a UserExchange. These temporary queues are dropped as soon as the user disconnects. As I've said, right now all messages are broadcasted to all temporary queues but it would be easy to setup a temporary register of users with unique identifiers, correlate temporary queues with such identifiers and then send private messages between a subset of N known users.

Image of a message "traveling" through the system:

FAQ

Isn't this totally overkill for a personal project?

Yes! As I've said, it's just an excuse to refresh my DevOps skills, I do not pretend to keep it running (much less without free-tier EC2 instance options available).

Can I steal ideas/code from this?

Be my guest.

About

Chat backend with NodeJS + rabbitMQ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •