Hello Social World

Hellokitty
Photo by Dr Case

These days it doesn't make much sense to build a consumer site with its own private account system. If users sign in using Twitter or Facebook, you can have them easily spread the word on what they're doing in your application through tweets or wall posts. The old 'enter details'/'email confirmation'/'click link' process was a leaky funnel that lost potential users too, and was a pain to implement, since automated emails alone are an art in themselves.

I wanted to use this approach on one of my sites, but I couldn't find a good example. Especially in the Rails/Sinatra world there were plenty of building blocks available for doing the individual tasks, like authenticating through Twitter or Facebook, calling their APIs, and storing data, but nothing that showed how to use them together. So, because I needed to build it anyway and it would be a good Ruby learning exercise, I set out to create a minimal-but-complete template that handled user creation, authentication, custom data storage and external sharing. In the spirit of the classic 'Hello World' code examples, here's Hello Social World.

You can try a live demo at http://hellosocialworld.heroku.com/. It's built to do the bare minimum you need for a modern social site, letting users log in, edit some data they own on your site, and then share the results with their friends on Twitter or Facebook. The data in this case is just the user's favorite color, but imagine replacing that with whatever content they actually create on your site; blog posts, photo galleries, comments, etc. It's deliberately left with zero styling, so you can add your own view code.

I was really impressed by the elegance of Ruby and the Sinatra framework. Aside from the API keys, all the code's in a single 440 line file, and 120 of those lines are comments. This is possible because the gems handle most of the heavy lifting for me. It feels very productive to focus on my application logic instead of writing boilerplate code. There were moments of frustration when things went wrong, the black box nature of gems makes them tough to debug, but there seems to be a big enough community using them that they mostly just work.

I'll be using this template heavily myself over the next few weeks, which will hopefully give me ideas on improvements, but let me know if you have bug reports or suggestions. I'm looking forward to hearing people's thoughts on this approach to a turn-key social site too. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: