Sinatra: 29 Links and Resources For A Quicker, Easier Way to Build Webapps

Sinatra, a Ruby "micro framework" for developing Web applications, is hot stuff! Despite being over a year since we first mentioned Sinatra (as used on a 100 line blogging app called Reprise), only now does Sinatra seem to have reached critical mass - it's on the cusp of becoming really popular. This is a good time, then, to check it out and see where it could fit into your own projects (with the new Rails Metal functionality (in edge/2.3 only) you can ever run a Sinatra app as a lightweight companion integrated with your Rails apps!)

Sinatra's official homepage provides an incredible number of alluring examples. Just install the sinatra gem or clone its git repository and you can have an ultra basic webapp running in just five lines of code:

require'rubygems'require'sinatra'get'/'do'Hello world!'end

Lots of awesome articles about Sinatra, Sinatra apps, and various links and resources have cropped up over the past few months. The remainder of this post links to the best we've found - most of which you should find useful as you start to explore Sinatra in detail. If you know of any others, please post links in the comments! Of course, if you ultimately agree with Ross Lawley that Sinatra's a "horrid looking ruby web framework that looks its born straight from the worst PHP frameworks" then you might also want to check out Ramaze!

Rails Meets Sinatra - Pratik Naik (of the Rails core team) shows how you can mount a Sinatra app into a Rails app (not just at the metal, as mentioned before) so that you can write Sinatra methods directly within Rails classes!

Sinatra Blogging Engines

Marley - A blog engine by Karel Minarik. It works by publishing posts that you write in your favorite text editor, stored as plain files. This link goes to a post that explains Marley's operation in detail - well worth looking at.

IRCLogger - A Sinatra based app that runs irclogger.com, a site that shows logs from several Ruby related IRC channels.

Thanks go to Karel Minarik ofRestafarifor supplying many of these links (as well as Simon Rozet with his list on Gist). Got your own? Leave a comment!

Support from: 1st Easy offers UK Rails hosting (dedicated and shared) running Phusion Passenger (mod_rails) and LAMP stack. If you want to get to know us first, or simply want to evaluate the performance of your Rails applications running on Passenger, we'll arrange a trial hosting account for you (full technical support included!)

People interested in Sinatra might also dig my Sinatra's Hat library, which let's you easily mount RESTful resources (it's ORM agnostic, though out of the box it works with DataMapper). Here's the project: http://github.com/nakajima/sinatras-hat.

Not really an app, but I made a simple site that scrapes HTML with hpricot off my github repo, with Sinatra, and found it is great for this type of thing, a small server side proxy, or a mashup data aggregator and provider. Have also used Sinatra for a single page site with a twitter and flickr gem to pull tweets and photos as a "live stream" type of site. http://webandy.com/2008/11/15/gadgets-and-demo-generator

Jeedee says:December 18, 2008 at 8:43 pm

Everyone is saying they made "small" apps using Sinatra but would it be also well suited for large applications as well? You can always use Ramaze which is amazing but what about Sinatra?

Lightweight software (including lightweight frameworks) is one of my interests, so it was good to read this. With the huge growth in the mobile space, light software is likely to grow in use too, due to the relative CPU and memory constraints of mobile devices.

BTW, you likely already know of them, but just in case, and also for other readers who also use or are interested in Python, CherryPy and web.py are somewhat similar frameworks to Sinatra, but for Python. Both of those also require only a few lines for an ultra basic web app, though maybe a bit more than your first Sinatra example above.

And on a related note, Python's WSGI (Web Services Gateway Interface) is increasingly getting supported by the newer Python web app frameworks. (It's also supported in, in fact is one of the main ways of using, Google App Engine.) I also read just recently that Ruby's Rack was inspired by WSGI.