Skip to main content

Feedly allows you to build complex feed and caching structures using Redis.

Project description

Stream Framework (previously Feedly)

[![Build Status](](


This project was previously named Feedly. As requested by we have now renamed the project to Stream Framework.

## What can you build? ##

Feedly allows you to build newsfeed and notification systems using Cassandra and/or Redis.
Examples of what you can build are the Facebook newsfeed, your Twitter stream or your Pinterest following page.
We've built Feedly for [Fashiolista] [fashiolista] where it powers the [flat feed] [fashiolista_flat], [aggregated feed] [fashiolista_aggregated] and the [notification system] [fashiolista_notification].
(Feeds are also commonly called: Activity Streams, activity feeds, news streams.)


To quickly make you acquainted with Feedly, we've created a Pinterest like example application, you can find it [here] [example_app_link]

## ##

Stream Framework's authors also offer a Saas solution for building feed systems at [] [stream]
The hosted service is highly optimized and allows you start building your application immediatly.
It saves you the hastle of maintaining Cassandra, Redis, Faye, RabbitMQ and Celery workers.
Clients are available for [Node] [stream_js], [Ruby] [stream_ruby], [Python] [stream_python] and [PHP] [stream_php]

## Consultancy ##

For Stream Framework and consultancy please contact thierry at


* Thierry Schellenbach (thierry at
* Tommaso Barbugli (tommaso at
* Guyon Morée


* [Documentation]
* [Bug Tracker]
* [Code]
* [Mailing List]
* [IRC] (, #feedly-python)
* [Travis CI]


* [Pinterest style feed example app] [mellowmorning_example]

[Bug Tracker]:
[Mailing List]:
[IRC]: irc://
[Travis CI]:

## Using Stream Framework ##

This quick example will show you how to publish a Pin to all your followers. So lets create
an activity for the item you just pinned.

def create_activity(pin):
from feedly.activity import Activity
activity = Activity(
time=make_naive(pin.created_at, pytz.utc),
return activity

Next up we want to start publishing this activity on several feeds.
First of we want to insert it into your personal feed, and secondly into the feeds of all your followers.
Lets start first by defining these feeds.

# setting up the feeds

class PinFeed(RedisFeed):
key_format = 'feed:normal:%(user_id)s'

class UserPinFeed(PinFeed):
key_format = 'feed:user:%(user_id)s'

Writing to these feeds is very simple. For instance to write to the feed of user 13 one would do


feed = UserPinFeed(13)

But we don't want to publish to just one users feed. We want to publish to the feeds of all users which follow you.
This action is called a fanout and is abstracted away in the Feedly manager class.
We need to subclass the Feedly class and tell it how we can figure out which user follow us.


class PinFeedly(Feedly):
feed_classes = dict(
user_feed_class = UserPinFeed

def add_pin(self, pin):
activity = pin.create_activity()
# add user activity adds it to the user feed, and starts the fanout
self.add_user_activity(pin.user_id, activity)

def get_user_follower_ids(self, user_id):
ids = Follow.objects.filter(target=user_id).values_list('user_id', flat=True)
return {FanoutPriority.HIGH:ids}

feedly = PinFeedly()

Now that the feedly class is setup broadcasting a pin becomes as easy as


Calling this method wil insert the pin into your personal feed and into all the feeds of users which follow you.
It does so by spawning many small tasks via Celery. In Django (or any other framework) you can now show the users feed.

# django example

def feed(request):
Items pinned by the people you follow
context = RequestContext(request)
feed = feedly.get_feeds(['normal']
activities = list(feed[:25])
context['activities'] = activities
response = render_to_response('core/feed.html', context)
return response


This example only briefly covered how Stream Framework works.
The full explanation can be found on read the docs.

## Features ##

Stream Framework uses celery and Redis/Cassandra to build a system with heavy writes and extremely light reads.
It features:

- Asynchronous tasks (All the heavy lifting happens in the background, your users don't wait for it)
- Reusable components (You will need to make tradeoffs based on your use cases, Stream Framework doesnt get in your way)
- Full Cassandra and Redis support
- The Cassandra storage uses the new CQL3 and Python-Driver packages, which give you access to the latest Cassandra features.
- Built for the extremely performant Cassandra 2.0

## Background Articles ##

A lot has been written about the best approaches to building feed based systems.
Here's a collection on some of the talks:

[Twitter 2013] [twitter_2013]
Redis based, database fallback, very similar to Fashiolista's old approach.


[Etsy feed scaling] [etsy]
(Gearman, separate scoring and aggregation steps, rollups - aggregation part two)


[Facebook history] [facebook]

[Django project with good naming conventions] [djproject]

[Activity stream specification] [activity_stream]

[Quora post on best practises] [quora]


[Quora scaling a social network feed] [quora2]


[Redis ruby example] [redisruby]


[FriendFeed approach] [friendfeed]


[Thoonk setup] [thoonk]


[Yahoo Research Paper] [yahoo]


[Twitter’s approach] [twitter]


[Cassandra at Instagram] [instagram]


Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feedly-0.11.3.tar.gz (61.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page