2
8 Comments

Recommended way to create an Activity Streams?

After a few days of research, I'm still a little confused about how to create an Activity Stream in Django.

This would be a social feed combining Threads people can comment on with Achievements where there's no commenting allowed.

I looked into GetStream but I don't like the ideas of using it since it uses Cassandra (which I know nothing about) and can become expensive in time (given where I live and the fact my product doesn't generate revenues yet, I worry if I can afford it).

What's the best way to create one without over-optimizing?
  1. GetStream
  2. Django's Feed framework with a parser library
  3. New model with Django's ContentType framework and caching
  4. Other (please comment)
Vote
  1. 3

    there is a package called activity stream. it would be a good fit. You don’t need to use any crazy tech unless you are trying to scale a lot. Keep it simple and use your database.

    1. 1

      So I tried django-activity-stream and all was going well until I wanted to add the option for an user to like an activity stream item (like liking a tweet). I've trying to prefetch the count on items liked ever since. It's been a nightmare!

      I came out with a solution, I really didn't like:
      https://stackoverflow.com/questions/64812554/django-activity-stream-with-aggregation

      Maybe I could extend the Action model from the django-activity-stream's package and add the "like" field directly, but I've never done it before and don't know whether or not that would break even more things way down the road.

      😣

    2. 1

      do you have experience with that? I read the docs but could't quite figure how someone would be notified of an activity.

      1. 1

        For notifications via email I am guessing? That would be something you can extend easily. Batch the notifications per user via a celery task, and send a summary of updates via email.

        1. 1

          You know... I wasn't talking about email (I was referring to real time notification icon that let the user know someone commented on their post without them having to refresh) BUT the email solution can be quite elegant!

  2. 3

    Hey Fernando. Here's my take on it. I think you could build a simple solution with websockets using Django Channels. Might not be what you want going forward but while you're not generating revenue I'd say it's a good option. Maybe also consider Faust -> https://github.com/robinhood/faust

    1. 1

      Thanks Matt!
      I suppose channels has more support than faust, right? I will have to do a couple of tutorials to get the hang of it first. What would you say are the biggest differences between Channels and Celery? When should I use one instead of the other?

      1. 2

        Well as far as I know Faust is being used by Robinhood so that should mean it has support. Channels is for building websockets. Celery is for running async tasks. If I understand your use case correctly, you want users to get live updates when people comment on a thread. So you'd want to use websockets to handle that, hence go with Channels. Celery is more for running time-consuming tasks in the background.

Trending on Indie Hackers
Passed $7k 💵 in a month with my boring directory of job boards 34 comments Reaching $100k MRR Organically in 12 months 29 comments 87.7% of entrepreneurs struggle with at least one mental health issue 14 comments How to Secure #1 on Product Hunt: DO’s and DON'Ts / Experience from PitchBob – AI Pitch Deck Generator & Founders Co-Pilot 11 comments Competing with a substitute? 📌 Here are 4 ad examples you can use [from TOP to BOTTOM of funnel] 10 comments Are you wondering how to gain subscribers to a founder's X account from scratch? 9 comments