DEVELOPING
REAL-LIFE, REAL-TIME MICROSERVICES APPS

WITH NODE.JS

Armagan Amcalar

FullStackJS Berlin Summer Special 2016 Meetup
Aug 24th, 2016

Who am I?

Armagan Amcalar
Head of Software Engineering @ unu GmbH
Founder @ Lonca Works

        dashersw            dashersw

AUTHORED ON GITHUB

Outline

Requirements of a modern application

How to design (split an app into) microservices

Pitfalls of microservices

A real-life, real-time application demo

Requirements

Real-time communication. Live-update & sync to web apps is like a logo to a webpage nowadays

Ease-of-use (developer UX)

Scalability

Performance

Flexibility in choices (no vendor lock-in)

Reduce number of technological complexities

Meteor?

Perfect sync, demos work like a charm

Monolith

Doesn't scale

MongoDB-only

Designing Microservices

Bounded contexts in domain driven design (at worst)

Preferably many smaller pieces

Scaling concerns

Single responsibility, API interface

Organization of development teams

Iteration model

Pitfalls

Wrong domain model

Error handling & circuit breaking

Fault-tolerance

Monitoring

Multiple points of failure

Hard to get the big picture

 

Enter cote.js

Zero-configuration

Scalable, distributed applications

Fault-tolerant

cote.js Features

Auto-discovery
Mesh network, peer-to-peer communication
Pubsub pattern
Requester/responder pattern
Client-side communication with Websockets
Load balancing with different strategies
Daemon monitor

Your first microservice

var cote = require('cote');
var timeService = new cote.Responder({name: 'Time Service'});

timeService.on('time', (req, cb) => {
    cb(new Date());
});
var cote = require('cote');
var client = new cote.Requester({name: 'Client'});

client.on('ready', () => {
    client.send({type: 'time'}, (time) => {
        console.log(time);
    });
});
time-service.js
client.js

Demo time!

source code available at: 

https://github.com/dashersw/cote-workshop

thank you!

Join cote.js community

Let's keep in touch!

Armagan Amcalar

armagan@amcalar.com
twitter: @dashersw
github: dashersw

Developing Real-Life, Real-Time Microservices Apps with Node.js

By Armağan Amcalar

Developing Real-Life, Real-Time Microservices Apps with Node.js

In this talk, Armagan will demo an e-commerce application built with microservices in Node.js, using an open-source Node.js library called cote.

  • 2,885