flatiron

build the best tools and the best systems will follow

whoami

Maciej MaƂecki

nodejitsu logo

Node.js and Travis CI contributor, open source hacker. Maintainer of cradle and vows. Favorite buzzword: web scale.

Quite cool guy.

https://github.com/mmalecki

https://twitter.com/maciejmalecki

wtf is flatiron?

It's a building in New York.

No, really, Google it.

wtf is flatiron?

Also, it's a framework.

What makes it cool?

what flatiron isn't

a monolithic framework

that's right, no warm and fuzzy feeling

also, you should probably think twice before using it for your website.

projects

works on both sides works on the server-side only
platesunion
broadwaynconf
directorutile
resourcefulneuron
revalidatorprompt
winston
complete
api-easy
flatiron
... and secret sauce

objective: move as many projects from the right side to the left side.
but only if it actually makes sense.

idea: code reuse

that's fucking old!

nodejitsu can do better.

idea: ultimate code reuse

use the same code in browser and on your server like what.

plates

plates (short for templates) binds data to markup

var Plates = require('plates'),
    html = '<div id="hello"></div>',
    data = { hello: "world" };

var output = Plates.bind(html, data);
// output == "<div id="hello">world</div>"
        

plates has no special syntax

it has the same API for client and server-side

broadway

lightweight application extensibility and composition with a twist of feature reflection

app.js

var app = new App();

app.use(HelloWorld, { "delimiter": "!" } );
app.init();
app.hello("world");
        

plugins/helloworld.js

var HelloWorld = {};
HelloWorld.attach = function (options) {
  this.hello = function (world) {
    console.log("Hello "+ world + options.delimiter || ".");
  }
};
        

director

director is a router. it's awesome.

var author = function () { /* ... */ },
    books = function () { /* ... */ },
    viewBook = function(bookId) { /* bookId is populated. */ };

var routes = {
  '/author': author,
  '/books': [books, function() { /* An inline route handler. */ }],
  '/books/view/:bookId': viewBook
};

var router = Router(routes);
router.init();
        

it's also the only project with browser API different than node.js API

resourceful

a storage agnostic resource-oriented ODM

var Creature = resourceful.define('creature', function () {
  this.string('diet');
  this.bool('vertebrate');
  this.array('belly');

  this.prototype.feed = function (food) {
    this.belly.push(food);
  };
});

var wolf = new(Creature)({
  diet: 'carnivore',
  vertebrate: true,
  belly: ['squirrel']
});
        

revalidator

a validator

var result = json.validate({
  someNumber: 42,
  shortString: 'hello'
}, {
  properties: {
    someNumber: { type: 'number', required: true },
    shortString: { type: 'string', minLength: 10 }
  }
});
/* result == {
     valid: false, errors: [{
       attribute: "minLength", property: "shortString",
       expected: 10, actual: 5
     }]
   }
*/
        

secret sauce

it actually has a name

blacksmith

wtf is blacksmith?

static site generator

capable of generating:

blacksmith.jit.su

and I'll publish it right now

wow...

nodejitsu sure knows how to do releases

questions?

no, really? I have no more slides. just ask them.

thanks!

shameless self plug:
built using presents - the best presentation tool ever: https://github.com/mmalecki/presents