September 27, 2011

Social Cookbook: an open source Open Graph app

Last week, at Facebook's annual f8 conference in San Francisco, we released Open Graph along with the new Facebook Timeline. Open Graph is the biggest change to Facebook's Platform since it launched in 2007. If you missed the live stream of the conference, I highly recommend you check out the keynote.

At a recent Facebook Hackathon, I made a social cookbook app built on Open Graph to test all of our new products. I am open sourcing it in case it is useful for any of you to get started with the product. You can use the app at http://socialcookbook.me/, but the source code is probably more interesting than the app for most of you. It is available on Github.

Note that in this Developer Beta period, the app probably won't work properly (i.e., it won't add stuff to your Timeline yet). It will start working in its current form as soon as Timeline starts rolling out more broadly and Open Graph is open for business.

Here's what the app looks like:

Social Cookbook Recipe

When you add a new recipe or a friends' recipe to your cookbook, that activity also goes to your Facebook timeline:

Once you add a recipe to your cookbook, you can let your friends know you cooked the recipe with the click of a button - and that, of course, also is reflected on your timeline.

In the Facebook developer app, I configured those Open Graph actions (I use "clip" for adding a recipe to your cookbook) and the "recipe" object type:

I configured three different aggregations for people's timelines: Cooked Recipes (a reverse chronological list of recipes I've cooked), Most Cooked Recipe (an "item" layout style with the recipe you cooked most often that month or year), and My Recipes (a grid of all the recipes you added that month).

I also support uploading photos, which are stored in Amazon S3 and served by Amazon CloudFront.

The bulk of the code is in cookbook.py. The service is built with Tornado for obvious reasons :)

Hope this helps you get started with Open Graph.