SlideShare a Scribd company logo
JavaScript Everywhere
            From Nose To Tail




            Carl Husselbee - Sensis
Cliffano Subagio (@cliffano) - Shine Technologies
Citysearch.com.au
New Platform

  Improved application performance
  Better memory usage
  Improved content publishing reliability
  Zero content duplication
  Improved user experience

(project is still ongoing...)
The Three Amigos



 +         +
One JavaScript To Rule Them All
In A Nutshell
CouchDB
         Document oriented

             Schema free

    Design document in JavaScript

        Incremental replication

              HTTP API
Document

Simply a JSON object
{
    "_id": "listing-123",
    "_rev": "D1C946B7",
    "business_name": "Wolfgang Puck",
    "desc": "Fine dining and casual dining...",
    "rating": 5,
    "city": "Melbourne"
}

Stays as JSON on all layers
Replication


 Content publishing - replication rule
 curl -X POST "http://host/_replicate"
 -d '{"source": "db-src", "target": "db-target", "continuous": true}'
 -H "Content-Type: application/json"

 Content indexing - continuous changes feed
 curl -X GET "http://host/db/_changes?feed=continuous&since=123"
Design Document
A simple map reduce
"views": {
   "melbourne_rating": {
     "map": function (doc) {
         if (doc.city === 'Melbourne') { emit(null, doc.rating); }
     },
     "reduce": function (key, values, rereduce) {
         return sum(values);
     }}}

Highly testable
Easy to mock up
Cradle


CouchDB client for Node.js
Uses CouchDB REST API
Asynchronous
Built-in caching
Node.js

          Server-side JavaScript


              Based on V8


             Single Threaded


            Non-blocking I/O
Single Threaded
No more thread deadlock
More predictable app server memory usage
Like Nginx vs Apache
Non-blocking I/O

I/O is expensive
Traditional web app wastes time on I/O
 // blocking                      // non-blocking
 var listings = db.getListings(); var callback = function
 render(listings);                (listings) {
                                      render(listings);
                                  }
                                  db.getListings(callback);


Node.js provides non-blocking API
The Callback Trap
Nested Callbacks
var util = require(‘util’), listingId = 'listing-123';
function commentsCb(err, result) {
   if (err) {
   } else {
       console.log('Comments: ' + util.inspect(result));
   }
}
function listingCb(err, result) {
   if (err) {
   } else {
       console.log('Listing: ' + util.inspect(result));
       db.getComments(listingId, commentsCb)
   }
}
db.getListing(listingId, listingCb);
A Better Way
Use control flow module
var async = require('async'), listingId = 'listing-123';
function getComments(cb) {
    db.getComments(listingId, cb);
}
function getListing(cb) {
    db.getListing(listingId, cb);
}
async.parallel({ comments: getComments, listing: getListing },
function (err, results) {
    // results gives { listing: listingResult, comments: commentsResult }
});

Lots of other solutions: TameJS, Step, Seq, etc
Async In A Loop

This looks innocent

for (var i = 0; i < 1000000; i++) {
   console.log('Meditate on this, you must!');
}
Async In A Loop


console.log is asynchronous
Node.js is faster than terminal display
Library Changes

Within the past one year:
 Homegrown web framework >> Express
 node-couch >> Cradle
 Various template engines >> Jazz
 Promises >> Callbacks + Async
Testing

Insanely fast even on slow PC
15,000 SLOC
100% test coverage
34 seconds
YUITest, JSCoverage, nodelint
Homegrown Modules
Jazz - template engine
{foreach doc in widget.docs}
   {if (doc.type eq 'video')}
       <span><a href="{doc.videourl}">{doc.title}</a></span>
   {else}
       <a href="{helper.createUrl(doc.key)}">
          <h3>{doc.title}</h3>
       </a>
   {end}
{end}

No business logic
Synchronous compilation, asynchronous evalua
More Homegrown Modules


Log4js-node - logging framework
Severity level and rolling log file
Couchtato - CouchDB document utility tool
Doesn’t require CouchDB design doc knowledge
Continuous Integration


 Jenkins Node.js Plugin
 Nestor - Jenkins Node.js CLI
Conclusion




      CouchDB rocks! Node.js rocks!
       JavaScript web stack rocks!
Questions?
Resources
CouchDB - http://couchdb.apache.org

Node.js - http://nodejs.org

Jazz - http://github.com/shinetech/jazz

log4js-node - http://github.com/csausdev/log4js-node

Couchtato - http://github.com/cliffano/couchtato

Jenkins Node.js Plugin - https://wiki.jenkins-ci.org/display/JENKINS/NodeJS
+Plugin

Nestor - http://github.com/cliffano/nestor
Credits


 http://www.flickr.com/photos/daveaustria/2654190796/ by Dave Austria

 http://www.flickr.com/photos/38485387@N02/3580728177/ by flickrfavorites

 http://www.housecontainer.nl/blog/about-me/127-dj-yoda-from-star-wars.html

 http://www.miccicohan.net/blog/studio-antics-and-of-coursethe-rolling-stones/

More Related Content

What's hot (20)

PDF
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AWS Chicago
 
PDF
Functional Web Development
FITC
 
PDF
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Codemotion
 
ODP
Event Loop in Javascript
DiptiGandhi4
 
PDF
Flask and Angular: An approach to build robust platforms
Ayush Sharma
 
PDF
«От экспериментов с инфраструктурой до внедрения в продакшен»​
FDConf
 
PDF
Google App Engine Developer - Day4
Simon Su
 
PDF
"Service Worker: Let Your Web App Feel Like a Native "
FDConf
 
KEY
Playing With Fire - An Introduction to Node.js
Mike Hagedorn
 
PDF
Cutting Edge Data Processing with PHP & XQuery
William Candillon
 
PDF
Server Side Event Driven Programming
Kamal Hussain
 
PDF
Docker in Action
Simon Su
 
PPT
Mssql to mysql - Anton Ivanov
DrupalCamp Kyiv
 
PPT
Headless drupal + react js Oleksandr Linyvyi
DrupalCamp Kyiv
 
PPTX
OpenStreetMap is Data
mikel_maron
 
PPTX
Scalable network applications, event-driven - Node JS
Cosmin Mereuta
 
PDF
[Kotlin Serverless 工作坊] 單元 3 - 實作 JSON API
Shengyou Fan
 
PDF
Umleitung: a tiny mochiweb/CouchDB app
Lenz Gschwendtner
 
PDF
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
Jan-Christoph Küster
 
PDF
非同期javascriptの過去と未来
Taketoshi 青野健利
 
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AWS Chicago
 
Functional Web Development
FITC
 
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Codemotion
 
Event Loop in Javascript
DiptiGandhi4
 
Flask and Angular: An approach to build robust platforms
Ayush Sharma
 
«От экспериментов с инфраструктурой до внедрения в продакшен»​
FDConf
 
Google App Engine Developer - Day4
Simon Su
 
"Service Worker: Let Your Web App Feel Like a Native "
FDConf
 
Playing With Fire - An Introduction to Node.js
Mike Hagedorn
 
Cutting Edge Data Processing with PHP & XQuery
William Candillon
 
Server Side Event Driven Programming
Kamal Hussain
 
Docker in Action
Simon Su
 
Mssql to mysql - Anton Ivanov
DrupalCamp Kyiv
 
Headless drupal + react js Oleksandr Linyvyi
DrupalCamp Kyiv
 
OpenStreetMap is Data
mikel_maron
 
Scalable network applications, event-driven - Node JS
Cosmin Mereuta
 
[Kotlin Serverless 工作坊] 單元 3 - 實作 JSON API
Shengyou Fan
 
Umleitung: a tiny mochiweb/CouchDB app
Lenz Gschwendtner
 
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
Jan-Christoph Küster
 
非同期javascriptの過去と未来
Taketoshi 青野健利
 

Viewers also liked (7)

KEY
5 Tips for Writing Better JavaScript
Nael El Shawwa
 
PDF
Using Node.js for everything or what it is to write a book about it
Krasimir Tsonev
 
PDF
Developing large scale JavaScript applications
Milan Korsos
 
PDF
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
PDF
Reactjs - the good, the bad and the ugly
Krasimir Tsonev
 
PPTX
Unidirectional data flow
Denis Gorbunov
 
PDF
Modern Web Applications
Ömer Göktuğ Poyraz
 
5 Tips for Writing Better JavaScript
Nael El Shawwa
 
Using Node.js for everything or what it is to write a book about it
Krasimir Tsonev
 
Developing large scale JavaScript applications
Milan Korsos
 
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
Reactjs - the good, the bad and the ugly
Krasimir Tsonev
 
Unidirectional data flow
Denis Gorbunov
 
Modern Web Applications
Ömer Göktuğ Poyraz
 
Ad

Similar to Javascript Everywhere From Nose To Tail (20)

KEY
Practical Use of MongoDB for Node.js
async_io
 
PPTX
Intro to node and mongodb 1
Mohammad Qureshi
 
PDF
Nodejs - A quick tour (v6)
Felix Geisendörfer
 
PPTX
Node.js and MongoDB from scratch, fully explained and tested
John Culviner
 
PPTX
NodeJS
Alok Guha
 
PPT
Node js
Chirag Parmar
 
PDF
Writing RESTful web services using Node.js
FDConf
 
PDF
Nodejs - A quick tour (v5)
Felix Geisendörfer
 
PPTX
Building and Scaling Node.js Applications
Ohad Kravchick
 
PPTX
Getting Started with MongoDB and NodeJS
MongoDB
 
PPTX
Introduction to Node.js
Winston Hsieh
 
PPTX
Intro To Node.js
Chris Cowan
 
PDF
Nodejs - A quick tour (v4)
Felix Geisendörfer
 
PDF
Introduction to Node.js
Somkiat Puisungnoen
 
PDF
Intro to node.js - Ran Mizrahi (27/8/2014)
Ran Mizrahi
 
PDF
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
ZIP
From Java To Node.js
Cliffano Subagio
 
PDF
Nodejs - Should Ruby Developers Care?
Felix Geisendörfer
 
KEY
Writing robust Node.js applications
Tom Croucher
 
PDF
Node.js Introduction
Kelum Senanayake
 
Practical Use of MongoDB for Node.js
async_io
 
Intro to node and mongodb 1
Mohammad Qureshi
 
Nodejs - A quick tour (v6)
Felix Geisendörfer
 
Node.js and MongoDB from scratch, fully explained and tested
John Culviner
 
NodeJS
Alok Guha
 
Node js
Chirag Parmar
 
Writing RESTful web services using Node.js
FDConf
 
Nodejs - A quick tour (v5)
Felix Geisendörfer
 
Building and Scaling Node.js Applications
Ohad Kravchick
 
Getting Started with MongoDB and NodeJS
MongoDB
 
Introduction to Node.js
Winston Hsieh
 
Intro To Node.js
Chris Cowan
 
Nodejs - A quick tour (v4)
Felix Geisendörfer
 
Introduction to Node.js
Somkiat Puisungnoen
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Ran Mizrahi
 
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
From Java To Node.js
Cliffano Subagio
 
Nodejs - Should Ruby Developers Care?
Felix Geisendörfer
 
Writing robust Node.js applications
Tom Croucher
 
Node.js Introduction
Kelum Senanayake
 
Ad

More from Cliffano Subagio (20)

PDF
Cross-Workloads Resource-Level Relationship in AWS
Cliffano Subagio
 
PDF
AEM OpenCloud Delivery Practices
Cliffano Subagio
 
PDF
OpenAPI Generator The Babel Fish of The API World - apidays Live Paris
Cliffano Subagio
 
PDF
OpenAPI Generator The Babel Fish of The API World - apidays Live Australia
Cliffano Subagio
 
PDF
A Journey to Improve Infrastructure Compliance With InSpec
Cliffano Subagio
 
PDF
How to Fit an Infrastructure Platform into Multiple Enterprise Environments
Cliffano Subagio
 
PDF
Swagger AEM - An OpenAPI Specification for AEM
Cliffano Subagio
 
PDF
Introducing AEM OpenCloud
Cliffano Subagio
 
PDF
A Quick Look at Accessibility in the World of DevOps
Cliffano Subagio
 
PDF
Conversation With Your Application Using DialogFlow and CloudFunctions
Cliffano Subagio
 
PDF
Let's Build Voice Assistant Learning Games For Kids
Cliffano Subagio
 
PDF
Having A Talk With Jenkins
Cliffano Subagio
 
PDF
AEM Open Cloud - The First Two Years
Cliffano Subagio
 
PDF
AEM OpenCloud - What's New Since 2.0.0
Cliffano Subagio
 
PDF
Beyond AEM Curl Commands
Cliffano Subagio
 
PDF
AEM OpenCloud
Cliffano Subagio
 
PDF
Open Source AEM Platform: A Short Intro
Cliffano Subagio
 
PDF
How To Play Music On A Vacuum Cleaner
Cliffano Subagio
 
PDF
Bringing Jenkins Remote Access API To The Masses
Cliffano Subagio
 
PDF
Application Deployment Using Ansible
Cliffano Subagio
 
Cross-Workloads Resource-Level Relationship in AWS
Cliffano Subagio
 
AEM OpenCloud Delivery Practices
Cliffano Subagio
 
OpenAPI Generator The Babel Fish of The API World - apidays Live Paris
Cliffano Subagio
 
OpenAPI Generator The Babel Fish of The API World - apidays Live Australia
Cliffano Subagio
 
A Journey to Improve Infrastructure Compliance With InSpec
Cliffano Subagio
 
How to Fit an Infrastructure Platform into Multiple Enterprise Environments
Cliffano Subagio
 
Swagger AEM - An OpenAPI Specification for AEM
Cliffano Subagio
 
Introducing AEM OpenCloud
Cliffano Subagio
 
A Quick Look at Accessibility in the World of DevOps
Cliffano Subagio
 
Conversation With Your Application Using DialogFlow and CloudFunctions
Cliffano Subagio
 
Let's Build Voice Assistant Learning Games For Kids
Cliffano Subagio
 
Having A Talk With Jenkins
Cliffano Subagio
 
AEM Open Cloud - The First Two Years
Cliffano Subagio
 
AEM OpenCloud - What's New Since 2.0.0
Cliffano Subagio
 
Beyond AEM Curl Commands
Cliffano Subagio
 
AEM OpenCloud
Cliffano Subagio
 
Open Source AEM Platform: A Short Intro
Cliffano Subagio
 
How To Play Music On A Vacuum Cleaner
Cliffano Subagio
 
Bringing Jenkins Remote Access API To The Masses
Cliffano Subagio
 
Application Deployment Using Ansible
Cliffano Subagio
 

Recently uploaded (20)

PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Digital Circuits, important subject in CS
contactparinay1
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 

Javascript Everywhere From Nose To Tail

  • 1. JavaScript Everywhere From Nose To Tail Carl Husselbee - Sensis Cliffano Subagio (@cliffano) - Shine Technologies
  • 3. New Platform Improved application performance Better memory usage Improved content publishing reliability Zero content duplication Improved user experience (project is still ongoing...)
  • 5. One JavaScript To Rule Them All
  • 7. CouchDB Document oriented Schema free Design document in JavaScript Incremental replication HTTP API
  • 8. Document Simply a JSON object { "_id": "listing-123", "_rev": "D1C946B7", "business_name": "Wolfgang Puck", "desc": "Fine dining and casual dining...", "rating": 5, "city": "Melbourne" } Stays as JSON on all layers
  • 9. Replication Content publishing - replication rule curl -X POST "http://host/_replicate" -d '{"source": "db-src", "target": "db-target", "continuous": true}' -H "Content-Type: application/json" Content indexing - continuous changes feed curl -X GET "http://host/db/_changes?feed=continuous&since=123"
  • 10. Design Document A simple map reduce "views": { "melbourne_rating": { "map": function (doc) { if (doc.city === 'Melbourne') { emit(null, doc.rating); } }, "reduce": function (key, values, rereduce) { return sum(values); }}} Highly testable Easy to mock up
  • 11. Cradle CouchDB client for Node.js Uses CouchDB REST API Asynchronous Built-in caching
  • 12. Node.js Server-side JavaScript Based on V8 Single Threaded Non-blocking I/O
  • 13. Single Threaded No more thread deadlock More predictable app server memory usage Like Nginx vs Apache
  • 14. Non-blocking I/O I/O is expensive Traditional web app wastes time on I/O // blocking // non-blocking var listings = db.getListings(); var callback = function render(listings); (listings) { render(listings); } db.getListings(callback); Node.js provides non-blocking API
  • 16. Nested Callbacks var util = require(‘util’), listingId = 'listing-123'; function commentsCb(err, result) { if (err) { } else { console.log('Comments: ' + util.inspect(result)); } } function listingCb(err, result) { if (err) { } else { console.log('Listing: ' + util.inspect(result)); db.getComments(listingId, commentsCb) } } db.getListing(listingId, listingCb);
  • 17. A Better Way Use control flow module var async = require('async'), listingId = 'listing-123'; function getComments(cb) { db.getComments(listingId, cb); } function getListing(cb) { db.getListing(listingId, cb); } async.parallel({ comments: getComments, listing: getListing }, function (err, results) { // results gives { listing: listingResult, comments: commentsResult } }); Lots of other solutions: TameJS, Step, Seq, etc
  • 18. Async In A Loop This looks innocent for (var i = 0; i < 1000000; i++) { console.log('Meditate on this, you must!'); }
  • 19. Async In A Loop console.log is asynchronous Node.js is faster than terminal display
  • 20. Library Changes Within the past one year: Homegrown web framework >> Express node-couch >> Cradle Various template engines >> Jazz Promises >> Callbacks + Async
  • 21. Testing Insanely fast even on slow PC 15,000 SLOC 100% test coverage 34 seconds YUITest, JSCoverage, nodelint
  • 22. Homegrown Modules Jazz - template engine {foreach doc in widget.docs} {if (doc.type eq 'video')} <span><a href="{doc.videourl}">{doc.title}</a></span> {else} <a href="{helper.createUrl(doc.key)}"> <h3>{doc.title}</h3> </a> {end} {end} No business logic Synchronous compilation, asynchronous evalua
  • 23. More Homegrown Modules Log4js-node - logging framework Severity level and rolling log file Couchtato - CouchDB document utility tool Doesn’t require CouchDB design doc knowledge
  • 24. Continuous Integration Jenkins Node.js Plugin Nestor - Jenkins Node.js CLI
  • 25. Conclusion CouchDB rocks! Node.js rocks! JavaScript web stack rocks!
  • 27. Resources CouchDB - http://couchdb.apache.org Node.js - http://nodejs.org Jazz - http://github.com/shinetech/jazz log4js-node - http://github.com/csausdev/log4js-node Couchtato - http://github.com/cliffano/couchtato Jenkins Node.js Plugin - https://wiki.jenkins-ci.org/display/JENKINS/NodeJS +Plugin Nestor - http://github.com/cliffano/nestor
  • 28. Credits http://www.flickr.com/photos/daveaustria/2654190796/ by Dave Austria http://www.flickr.com/photos/38485387@N02/3580728177/ by flickrfavorites http://www.housecontainer.nl/blog/about-me/127-dj-yoda-from-star-wars.html http://www.miccicohan.net/blog/studio-antics-and-of-coursethe-rolling-stones/

Editor's Notes