I’m all excited. Happy is a-go! Only version 0.1.0, but at least it’s not a pre anymore. Hold on, I’m getting ahead of myself.
Happy is a new Ruby web application framework by Hendrik Mans. Originally developed for hamburg.io, it was extracted from that into a standalone gem, filling the niche between Ruby on Rails, the 800-pound gorilla in the room, and Sinatra, the rather barebones web framework.
Happy is a full-stack framework, and it not only uses, but embraces Rack, which makes lots of things a lot easier. Routing and control flow are explicit and concrete: There is no separate routing layer or routes map like in Rails, yet it’s more powerful than Sinatra’s route->block schema. Most of all, Happy‘s routing is very easy to reason about. You can decide to handle requests inline in your route
method, or pass them off to another Happy::Controller or any other Rack app. See some example code on Github.
To give you an idea about the expressive power of Happy: The hamburg.io app is a total of 141 lines of code, developed in less than four weeks, by a single developer. It is an event database with some nice date pickers, Twitter authentication, and an admin backend. Happy includes solutions for authorization, routing, resource mapping, templates with layouts, form helpers, date helpers and more, without unnecessarily reinventing the wheel. Although batteries are included, there is no default database layer or ORM, so you can and must choose your own (whether ActiveRecord or Mongoid or whatever) and write your own initializer code. Lots of other things are not in the framework itself because they can be handled by Rack middlewares, like session handling.
There’s a simple Happy example app on Github to give you a feel for happy, and of course you can look at a “real world” app because hamburg.io is on Github, too.
So, while building my first app using pre-0.1.0 versions, I found Happy lots of fun to work with. That’s more than I can say for many other frameworks, and it’s also something I’ve found lacking in Rails more and more recently. (Oh, and I also learnt that your layouts really should yield
if you want your view content to show up. I blame late-night coding.)
Happy might be the next big thing, and two years from now, everyone might be looking for Happy developers, so better get a head start. Or just do it for your own sanity. Or, you know, fun.
Try it out! Share the excitement! And make sure to send feedback via comments and Github Issues!
hmans is just a lovely person. and he knows how to build stuff.
congratz to him and thanks for the nice review.
Did you try Padrino, a full-stack framework based on Sinatra?
@Michael: Yup, a while ago. Padrino is nice, too. It’s definitely more mature than Happy, and a little more complex I guess. Now I’m thinking about trying to port the `def route` style dispatch to Padrino, because I still feel that it’s superior to the `method url, options do` pattern. That might just be the Happy excitement talking, however.