JSON all the way
Javascript in the humanitarian world



                     
Who the hell..?
              我们是谁




Makara Wang   Ronan Berder     Wiredcraft
   王浩宇            小熊         http://wiredcraft.com
And what do you do?
                  我们做什么

• Data centric apps
• Humanitarian and non-profit space
• In Shanghai and Washington, DC
  (and soon SF)
Before we get started
        引言
What’s Reliefweb?
          Reliefweb是什么

• Re-launched in 2011
• News for the humanitarian world
• Built on Drupal... I know
  (PHP + MySQL + Sphinx)
http://reliefweb.int
What then?
             客户需求

• Need to innovate
• Built a prototype and pitched it:
  User profiles + Mobile
The breakup
   失败
What happened?
              为什么


• Fighting the framework
• Performance concerns
• Way too many layers

Back to the whiteboard
                       更高要求
• We need consistency
• We need simplicity
• We need flexibility
• We need speed
  And about a million other things...
So, what do we build?
        目标
http://humanitarianid.org
Who will save us?
    救星来了
Why JS?

• Great for a RESTful API
• Great too for a light client
• Other perks; performance, tools...
  And... we already know it.
The back-end
   服务端




    
Bones for the API
       什么是  Bones

• RESTful JSON + OAuth
• Bones = express.js + backbone.js
  https://github.com/developmentseed/bones


• Share models on client and server
Show me the code



     </>
And then some more...
      更多规范

• JSON Schema
• OAuth
• REST
The front-end
   客户端
Using what we know
       最流行的

• HTML5 + jQuery mobile + Backbone.js
• Phonegap
• and... Jekyll
Why Jekyll?


• HTML5 apps can get messy
• Jekyll gives us templates & includes
  And we’ll be able to host it on Github pages...
Show me the code



     </>
A tiny bit about storage
        存储方案
Elastic search
• Started with CouchDB
• Now Elastic Search & Redis, because:
 • Full text search,
 • Document oriented,
 • REST API,
    Slower, but we don’t care.
Show me the code



     </>
A few thoughts
   少少结论
Why so serious?
            不好的

• Not a lot of best practices
  but we’re trying hard to build some


• Some stuff still sucks
  jQuery mobile, I’m looking at you
The good stuff
                好的

• JSON all the way
• Javascript all the way
  And performance, tools, community...

What we see
      我们看到的未来

• The line is getting blurry:
 • more fragmentation...
 • but more communication
• Loosely coupled systems
Questions?
有问题吗?

      

JSON all the way

  • 1.
    JSON all theway Javascript in the humanitarian world  
  • 2.
    Who the hell..? 我们是谁 Makara Wang Ronan Berder Wiredcraft 王浩宇 小熊 http://wiredcraft.com
  • 3.
    And what doyou do? 我们做什么 • Data centric apps • Humanitarian and non-profit space • In Shanghai and Washington, DC (and soon SF)
  • 4.
    Before we getstarted 引言
  • 5.
    What’s Reliefweb? Reliefweb是什么 • Re-launched in 2011 • News for the humanitarian world • Built on Drupal... I know (PHP + MySQL + Sphinx)
  • 6.
  • 7.
    What then? 客户需求 • Need to innovate • Built a prototype and pitched it: User profiles + Mobile
  • 8.
  • 9.
    What happened? 为什么 • Fighting the framework • Performance concerns • Way too many layers
  • 10.
  • 11.
    Back to thewhiteboard 更高要求 • We need consistency • We need simplicity • We need flexibility • We need speed And about a million other things...
  • 12.
    So, what dowe build? 目标
  • 13.
  • 14.
    Who will saveus? 救星来了
  • 15.
    Why JS? • Greatfor a RESTful API • Great too for a light client • Other perks; performance, tools... And... we already know it.
  • 16.
    The back-end 服务端 
  • 17.
    Bones for theAPI 什么是  Bones • RESTful JSON + OAuth • Bones = express.js + backbone.js https://github.com/developmentseed/bones • Share models on client and server
  • 18.
    Show me thecode </>
  • 19.
    And then somemore... 更多规范 • JSON Schema • OAuth • REST
  • 20.
    The front-end 客户端
  • 21.
    Using what weknow 最流行的 • HTML5 + jQuery mobile + Backbone.js • Phonegap • and... Jekyll
  • 22.
    Why Jekyll? • HTML5apps can get messy • Jekyll gives us templates & includes And we’ll be able to host it on Github pages...
  • 23.
    Show me thecode </>
  • 24.
    A tiny bitabout storage 存储方案
  • 25.
    Elastic search • Startedwith CouchDB • Now Elastic Search & Redis, because: • Full text search, • Document oriented, • REST API, Slower, but we don’t care.
  • 26.
    Show me thecode </>
  • 27.
    A few thoughts 少少结论
  • 28.
    Why so serious? 不好的 • Not a lot of best practices but we’re trying hard to build some • Some stuff still sucks jQuery mobile, I’m looking at you
  • 29.
    The good stuff 好的 • JSON all the way • Javascript all the way And performance, tools, community...
  • 30.
  • 31.
    What we see 我们看到的未来 • The line is getting blurry: • more fragmentation... • but more communication • Loosely coupled systems
  • 32.