Matt Pardee, Developer Evangelist
         @matt_pardee
           http://c9.io
What is Cloud9 IDE?
• Full-blooded IDE in the browser
•   BitBucket and Github

•   FTP

•   Deploy your apps

•   Run and debug Node.js (stepper, call
    stack, watchers, live execute)

•   Basic autocomplete and JavaScript
    validation
Building production-quality apps
          with Node.js
Making the case for Node.js

        The User
“You have to start with the
customer experience and work
backwards to the technology.”

                      - Steve Jobs
The User
• Web apps aren’t the only use for Node, but...
• Web apps have the most potential to effect change
• Why? It’s about people
• The old metric was speed
• The new metric is engagement
Engagement starts with a proper foundation



          SOCKET.IO
Node.js

Node.js is a platform for easily building fast,
scalable network applications.

Node.js uses an event-driven, non-blocking
I/O model.
A match made in /dev/heaven


SOCKET.IO     & NODE.JS
Cloud9. Powered by node.js.

• What does a user look like to Cloud9?
  •   Cloning codebases

  •   Debugging node.js apps

  •   Running “pwd”, “mkdir”, “npm”, “git”, “hg” in the CLI

  •   Deploying an application
A great user experience requires:

      non-blocking execution
                  &
   bi-directional communication
Building production-quality apps
      with Node.js, part II

           Scaling
Scaling is successful when...
the container expands, and
     it’s easy to expand
What needs to scale?


1.Infrastructure
2.Codebase
What needs to scale?


1.Infrastructure (of course)
2.Codebase
Scaling your Node.js codebase
         with Architect

http://github.com/c9/architect
Architect

• A simple yet powerful plugin system for large-scale
  node apps

• A plugin may provide one or more services
• A plugin’s services is exposed via register
• Each plugin can communicate with other plugins
Architect : A Simple Example
        1. Config.js specifies plugins & options
          module.exports = [
            { packagePath: "architect-http", port: 8080 },
            { packagePath: "architect-http-static", root:
          "www" },
            "./plugins/calculator",
            "./plugins/db",
            "./plugins/auth"
          ]


 2. Application entry point (server.js) initiates architect
        var path = require('path');
        var architect = require("architect");

        var configPath = path.join(__dirname, "config.js");
        var config = architect.loadConfig(configPath);

        architect.createApp(config, function (err, app) {});
Architect : A Simple Example
    3. Auth plugin registers its interface
    module.exports = function setup(options, imports, register) {

     // "database" was a service this plugin consumes
     var db = imports.database;

      register(null, {
        // "auth" is a service this plugin provides
        auth: {
          users: function (callback) {
            db.keys(callback);
          },
          authenticate: function (username, password, callback) {
            db.get(username, function (user) {
              if (!(user && user.password === password)) {
                return callback();
              }
              callback(user);
            });
          }
        }
      });
    };
Architect : What’s so great?
•   Plugin system creates a pool of shared resources
                                            Adds to the pool

                                            Draws from the pool

•   Plugins are reusable

•   Plugins can be either in the repo or as NPM packages

•   All your existing uses for Node are still in tact
Wrap-Up

•   Node.js is brilliant for modern web apps

•   If your most important metric is user engagement, choose node for at
    least one part of your app

•   github.com/c9/architect for your next node application

•   Check out c9.io for major updates coming at the end of the month

Building production-quality apps with Node.js

  • 1.
    Matt Pardee, DeveloperEvangelist @matt_pardee http://c9.io
  • 2.
    What is Cloud9IDE? • Full-blooded IDE in the browser • BitBucket and Github • FTP • Deploy your apps • Run and debug Node.js (stepper, call stack, watchers, live execute) • Basic autocomplete and JavaScript validation
  • 3.
  • 4.
    Making the casefor Node.js The User
  • 5.
    “You have tostart with the customer experience and work backwards to the technology.” - Steve Jobs
  • 6.
    The User • Webapps aren’t the only use for Node, but... • Web apps have the most potential to effect change • Why? It’s about people • The old metric was speed • The new metric is engagement
  • 7.
    Engagement starts witha proper foundation SOCKET.IO
  • 8.
    Node.js Node.js is aplatform for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model.
  • 9.
    A match madein /dev/heaven SOCKET.IO & NODE.JS
  • 10.
    Cloud9. Powered bynode.js. • What does a user look like to Cloud9? • Cloning codebases • Debugging node.js apps • Running “pwd”, “mkdir”, “npm”, “git”, “hg” in the CLI • Deploying an application
  • 11.
    A great userexperience requires: non-blocking execution & bi-directional communication
  • 12.
    Building production-quality apps with Node.js, part II Scaling
  • 13.
    Scaling is successfulwhen... the container expands, and it’s easy to expand
  • 14.
    What needs toscale? 1.Infrastructure 2.Codebase
  • 15.
    What needs toscale? 1.Infrastructure (of course) 2.Codebase
  • 16.
    Scaling your Node.jscodebase with Architect http://github.com/c9/architect
  • 17.
    Architect • A simpleyet powerful plugin system for large-scale node apps • A plugin may provide one or more services • A plugin’s services is exposed via register • Each plugin can communicate with other plugins
  • 18.
    Architect : ASimple Example 1. Config.js specifies plugins & options module.exports = [ { packagePath: "architect-http", port: 8080 }, { packagePath: "architect-http-static", root: "www" }, "./plugins/calculator", "./plugins/db", "./plugins/auth" ] 2. Application entry point (server.js) initiates architect var path = require('path'); var architect = require("architect"); var configPath = path.join(__dirname, "config.js"); var config = architect.loadConfig(configPath); architect.createApp(config, function (err, app) {});
  • 19.
    Architect : ASimple Example 3. Auth plugin registers its interface module.exports = function setup(options, imports, register) { // "database" was a service this plugin consumes var db = imports.database; register(null, { // "auth" is a service this plugin provides auth: { users: function (callback) { db.keys(callback); }, authenticate: function (username, password, callback) { db.get(username, function (user) { if (!(user && user.password === password)) { return callback(); } callback(user); }); } } }); };
  • 20.
    Architect : What’sso great? • Plugin system creates a pool of shared resources Adds to the pool Draws from the pool • Plugins are reusable • Plugins can be either in the repo or as NPM packages • All your existing uses for Node are still in tact
  • 21.
    Wrap-Up • Node.js is brilliant for modern web apps • If your most important metric is user engagement, choose node for at least one part of your app • github.com/c9/architect for your next node application • Check out c9.io for major updates coming at the end of the month