2
17 Comments

What's the Django of real-time communications?

Hey everyone!

I recently discovered Django, which is amazing to do things that require more or less static data.

After months of thinking, I want to start making a prototype for my idea, a communication system B2B. It's basically a real-time message system with many more features.
But I'm not sure how to start it. I've thought of doing almost everything from scratch with React and Firebase, but I feel like there might be something else better. What would you guys recommend?

I know how to code, and I'm more expert on JS and Python, but I love to learn new languages. So it might also be fun if your proposal is a different language.

Thanks!

  1. 3

    If your app is dockerized and your database is postgres, hasura.io has an open-source docker container that will give you realtime functionality. I would recommend.

    here's the stack that I use for apps that require realtime features:

    • dockerized django app with postgres database
    • hasura container which links to the postgres database, very quick to set up a graphql API server with subscriptions (the realtime stuff)
    • react app with the apollo graphql client to call the graphql API queries or subscriptions
    1. 1

      I also recommend Hasura. I'm using it side by side with Phoenix for my company. The best thing about Hasura is that it encourages good relational data design. If Hasura ever goes away, you're still left with a solid data schema in Postgres.

      I'm actually skipping Hasura Events (over http webhooks) and using Phoenix to listen to changes in the Postgres WAL (binary) and handling changes directly in Elixir. But you could always use Hasura Events with your language of choice over webhooks, too.

    2. 1

      Thanks for the answer! I will definitely check that up! 😉

  2. 3

    If you want to continue to use Django you can always try Channels. It's quite mature and works well (not sure about huge scale, but I've never had issues with it on reasonably-sized apps)

    1. 1

      That's very interesting! I'll save that!

  3. 3

    I'm pretty biased but I'd recommend Rails. It has ActionCable built in which is a framework for real time communications built on WebSockets.

    I recently used it to build a 2 player Battleship game for a client. All I used was Rails, ActionCable and vanilla JavaScript. Took me about 3 days to build and I'd never used ActionCable before.

    I don't think you should go for React unless you have a really good reason to do so. I find these days most people use it like a hammer and apply it to everything whether or not it suits the problem.

    Another option could be Phoenix (https://www.phoenixframework.org). It's a framework designed specifically for performant real time comms. I've never used it though so can't comment on it's usability or performance.

    1. 3

      I second Phoenix. Elixir (lang powering Phoenix) is built on the Erlang VM which is designed for concurrent real time communications. I absolutely recommend Phoenix over Rails having used them both professionally. Phoenix for both standard http requests as well as websockets is an order of magnitude more scalable and performant than Rails and has a lot fewer moving parts.

      https://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections

      1. 2

        Phoenix definitely sounds like it would be a good solution! Thanks :)

    2. 2

      Amazing, thanks so much! I've actually been wanting to learn Rails for a long time, so this might be a good excuse! Indeed, React is very powerful, but I'd use it more for the final app than for a relatively fast prototype.

      1. 2

        Great! Glad I could help :). Good luck with the app!

  4. 2

    If you're open to learning some Ruby to go with your Python, I strongly recommend that you check out StimulusReflex, a Rails library for creating reactive applications that is a joy to work with.

    There's an excellent intro video: Build a Twitter clone in 10 minutes which is more than worth checking out.

      1. 3

        Obviously inferior due to five additional minutes.

        1. 2

          Ha! Interesting times we're in with all these new real time server rendered options coming out.

    1. 1

      This looks promising... Thanks!

  5. 2

    For realtime io, I can recommend pusher.com
    There's also pubnub but I haven't used that.

    On that note, rolling your own websockets implementation is a total pita and you'll need to work out a lot of edge cases if you go down that route.

    1. 1

      I will take a look, thanks!

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 16 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments