Steve Klabnik

Scorched: a new Ruby web framework

Disclaimer: this is a story about Ruby web frameworks, and I have commit bit to Rails

Ruby has a long tail of web frameworks. There’s the big dogs, Rails and Sinatra, there’s some smaller frameworks with a devoted following like Padrino or Camping, and then there’s a ton of other frameworks like Ramaze, Merb, Cuba, or Renee.

Now, we have another: Scorched. Here’s what it has to say about itself:

Scorched is a true evolutionary enhancement of Sinatra, with more power, focus, and less clutter.

This looks to be true. Here’s a Hello World in Scorched:

require 'scorched'
class App < Scorched::Controller
  get '/' do
    'hello world'
run App

Here it is in Sinatra:

require 'sinatra/base'
class App < Sinatra::Base
  get '/' do
    'Hello world!'
run App

Sooooo yeah. What’s different about it then? It takes on a very anti-“full stack” philosophy:

unlike other lightweight web frameworks that attempt to hide Rack in the background, Scorched makes no such attempts, very rarely providing functionality that overlaps with what's already provided by Rack. In fact, familiarity with Rack is somewhat of a pre-requisite to mastering Scorched.

You can do this kind of thing with Scorched, which somehow makes it feel even more low-level than Sinatra, yet higher-level than Rack:

map pattern: '/', priority: -99, conditions: {methods: ['POST', 'PUT', 'DELETE']}, target: proc { |env|
  [200, {}, 'Bugger off']

The documentation is pretty, and seems very full.

Scorched is also sponsored by Phusion, who make the popular Passenger app server.

You can get the code on GitHub, of course!

One more note: it was pointed out to me on Twitter that Scorched requires Ruby 2.0 only, and that’s true:

Scorched requires Ruby 2.0 as it makes use of a couple of new features. By the time Scorched hits v1.0, there should be little reason not to be running Ruby 2.0.


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00