Reusing your frontend JS on the server with The Ruby Racer and/or Ruby Rhino
summary
Shows how a Rails app embeds V8 via Ruby Racer (or Ruby Rhino on JRuby) to execute the same CoffeeScript Backbone models server‑side, avoiding duplication. Uses thin Ruby wrappers to inject a Ruby view into JS layouts and renders PDFs with Prawn, reusing 50+ tiny financial models (15 core ratios) so one change updates browser UI and a 34‑page PDF. Prototype compiles assets on the fly, handles fake window/console, and produces a 34‑page PDF from ~200 lines of Ruby.
AI-written summary · about
chapters (9)
- 0:00Introduction and context
- 1:00Business model challenges
- 2:45Front-end architecture
- 4:25The PDF generation dilemma
- 6:19Implementing cross-platform logic
- 9:01Server-side integration
- 10:53Layout and view wrappers
- 14:24Benefits and results
- 15:54Q&A and closing
related talks
33mThe Ruby Racer: Under the Hood
34mYour Front End Framework is Overkill - Server Side Javascript w/ Rails
46mEmbracing Collaboration with JRuby and JavaScript
28mBuilding in Rails, Backbone, and CoffeeScript
33mWeb applications with Ruby (not Rails)
35mWriting web application in Ruby
30mWeb Applications with Ruby (not Rails)
40mFRONTEND CHOICES
