HACKER Q&A
📣 dinkleberg

What is your recommended stack for real time chat?


If you were building a new real time chat app like discord or slack in 2022, what would your tech stack look like?

I’m in this situation right now and am exploring options that will help me avoid reinventing the wheel.

My plan was to just build it from scratch using socket.io.

While looking at options like using matrix or using a third party tool like pusher, I thought to check here to see what others have done.


  👤 Arathorn Accepted Answer ✓
Honestly, rather than building it from scratch on socket.io, use any existing chat infrastructure - be that Matrix, XMPP or IRC.

My bias would be for Matrix (being project lead thereof); there is a whole new generation of client sdks (eg matrix-rust-sdk) on the horizon which are transformative - likewise massive serverside improvements like v3 sync which will provide instant login & sync (somewhat inspired by Discord). You also get e2ee, decentralisation and bridges to a bazillion other systems too.


👤 MattJ100
My choice, because it's the stack I know very well, would be Prosody ( https://prosody.im/ - I'm one of the devs) and a web client such as Converse.js ( https://conversejs.org/ ). XMPP is highly extensible, Prosody is highly modular, which make them a good foundation for building on top of.

That said, the right stack is generally the one that matches your requirements, and (if this isn't primarily a learning exercise) whatever you're most familiar with. The hardest part of building a Discord or Slack-like in 2022 is actually not the technical stuff. There are many comprehensive open-source products already out there that compete with these companies, such as Mattermost, RocketChat and Element.


👤 LinuxBender
My personal preference would be to use UnrealIRCD [1a][1b] + Anope services [2a][2b] and front-end it with TheLounge [3a][3b]. One could modify TheLounge web front-end to look just like Discord or Slack if one were so inclined. Unreal is the most flexible and stable chat daemon I have ever used. It has had decades of battle hardening and is feature rich. Most of the features are modules that can be disabled entirely.

There are more chat options here [4].

[1a] - https://www.unrealircd.org/

[1b]- https://github.com/unrealircd/unrealircd/

[2a] - https://anope.org/

[2b] - https://github.com/anope/anope/

[3a] - https://thelounge.chat/

[3b] - https://github.com/thelounge

[4] - https://www.ilmarilauhakangas.fi/irc_technology_news_from_th...


👤 mrdoops
Elixir. That's it. There's a reason Discord and WhatsApp run on the BEAM. It does real-time with the least pain.

👤 Inviz
How about NChan? https://github.com/slact/nchan

It is an nginx extension, that has supports all types of clients, channels, multiplexing, introspection, tens of thosuands connects, etc.


👤 researchers
You should consider just using the Matrix protocol and innovating on the UI/features side.

👤 troygoode
Depending on your use case I'd definitely look at Sendbird (YC W16):

https://sendbird.com/


👤 stunt
> My plan was to just build it from scratch using socket.io.

This doesn't scale, or you end up wasting all your resources on things that are not important to your customers.

Use something out there, if the business grew and you had nothing more impactful to do (building features that customers actually care about), invest on infrastructure.


👤 skrebbel
Shameless plug, I'm co-founder and CTO of https://talkjs.com, a chat API with pre-built UIs and notifications. Our product is designed for exactly this sort of stuff.

Let me know if you want a tour! (egbert at company domain name)


👤 TimWillebrands
I'm really impressed with gunDB, which is a distributed realtime database that works in the browser.

👤 mathgladiator
I'm building my own as a SaaS: https://www.adama-platform.com/

You can host it, but it is very much in the beta phases as I'm working on better storage options.


👤 zzo38computer
I would use IRC.

While it would be acceptable to also have a web interface and/or other protocols, it should need to also display the connection information (host, port, channel) for IRC, even if JavaScripts and/or CSS are disabled.


👤 racketprogram
Kafka, Cassandra, Golang http server, websocket server and messsage pusher on Kubernetes

👤 h0p3
I don't think raTox receives nearly enough attention: https://github.com/pranomostro/ratox

👤 throwaway81523
Text chat? Why do you want yet another one of these? I mostly clicked the question because I thought it would be about voice or video chat, which still have some gaps in the landscape. For text chat I'm basically happy with irc.

I do think there is a missing or hard to find piece for privacy oriented friends and family chat (i.e. for just a few users, not a large userbase like discord). It would among other things have a super simple desktop client that doesn't confuse my mom. Maybe an IRC extension would suffice for the server side. Client side would be tkinter and super simple, no menus, no channels, no configuration options, just type and leave it running. I sometimes think of writing something like that.


👤 fxtentacle
IRC was working great 20 years ago and it still does.

👤 livinglist
as a flutter developer, I’ve been using firebase for my own apps..

👤 user_named
Agora?