1
b2plane
300d

Can someone send me a guide article or tutorial how to build a chat app with kafka/redis in spring boot?

Should kafka or redis be used?

Or something else?

Also in a chat app should i store messages in postgres or not?

I cant find 1 fucking course or guide how to PROPERLY build a chat app

Comments
  • 2
    That's not weird. Who uses spring boot?
  • 1
    @retoor amazon netflix spotify google facebook instagram and lots of medical hospital websites use java spring boot
  • 0
    @b2plane to run their old CRM maybe 😅
  • 3
    For a personal project it doesn't really matter. Almost anything can get the job done. Just go with something you understand and is easy to use.

    For my first chat app I stored everything in JSON files, because that was all I knew.

    Only use some specialized tools if you specifically want to learn it or if your app is supposed to handle millions of messages per day.
  • 2
    Does your backend need to scale horizontally? What is your load? Do you need to have guarantees or constraints?
    Do you need massage persistence (history/offline delivery)? Are there DM's are there channels? Does it need to support IRC or XMPP?
    So many things that can influence the implementation. Perhaps you can ask GPT
  • 1
    Instead of spring boot I'd recommend micronaut.

    Their approach is cleaner regarding modularity.

    Regarding Redis / Kafka....

    I'm pretty sure we had this discussion before.

    The question remains what you want to achieve.
  • 0
    @pythonPlusPlus this is not a personal project im trying to build a real life production ready saas
  • 1
    @hjk101 i asked those questions in chatgpt already. In a battle of using kafka vs redis vs socket.io vs rabbitmq chatgpt chose socket.io. Which is the easiest to implement tbh. I implemented it and it works. But im not sure what is the proper way to do it.

    With socket.io i listen to events that are emitted from the frontend or postman (lets imagine this as if someone sent a chat message from the website). The chat message receives on the backend and then the backend is supposed to process that chat message and forward it to the receiver.

    But what if there are 1 million users? That means the backend would transmit 1 million times a chat message just so it can be received to 1 user. And it would do that for every single message

    Dont know if im missing something or if my logic is flawed. But this sounds like a very bad way to do it for performance
  • 0
    @IntrusionCM spring boot is my main backend technology stack i use. I dont know any other backend as good as SB
  • 1
    @b2plane there is no defined proper way to do things. It really depends on your situation. Don't optimise for billions of users if you won't even realistically get 10000 concurrent users.
    I've just read some documentation. Don't rely on me or an auto completion agent to do the work for you. Do you own investigation and ask specific things.

    Socket.io looks really good as the transport for chat. Even if your service goes beyond so you need to scale horizontally (this is quite a hard problem due to client connections being spread and still needing real time communication) there are adapters to help with that.
    The ease of use and robustness like auto connect is really nice. Ideally I would get something better than spring boot due to the slow startup times. I would use a single instance that can be restarted instantly. Giving sub second delay in deployment or failure. If I would truly need even higher standards and redundancy. Than 3 instances with connection transfer (during roleout or issues clients would be seamlessly transferred to the other instances) would be the way to go.
Add Comment