Thursday, March 8, 2012

Announcing Lightrail: Lightweight Rails stack for HTML5/JS applications

There's been a lot of debate lately surrounding Rails suitability for the server stack underlying modern HTML5/JS applications. Having used Rails for some four years for this purpose, and worked with a number of Rails core members, this is a problem I think the Ruby community has solved wonderfully, but yet some are confused as to what solutions are available or the way forward.

Rails 3 provided enormous advances in terms of letting you specialize what Rails provides to the problem at hand. However, to a certain extent this goes against the Rails mantra of "convention over configuration". While Rails 3 provides ample opportunities for configuration, as Rubyists, we shouldn't have to configure anything, right?

I'm a huge believer in both Rails' suitability as a backend for modern client-heavy HTML5/JS applications, and someone experienced in building such applications. Rails is, was, and continues to be a game-changer for modern web development. ActionController::Metal provides the bare minimum needed to build apps which don't need the complete set of HTML-generating abstractions provided by ActionView, but need more tools than a more minimalistic framework like Sinatra makes available. Between Sinatra and Rails lies an unaddressed middle ground, one where, in theory, you should be able to build an ActionController::Metal stack appropriate to your needs, but maybe this is too daunting a task.

For you, the JSON API builder, who wants more than Sinatra but less than Rails... I have what you desire. Introducing Lightrail:


What is Lightrail? Lightrail is Strobe's ActionController::Metal stack for HTML5 applications, originally used to provide the backend APIs for Strobecorp.com and its frontend HTML5/JS application authored with SproutCore (which has been superseded by Ember.js).

Lightrail contains everything you need to build lightweight applications on the Rails stack which serve only JSON, and furthermore, contains an innovative system for building JSON APIs around your objects. Rather than adding a fat #to_json method on your models, or using a template to construct your JSON, Lightrail's allows you to map the JSON serializations of your objects to specific wrappers that know how to serialize specific objects. Like using #to_json, this makes it easy to recursively serialize nested objects to JSON without having to use ActionView voodoo like invoking other renderers. Besides that, it still separates the concerns of what your domain objects are and how they serialize to JSON. If you've tried to build JSON APIs in Rails and found the existing mechanisms for JSON serialization lacking, please try out Lightrail::Wrapper and let me know what you think.

Lightrail is something of an experiment. I didn't write it, but it's software I believe in so much I'd like to support it and see if people are interested in it. Rather than competing with Rails, Lightrail takes the latest, greatest Rails stack and reconfigures it for lightweight applications that provide a JSON API exclusively. Lightrails builds upon all of the modularity that Rails 3 brings to the table, and simply and easily delivers a lightweight stack which is still suitable for complex applications.

Please let me know if Lightrail seems like a good idea to you and if you'd like to help support it. As I have my hands in an awful lot of other open source projects, Lightrail isn't the sort of thing I can support full time. However, if you have some time to spare and ideas to contribute, I am definitely looking for people to help maintain and improve this project.

If you're interested in using Lightrail or helping out with its development, sign up for the mailing list. Just send any message to lightrail@librelist.com to join.

20 comments:

cvmtwt said...

looks great!

I tried using it by adding the gem to my gemfile and extending one of my controllers with Lightrail::ActionController::Metal, but I got an error (uninitialized constant Lightrail). What am I missing?

Tony said...

You need to require 'lightrail/railtie'

I'll be adding an application generator to it this weekend so you can just do "lightrail new myapp" to get a fully configured application just like you would with rails.

Anonymous said...

Wow, very comprehensive review. I'm thinking about learning HTML5. I'm seeing more and more job/freelance listings asking for html5 media playerknowledge and so along with reading some of the online references you listed, I'm going to have to pick up the book as well. Really appreciated the chapter breakdowns.

James Martin said...

This page provides good information about HTML5 and JS apps. Here viewers can learn many techniques of professional html5 mobile game development. Thanks

Anu Sri said...

Informative post. Keep sharing such a useful post.

html5 training in chennai

Charlie Hamilton said...

The article you have shared here is very awesome. I really like and appreciate your work. The points you have mentioned in this article are useful.
Back Office Support Solutions

قمم التميز said...

شركة تنظيف بالمزاحمية
شركة تنظيف فلل بالمزاحمية
شركة مكافحة حشرات بالمزاحمية
شركة مكافحة النمل الابيض بالمزاحميه
شركة رش مبيدات بالمزاحميه
شركة عزل فوم بالمزاحية

Aliya said...

Surveillancekart | CCTV System
Pestveda | Pest Control
Termite control
cctv installation services
best home security camera system

Anosh Alassi said...

شركة تركيب اثاث ايكيا بالرياض
شركة تركيب ستائر بالرياض
شركة تنظيف مكيفات بالرياض
شركة تركيب غرف نوم بالرياض
شركة تركيب باركية بالرياض

emma said...

cctv camera dealers in delhi
cp plus cctv camera online
hikvision camera online
cctv camera installation services in delhi
cctv camera installation services in gurugram
cctv camera installation services in gurgaon

نور الهدى said...



نقل عفش بالرياض

نقل عفش بجدة

نقل عفش بالطائف

نقل عفش بالمدينة المنورة

نقل عفش بالدمام

نقل عفش بمكة

Dida ELhaik said...

شركة تنظيف خزانات بخميس مشيط
شركة تنظيف بيوت بخميس مشيط
شركة تنظيف بخميس مشيط
شركة تنظيف شقق بخميس مشيط
شركة تنظيف فلل بخميس مشيط
شركة تنظيف منازل بخميس مشيط
شركة مكافحة حشرات بخميس مشيط

Emma said...

avriq Desktop/Laptop Repair
avriq yellow pages
avriq bbb
avriq business services
avriq
Avriq India

Escorts cart said...



Female Escorts Quietly, the Native American identified to people who would listen the benefit of clothing her, providing the jewels of her crown. Establishing all that after covered her in class. She would be allowed to provide back to not solely the creatures, the Native Americans, however to the white skinned people. And she has, allowing them to establish suggests that to feed their greed. Weakening areas of her muscular body. Weakened but not defeated.
Female Escorts,High Class Call Girls,Escorts Girls,Escorts ,Escorts near me
Female Escorts





Escorts cart said...

Female Escorts When what seemed hours Dr Stapleton appeared and known as my name. We shook hands once more and that i followed him to his consulting room and sat down.For the primary time the gravity of true extremely hit home. I had heard that bone cancer had its own fearsome reputation, and two of my friends had died when battling this disease. I may feel the anxiety rising within me, and my heart beat appear to rise with each thought. I felt sort of a prisoner facing a choose, and expecting his verdict. Was this visiting be the start of the top of my life? I braced myself for the decision.
Female Escorts

Escorts cart said...

Female Escorts: However, for the poor and middle-category Latina, it is an issue as to how several might develop false expectations that the long run holds a offer of Padrinos willing to lavish tens of thousands to hundreds of thousands on her education, wedding, new home, new car and her guaranteed rosy future.
Female Escorts,High Class Call Girls,Escorts Girls,Escorts ,Escorts near me
Female Escorts

shabnam praveen said...

Call girls in Kolkata
Call girls in Chandigarh
Call girls in Chandigarh
Call girls in Gurgaon
Call girls in Chandigarh
Call girls in Chandigarh

shabnam praveen said...

Call girls in Lucknow
Call girls in Guwahati
Call girls in Mumbai
Call girls in Jaipur
Call girls in Jaipur
Call girls in Jaipur
Call girls in Bangalore

Alex daina said...

Shed every one of your stresses, for help is a mouse click away as payday credits. Payday credits are a standout amongst the most advantageous methods for getting a loan today with for all intents and purposes no printed material or different problems. payday loans corona

Dida ELhaik said...


شركة تركيب أثاث بالرياض...شركة صقر المملكة
الكثير منا يتعرض للانتقال من مكان لاخر للعيش في منزل جديد تتعدد اسباب التنقل ولكن الفكر الذي يشغلنا يظل واحد وهو نقل الاثاث وفكة وتركيبه من مكان الي مكان وكيفية تجنب الاضرار والمخاطر التي نواجهها في عملية الانتقال من مكان الي اخر والخوف عل كل قطعة اثاث بالمنزل وما نحتاجه من تعبئة وتغليف ونقل لتلك الاثاث لكن كل هذة المخاوف اصبحت غير مقلقة بالمرة بتواجد افضل شركة تركيب اثاث ايكيا بالرياض متخصصة في نقل الاثاث وفكه وتركيبة من مكان لاخر وايضا تغليفه وتوصيلة في امان تام وذلك مع شركة صقر المملكة افضل فني تركيب اثاث ايكيا بالرياض تتولي شركتنا عملية انتقال أثاثك إلى منزلك الجديد في امان تام دون معانة أو إرهاق لك ولأسرتك كما انها تحافظ علي كل قطعة اثاث تنقلها لضمان وصولها في امان تام ، في اقل فترة ممكنة ووجيزة تضمن لك استئنافك لعملك وأنشطتك المعتادة عليها في اسرع وقت ممكن ، حيث تتولى شركة صقر المملكة القيام بكافة الخدمات والمراحل المتطلبة لنقل أثاثك بداية من الفك والتنظيف والتغليف الجيد ونهاية بتركيب الأثاث بكل مشتملاته وترتيبه في المنزل الجديد، من خلال
فريق العمل الكبير
شركة تركيب ستائر بالرياض
فني تركيب ستائر بالرياض
شركة تركيب غرف نوم بالرياض
شركة تركيب غرف نوم صيني بالرياض
ارخص شركة تركيب غرف صيني بالرياض
افضل شركة تركيب باركيه بالرياض
ارخص شركة تركيب باركية بالرياض
لزيارة موقعنا
http://www.saqr-sa.com/%D8%AE%D8%AF%D9%85%D8%A7%D8%AA-%D8%AA%D8%B1%D9%83%D9%8A%D8%A8-%D8%A7%D8%AB%D8%A7%D8%AB-%D8%A7%D9%8A%D9%83%D9%8A%D8%A7-%D8%A8%D8%A7%D9%84%D8%B1%D9%8A%D8%A7%D8%B6/