8 ms·
Ask HN: 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.
- Inviz 5y agoHow about NChan? https://github.com/slact/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.
- LinuxBender 5y agoMy 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/ https://www.unrealircd.org/ [1b]- https://github.com/unrealircd/unrealircd/ https://github.com/unrealircd/unrealircd/ [2a] - https://anope.org/ https://anope.org/ [2b] - https://github.com/anope/anope/ https://github.com/anope/anope/ [3a] - https://thelounge.chat/ https://thelounge.chat/ [3b] - https://github.com/thelounge https://github.com/thelounge [4] - https://www.ilmarilauhakangas.fi/irc_technology_news_from_the_second_half_of_2021/ https://www.ilmarilauhakangas.fi/irc_technology_news_from_th...
- dinkleberg 5y agoAh, interesting. I hadn’t considered IRC at all, I’ll have to explore this. Thanks for the suggestion!
- LinuxBender 5y agoMy pleasure! If you try out Unreal don't let the configuration overwhelm you. It has evolved over a long period of time. One can find example configurations of live servers and they have a forum.
- racketprogram 5y agoKafka, Cassandra, Golang http server, websocket server and messsage pusher on Kubernetes
- h0p3 5y agoI don't think raTox receives nearly enough attention: https://github.com/pranomostro/ratox https://github.com/pranomostro/ratox
- MattJ100 5y agoMy choice, because it's the stack I know very well, would be Prosody ( https://prosody.im/ https://prosody.im/ - I'm one of the devs) and a web client such as Converse.js ( https://conversejs.org/ 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.
- dinkleberg 5y agoThat is an excellent point, there is a goldmine of information out there in those open source projects. And I’ll have to take a look at prosody, I hadn’t heard of it but I did see a lot about XMPP in my research.
- effnorwood 5y ago
- TimWillebrands 5y agoI'm really impressed with gunDB, which is a distributed realtime database that works in the browser.
- mrdoops 5y agoElixir. That's it. There's a reason Discord and WhatsApp run on the BEAM. It does real-time with the least pain.
- toast0 5y agoAdding to the BEAM love; setup ejabberd, and customize to fit your needs. It's a recipe for a scalable chat setup with a small team.
- ipsun4 5y agoI wholeheartedly agree. For a MVP, it's hard to beat Phoenix Framework channels and Liveview, and if you want to completely decouple the UI from the backend with something like a native app, or separate webapp, it's absurdly easy to just add the resources to a route that goes through the :api pipeline instead of the :browser. Once you are ready to outgrow a single machine deployment, the BEAM clusters so well in a way that works the same on your dev machine. Also if you want to get really complicated multi-service design, Umbrella apps are leagues better than docker-compose setups that I have had on dev machines that make a 16G Macbook pro instantly put everything into swap.
- ricketycricket 5y ago> Also if you want to get really complicated multi-service design, Umbrella apps are leagues better than docker-compose setups that I have had on dev machines that make a 16G Macbook pro instantly put everything into swap. Not sure I feel the same warm feelings about umbrella apps and I definitely don't think you can compare them to general-purpose container orchestration like docker-compose, but that's totally an optional part of the language. Otherwise, yes, Elixir/BEAM is an excellent soft real-time environment for developing chat applications. If your scale goes off the charts (millions of concurrent users), you can extend with Rust for the slower operations in your critical path. See https://discord.com/blog/using-rust-to-scale-elixir-for-11-million-concurrent-users https://discord.com/blog/using-rust-to-scale-elixir-for-11-m... As mentioned, Phoenix Channels is a great place to start and will get you very far. The other nice and unique things in Elixir & Phoenix (OTP, LiveView, etc.) are just a bonus.
- researchers 5y agoYou should consider just using the Matrix protocol and innovating on the UI/features side.
- Arathorn 5y agoHonestly, 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.
- zaik 5y agoXMPP has the additional benefit of being the IETF Internet Standard for instant messaging.
- dinkleberg 5y agoI’ll have to take a deeper look at how matrix works and dig through some of those client and server implementations. My initial concern was that the architecture seemed at odds with what my service needs. While I whole heartedly approve with the decentralization and E2EE approach for a general chat solution people would use like element, mine is much more niche and I need tighter control. That being said, I haven’t dug into it enough to see how flexible it is. It would certainly save tons of effort if I could take advantage of the hard work that people no doubt smarter than me have put into this project.
- Arathorn 5y agowould be interested to know what tighter control you are after :) there is a huge range of matrix clients these days, so you can get an idea of how much flexibility there is to build the app you need.
- hammyhavoc 5y agoI love Matrix so much. It makes my heart sing.
- troygoode 5y agoDepending on your use case I'd definitely look at Sendbird (YC W16): https://sendbird.com/ https://sendbird.com/
- skrebbel 5y agoShameless plug, I'm co-founder and CTO of https://talkjs.com 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)
- throwaway81523 5y agoText 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.
- dinkleberg 5y agoI’m not building yet another general chat platform. I agree that there are plenty of those. Instead, I’m building a niche socialization platform which has chat as one of its core components.
- throwaway81523 5y agoOh I see. Well unless there are special requirements there is are probably existing modules you can drop in, e.g. from Drupal.
- jelling 5y agoI would go up one level of abstraction then and look at chat-as-service / embeddable chat SDKs. If it’s a niche service, it will be a good while at best before you break even writing your own.
- fxtentacle 5y agoIRC was working great 20 years ago and it still does.
- user_named 5y agoAgora?
- mathgladiator 5y agoI'm building my own as a SaaS: https://www.adama-platform.com/ 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.
- stunt 5y ago> 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.
- livinglist 5y agoas a flutter developer, I’ve been using firebase for my own apps..
- zzo38computer 5y agoI 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.