Ultra-Modern
Front End
Architectures
                           @aaronwhite
            Boundless CTO, Co-founder
         http://github.com/GoBoundless
In the beginning         Sir Tim Berners Lee said...



                      GET
                                         CERN
                                         HTTPd
WorldWideWeb
                        200 OK
               HTML

                      ...and it was OK
but then Brendan Eich went all...

                GET

                           Server

                  200 OK

         HTML
but then Brendan Eich went all...

                GET

                           Server

                  200 OK

         HTML
but then Brendan Eich went all...

                GET

                           Server

                  200 OK

         HTML

             ...and sh*t got real
real complicated
Problem #1:
Redundant HTML rendering
   (Server-code & JS)
Problem #2:
 Duplicated Logic
(Server-code & JS)
Problem #3:
Coordinating URL Space
(Across Server & Client)
Problem #4:
Who’s responsible for what?
What’s my server doing?
Database negotiations
Business Logic
URL management
UI/HTML rendering
JSON rendering
What’s my client doing?

Maintaining state
Business Logic
URL management
UI/HTML rendering
What should the server be doing?


 Authority on request integrity
 Accessing/updating DB
 Serving data
What should the client be doing?

 Render UI
 Interactivity
 Logical requests to server
 UI state management (URL)
So how about this...


             Single UI App
            ‘packet’ upfront



            GET / POST
                                API
               { json }        Server
                only
We can do even better....

                                 CDN
            Single UI ‘packet’
                 upfront



            GET / POST
                                  API
                { json }         Server
                 only
Server: now, HTML-ZERO
That’s kind of amazing for a web-app,
and increasingly, the future
Demo time!
http://app.boundless.com
Benefits:

Fast first page-loads, lightning fast thereafter
Very fast user-experience
Clean separation of concerns between server/client
Front-end completely back-end agnostic
API easily serves mobile, 3rd party, etc
Challenges:

Increased front-end complexity
Increased build / deployment complexity
Modern browsers only (but thank god!)
SEO complicated (a whole other presentation)
Challenge #1:
Increased Front-End
     Complexity
Front-End Complexity


A TON of Javascript
A TON of CSS
App organization
Pro-tip #1: HAML
Pro-tip #2: SASS
Pro-tip #3: CoffeeScript
Pro-tip #4: MVC




        ...and plenty of others

     find the one that works for you:
http://addyosmani.github.com/todomvc/
Challenge #2:
Build / Deployment
    Complexity
CoffeScript
         CoffeScript       JS Packet

CoffeScript



  SASS                                          CDN
              SASS        CSS Packet

  SASS




                       HTML / Image Assets
                                             (coordinate against
                                                API changes)
Introducing

                  Spar*



http://goboundless.github.com/spar

                                 *single page app rocketship
Spar was built to....
Accelerate local single page app development

Support for Coffeescript, SASS, Haml, Less, etc

Handle asset compilation & stitching

1-command deploys to Heroku, S3, Cloudfront etc

Extensible
Spar handles your
   front-end

You build your API
  anyway you like

   We happen to prefer Scala,
    Unfiltered and MongoDB
Getting Started
$ gem install spar
$ spar new myapp
$ cd myapp
$ spar server
Sample App
$ git clone git@github.com:GoBoundless/spar-examples.git
$ cd spar-examples/todos
$ spar server
Thank you!
       @aaronwhite
and Team Boundless
Questions?
we have answers!

Ultra-modern Front-end Dev & Introducing Spar