Matteo Figus / @matteofigus
Coding, technology, conferences
London, UK
OpenTable
Restaurant Reservations - Free • Instant • Confirmed
more than 32K restaurants worldwide
more than 16M reservations every month
more than 450K reviews per month
Europe, North and South America, Asia
millions of requests per minute
more than 50 engineers make changes every day
Deployments every 15 days
Not very resilient
Not very robust
Code consistency (one single language)
Dedicated team for infrastructure
Dedicated team for testing
Quick deployments
More (focused and effective) testing
Robustness++
Diversity on tech stacks
Static resources duplication
Markup, javascript, css duplication
Inconsistencies
Every microsite including ~150K of javascript libraries
Every microsite including ~50K of css
Enables people to create new components independently and publish them
Granular ownership
Performances
Robustness
Serve as framework for experimenting and A/B testing new ideas in the front-end
Microsites have control
$ npm install -g oc
$ mkdir demo && cd demo
$ oc init test-component jade
$ echo 'div this is my component' > test-component/template.jade
$ oc dev . 3030
$ oc preview http://localhost:3030/test-component
$ oc registry add http://oc-registry.herokuapp.com
$ oc publish /test-component
$ oc preview http://oc-registry.herokuapp.com/test-component
// template.jade
img(src=staticPath+'img/img.jpg')
// server.js
module.exports.data = function(context, cb){
cb(null, {
staticPath: context.staticPath
});
};
<html>
<body>
...
<oc-component href="http://oc-registry.com/component/1.X.X/?a=b">
</oc-component>
...
<script src="http://oc-registry.com/oc-client/client.js">
</script>
</body>
</html>
var Client = require('oc-client'),
client = new Client();
client.config = {
registries: ['http://oc-registry.com/'],
components: {'hello-world': '~1.0.0'}
};
client.renderComponent('hello-world', function(err, componentHtml){
console.log(componentHtml); // => rendered html
});
$ curl http://oc-registry.com/hello-world
{
"href": "https://oc-registry.com/hello-world",
"version": "1.0.0",
"requestVersion": "",
"html": "<div>hello John Doe</div>",
"type": "oc-component",
"renderMode": "rendered"
}
$ curl http://oc-registry.com/hello-world
-H Accept:application/vnd.oc.prerendered+json
{
"href": "https://oc-registry.com/hello-world",
"version": "1.0.0",
"requestVersion": "",
"data": {
"name": "John doe"
},
"template": {
"src": "https://s3.amazonaws.com/your-s3-bucket/components/hello-world/1.0.0/template.js",
"type": "handlebars",
"key": "cad2a9671257d5033d2abfd739b1660993021d02"
},
"type": "oc-component",
"renderMode": "pre-rendered"
}
SOA is not just about code
Test, test, test
Failure is a feature
Componentise all the web!
follow me on twitter - @matteofigus