Why Do Apple, GitHub and the BBC all use Sinatra?

Tweet

Jump Start Sinatra

It’s a new year, and what better way to kick off a year of learning than with the release of the third ebook in our Jump Start Series? In the digital edition of Jump Start Sinatra you can learn how to use Sinatra’s lightning speed and flexibility to make your Ruby projects sing!

Apple, GitHub and the BBC all use Sinatra, and the reason it’s become a natural choice for large companies like these is its ability to build fast and efficient web applications … without necessarily carrying the weight of Rails. The entire Sinatra codebase weighs in at less than 2,000 lines—-around 1% the size of Rails! This means that, as a developer, you get great performance and speed, the flexibility to work the way you want to and also easy to maintain code.

Now, let’s hear from author Darren Jones, as he explains Sinatra and his new book in more detail. Over to you Darren!

I started using Sinatra about three years ago, but found it quite hard at the time to find decent tutorials that explained how it worked. As I learned Sinatra, I made notes and wrote tutes. At the back of my mind, I wanted to collect all my Sinatra knowledge in one place and explain it from start to finish. Jump Start Sinatra is the result.

The book is small, which is fitting because Sinatra is small though perfectly formed. It is a Ruby DSL (domain-specific language) that is used for building websites, applications, or services. Sinatra allows you to develop applications rapidly with minimal fuss and setup using an expressive syntax that’s simple to follow. It’s fast and stable, without tying your hands with enforced conventions.

Jump Start Sinatra dives straight into using Sinatra in Chapter One with some basic examples, and then goes on to build a modular, database-driven website from start to finish. There are no barriers to entry; all you need is a text editor. Some experience of Ruby would help, but as long as you’re familiar with a bit of programming and HTML, you should be able to advance through it.

In the book, I cover using ERB and Slim to create views, using CSS preprocessors such as Sass, connecting to a database using DataMapper, using Sinatra’s configuration options and helper methods, using CoffeeScript to take the pain out of JavaScript, as well as deploying applications to the Heroku service. It also covers developing your own Sinatra extensions and middleware, as well as making modular applications that can be used as Rack middleware.

What excites me about this book is that it provides everything you need to know to go on and build a fully functioning web application. Sinatra gives you the tools to put your Ruby code onto the Web, then jumps out of the way to let you get on with developing your application your way. Whether you want to build a small and simple website, massive database-driven application, or the next big social media sensation, this book will give you the tools you need to get started.”

Thanks, Darren, for sharing your thoughts.

We look forward to hearing your comments and feedback …

  • Have you ever tried Sinatra (or Ruby)?
  • What other questions do you have?

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • David

    From Github: “Git hosting provider Github uses Sinatra for post-receive hooks, calling user specified services/URLs, whenever someone pushes to their repository”.

    Which means this is fallacious:

    “Apple, GitHub and the BBC all use Sinatra, and the reason it’s become a natural choice for large companies like these is its ability to build fast and efficient web applications … without the weight of Rails”

    Without the weight of Rails? Yet Github shouldn’t even be in that list because they use Rails as their main backbone..?

    • http://www.onsman.com Ricky Onsman

      I’ve slightly altered the wording so no inference should be made that none of Apple, Github or the BBC use Rails. Hope that helps.

  • DAZ

    Hi David,

    Thanks for pointing that out.

    I think it means that the companies chose Sinatra for the specific tasks that it is used for because they needed a lightweight solution. None of these companies use Sinatra to power their whole sites/applications, but they have chosen to use it in some situations when they don’t need the overhead of other frameworks. GitHub definitely use Sinatra, as you have pointed out, so I think they can be in that list, although it is unfortunate that they also use Ruby on Rails to power their site! The intention was not to imply that Sinatra is used instead of Rails in all instances.

    For the record, here is where BBC use Sinatra:
    http://zeitgeist.prototyping.bbc.co.uk/zeitgeist

    And Apple use it as part of their podcast library:
    http://www.apple.com/opensource/

    Hope that helps clear things up,

    DAZ

  • Richard Miller

    In theroy could you use Sinatra to build a complex web app? Such as a CMS for example?

    • DAZ

      Hi Richard,

      Definitely! You could use Sinatra to build any type of complex web application. I’d like to have a go at building a CMS using it.

      DAZ