Want to stay on top? Ruby Weekly is a once-weekly e-mail newsletter covering the latest Ruby and Rails news.
     Feed Icon

Padrino: A Webapp Framework Wrapped Around Sinatra

By Peter Cooper / April 1, 2010

Hot on the heels of Sinatra 1.0 comes the official release of Padrino (or GitHub repo), a webapp framework that provides an extra layer of functionality on top of Sinatra (like helpers, generators, admin interface, and internationalization). Padrino is Sinatra 1.0 compatible.

Developers Davide D'Agostino, Nathan Esquenazi and Arthur Chiu love Sinatra and its development philosophy, but want to provide a deeper, standardized layer of functionality on top of the typical Sinatra stack. True to form, Padrino extends Sinatra with a wealth of extra features:

  • Namespaced route aliases
  • Nested routes
  • Controllers
  • i18n / Internationalization
  • Mailer system
  • Django-esque admin interface
  • Unified logging
  • Tag, asset, for, and tag helpers for use in views
  • App, model and controller generators

Most of these features can be added to Sinatra already, either manually or by selecting from a wide assortment of independent plugins. Padrino, on the other hand, provides a standard suite of functionality that, hopefully, will continue to be improved as a whole over time. It feels a lot like Ramaze but with the similar functionality wrapped around Sinatra instead.

The Padrino team have done a great job putting together its official Web site and there's a lot of documentation to peruse. They've also put together a guide to contributing to the project if you want to get your hands dirty. There's also a 12 minute screencast:

Comments

  1. al says:

    Yet another webapp ruby framework, why?

  2. Sleeptillseven says:

    Yea! Check it out. I love it.

  3. kenny says:

    not a fan. it's not "lightweight". sinatra is lightweight. rails is heavyweight. this is neither. this is some chosen features dumped on top of sinatra. it would be much better as individual modules you could easily add.

  4. Nat says:

    kenny,

    before submit your sentence try it or read (well) about it.

    > it would be much better as individual modules you could easily add.

    http://www.padrinorb.com/guides/standalone-usage-in-sinatra

    Sinatra is lightweight because is a MicroFramework, this seems to be a full web framework, with generators, helpers, admin ... but a little smaller compared with others.

  5. Arthur says:

    Kenny,
    Luckily, Padrino allows you to pick individual modules that you could easily add.
    http://www.padrinorb.com/guides/standalone-usage-in-sinatra

  6. DAddYE says:

    @kenny, I only suggest you to read some of our docs.

    Btw there is also a QuickTime version and transcript here:
    http://www.padrinorb.com/guides/blog-tutorial

  7. Ted says:

    Kenny, it's more than a "bunch of features dumped on Sinatra"

    It's a very elegant frameworks that, IMHO, has made a lot better decisions than Rails.

    You really ought to try something out before you decide not to be a fan.

  8. jaze says:

    Looks great, lots of helpful materials on the official site. I will surely check it out as I enjoy Sinatra, but had always felt it was missing some features out of the box.

    (As a person quite new to web development extending Sinatra on my own was a difficult task, not every gem worked, not every thing was decently documented, etc. - having a standard package solves most of this!)

  9. Richard Conroy says:

    I have just done a rather big project in Sinatra (course work). By big, I mean there's a lot of code present. There is a huge opportunity for DRYing all this up, and I am looking forward to what Padrino brings to the party.

    I would be very interested to see how Padrino compares with Monk and Pancake, feature-wise and philosophically.

  10. Paul says:

    @kenny: you're probably sayin' to yourself that hey i'm gonna go out there & i'm gonna get the world by the tail, wrap it around, pull it down & put it in my pocket...well, i'm here to tell you that you're probably gonna find out, as you go out there, that you're not going to amount to JACK SQUAT!!!

  11. http://dashin.co.uk says:

    I love Sinatra the way it is. I use it for simple web-sites and RESTful interfaces.
    For other purposes I use RoR.

    Another framework? What for?

  12. KD says:

    Because Rails is not the end-all. People said the same thing about rails when it came out. Not all of us are tools that just accept the status quo. If you can't handle change, change professions. There were hundreds of web frameworks that came out before Rails did, and in many respects Rails built on the shoulders of those early pioneers.

    I'm probably not going to find a use for this framework, but it's got some great ideas on it, and it's going to work great for a lot of people. Sinatra is a fantastic engine for laying frameworks on top of, and I'm learning a lot of good things from these efforts. We've done something similar for our work, for a development problem which would have not been easy to solve with either base Sinatra or Rails.

  13. rubiii says:

    > Another framework? What for?

    freedom of choice. diversity. new ideas that one day might be implemented in your favourite framework as well.

  14. Ben says:

    Sinatra is great for writing modular rack-mounted applications that can be reused across projects.

    For smaller pieces there are Sinatra Extensions or simple module mixins.

    Why do you need to create new namespaces and base classes? There are a bunch of Sinatra-based "frameworks", and I don't like any of them. Sinatra is predictably simple, predictably maintained, and all I want is *Sinatra* apps, extensions, and dependency-free modules.

    I liked "sinatra_more" better, and it would be nice to grow a sinatra and generic web "facets" lib instead of piling frameworks on top of each other.

    That said, I think it's great to try to compete with and/or provide alternatives to Rails. I just think that libraries are better than frameworks (in terms of high cohesion, loose coupling, and having less proprietary API/conventions to work through).

  15. IVANOV says:

    Im using padrino from one week and I think its clean and simple API is awesome.

    So in reply to Ben:

    > Why do you need to create new namespaces and base classes?

    Depends, for complex things I think this can be helpful.

    > here are a bunch of Sinatra-based "frameworks", and I don't like any of them.

    Can you tell us about that? I searched on github for a couple of days and I found some like chicago big_band but any of them seems to be complete like this framework. Any of them has: Bundled I18n ? Orm adapters? Generators? Reloader? Logger? Named routes? Respond To? FULL Helpers? ADMIN INTERFACE ????

    > I just think that libraries are better than frameworks

    I think this depends on how many applications do you build and manage.

    I don't love repeat my self so for each app cut/paste files add remove same code is not beautiful ... almost for me.

    Then consider that every "external library" is enginered for itself and not for work togheter with another. The better thing that I see in Padrino IMHO is how it was designed.

  16. Nathan Esquenazi says:

    I am one of the Padrino core developers. We have really appreciated all the comments and reactions posted here and elsewhere around the web since the announcement of Padrino! I took some time to address a couple common concerns in our latest blog post: http://www.padrinorb.com/blog/addressing-concerns-about-padrino . I hope this helps clarify a few things and thanks again for checking out Padrino.

  17. Peter Zingg says:

    Used padrino for a project since 0.7. Very nice Sinatra extensions. If you prefer to work mostly at the Rack level and with DataMapper as the default instead of ActiveRecord, padrino is a good alternative to Rails.

    Admin interface (based on http://github.com/pilu/web-app-theme) out of the box if you want it is a plus.

    Support for tasks and other goodies that Sinatra doesn't have.

    Recommended. Would like to see a community rising around this and other frameworks. Why not?

  18. grantmichaels says:

    I'm a fan, but I'd like to see benchmarks on the homepage ...

    It's hard for me to reason about a middle of the road product without seeing how it compares to the controls (rack to rails) in terms of performance ...

  19. Nathan Esquenazi says:

    Just released major update version 0.9.10 which includes bug fixes, new features and a lot of performance optimizations. We also have application benchmarks now detailed in our latest blog post.

    Read more about the latest release here: http://www.padrinorb.com/blog/padrino-0-9-10-released-built-for-speed . Let us know what you guys think!

Other Posts to Enjoy

Twitter Mentions