Top Banner
Shubhra Kar | Products & Education twitter:@shubhrakar Frameworks or a Design Pattern ?
40
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Node.js Frameworks & Design Patterns Webinar

Shubhra Kar | Products & Education twitter:@shubhrakar

Frameworks or a Design Pattern ?

Page 2: Node.js Frameworks & Design Patterns Webinar

About me

u  J2EE and SOA architect

u  Performance architect

u  Node, mBaaS & APIs

Page 3: Node.js Frameworks & Design Patterns Webinar

These guys sent me !

Bert Belder

Ben Noordhuis

Node/io Core

Raymond Feng

Ritchie Martori

LoopBack & Express Core

Sam Roberts

Miroslav Bajtos

Ryan Graham

Page 4: Node.js Frameworks & Design Patterns Webinar

Buzzwords

Websites

Smart Mobiles

Online Catalog

Social Media

Kiosks

Computers

Physical Store

Gaming Consoles

Page 5: Node.js Frameworks & Design Patterns Webinar

No IO bottlenecks Highly Concurrent

Very Fast JIT compiled

Node.js is emerging as the answer

Reduce infrastructure by 5X Scalable

Lightweight, JS back and front, Headless Full stack

Write and maintain 50% lesser code Simple

Suited for mobile and IoT Evented & JSON

Biggest OSS community on the planet Ecosystem

Page 6: Node.js Frameworks & Design Patterns Webinar
Page 7: Node.js Frameworks & Design Patterns Webinar

Evolution is inevitable !

Thick

Web SaaS Mobile IoT

Page 8: Node.js Frameworks & Design Patterns Webinar

Frameworks evolve as well !

•  Callback •  Reactor •  Observer

•  Express •  HAPI •  Restify •  Total •  Partial

•  Loopback •  Parse •  Meteor •  Feedhenry*

•  Loopback •  Sails •  Meteor •  Geddy

•  Loopback •  NodeRED •  Proprietary

KISS MVC

MBaaS ORM/ MEAN

Micro/ loT

Page 9: Node.js Frameworks & Design Patterns Webinar

Pattern 0: Natal patterns

Philosophy: KISS (Keep It Simple Stupid) u  small core u  small modules u  small surface area

Patterns u  reactor u  callback u  module u  observer

Page 10: Node.js Frameworks & Design Patterns Webinar

Pattern 1: Convention

HTTP Server Library REST HTTP Library

Simple MVC Structure

Page 11: Node.js Frameworks & Design Patterns Webinar

Pros and Cons

Express DIY HTTP Routing, Middleware, Templating Simple Web Apps Github Stars – 19K Commercial Support - StrongLoop CLI App Generator Export API definition with strong-remoting Connect/Express middleware extensions Vast Ecosystem and low learning curve StrongLoop DevOps tooling support Manual CRUD endpoints Manual recursive refactoring/testing No Data source Support No Client SDK No ACL (Fine Authorization)

Restify DIY Simplicity, Rest Routing Simple REST API Github Stars – 3K Commercial Support - Joyent Yeoman Generator SPDY Support Dtrace Support No export of API definition No Data source Support No Extensions of significance Manual CRUD endpoints Manual recursive refactoring/testing Limited Ecosystem No ACL (Fine Authorization)

Page 12: Node.js Frameworks & Design Patterns Webinar

Router in

Express

StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  

Page 13: Node.js Frameworks & Design Patterns Webinar

Router in

Restify

StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  

Page 14: Node.js Frameworks & Design Patterns Webinar

Pattern 2: Configuration

HTTP Server Framework

Hapi Opinionated Modularity, Security, HTTP Server control Complex Web Apps, APIs Github Stars – 4K Commercial Support - None Yeoman Generator No export of API definition Hapi Plugins – Joi, bell, bassmaster, etc Limited ecosystem as compared to Express; but does support templates with plugins Swagger support for API documentation Very limited Data source support – Mongo, Postgres, leveldb No Client SDK No ACL (Fine Authorization)

Page 15: Node.js Frameworks & Design Patterns Webinar

Router in

hapi

StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  

Page 16: Node.js Frameworks & Design Patterns Webinar

Pattern 3 : Full Stack JS à lends into pattern 4

{“..”} JSON is the new first class citizen

Page 17: Node.js Frameworks & Design Patterns Webinar

Pattern 4: ORM & Isomorphic JS

u  Model Driven Development u  Any data source u  Isomorphic JS

u  Omni-Channel u  Share Models (Client/Server)

u  Loopback & Meteor u  Automatic REST API generation, routing, etc u  Common Weakness : Higher Learning Curve

Page 18: Node.js Frameworks & Design Patterns Webinar

Sails Opinionated Web MVC framework WebApps, API Rails familiarity, MVC Github Stars – 10 K (older) Commercial Support - None Yeoman Generator StrongLoop DevOps tooling support No export of API definition Limited data sources – MySQL, Mongo, Postgresql, memory/file No Extensions of significance Limited Ecosystem No ACL (Fine Authorization) No Client SDKs

Pros and Cons

Page 19: Node.js Frameworks & Design Patterns Webinar

Loopback Opinionated API framework Complex Web Apps and APIs Modularity, Scaffolding, Enterprise Connectivity Github Stars – 4 K (newer) Commercial Support - StrongLoop CLI Code Generator, Visual API composer, API explorer Export API definition Extensions like Push, File Storage, Passport, Oauth 2.0, Express Middleware Vast Connector ecosystem and extend express Auto CRUD Swagger UI and Code Generator DataSources like Mongo, mySQL, Oracle, SOAP, REST, SQLServer, Memory/File, Postgresql, Email, ATG, Couchbase, Apache Kafka, and many more Client SDK – Angular, Browser, IOS, Android, Node.js Mature ACL (Fine Authorization), API Gateway

Pros and Cons

Page 20: Node.js Frameworks & Design Patterns Webinar

Developer SDKs

ORM & Isomorphic JS – Loopback.io

JS client

JS Server

Remoting

JS client Replication

Pub Sub

Page 21: Node.js Frameworks & Design Patterns Webinar

Router & Swagger

in Loopback

StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  

Page 22: Node.js Frameworks & Design Patterns Webinar

Router  using  Sails  

Page 23: Node.js Frameworks & Design Patterns Webinar

Sub-pattern : Schema Discovery

Page 24: Node.js Frameworks & Design Patterns Webinar

mobile/web clients

social & analytics

JSON API

API XML SQL

SOAP Etc.

mBaaS

Mobile API tier

Enterprise  

Pattern 5: mBaaS

Page 25: Node.js Frameworks & Design Patterns Webinar

mBaaS could be on cloud or premises

u  Closed Source / Commercial

u  Open Source Key API u  Push Notification u  Geo Location u  Offline Sync u  Storage u  User Management u  Metering, Analytics u  Native SDK u  Isomorphic JS

Page 26: Node.js Frameworks & Design Patterns Webinar

REST API

PUSH

GEO OFF SYNC

DEVICE

USER FILE

Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)

Laptop ( not requested but useful)

Connections

Tablet Phone IoT SDK API SERVER Items for ACL

Quick Example of Use

App Server Add On

App Server

Storage

Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)

Laptop ( not requested but useful)

Connections

Tablet Phone IoT SDK API SERVER Items for ACL

Quick Example of Use

App Server Add On

App Server

REST

API GATEWAY

Channel SDKs

API ENGINE

CONNECTORs

API

SDKs

Open Source ORM, mBaaS and API framework

REST API

Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)

Laptop ( not requested but useful)

Connections

Tablet Phone IoT SDK API SERVER Items for ACL

Quick Example of Use

App Server Add On

App Server

API Explorer

Page 27: Node.js Frameworks & Design Patterns Webinar

GeoLocation in Loopback

Page 28: Node.js Frameworks & Design Patterns Webinar

Push Notification in Loopback

Page 29: Node.js Frameworks & Design Patterns Webinar

Wait …what is this API Gateway Thing then ?

Page 30: Node.js Frameworks & Design Patterns Webinar

Synchronous API “Re-Composition” is an anti-pattern

Page 31: Node.js Frameworks & Design Patterns Webinar

Security & Social Logins

Why not an node.js API Gateway pattern ? Pattern 6

API Clients API Gateway API Server

API

Page 32: Node.js Frameworks & Design Patterns Webinar

Internet of Everything

The devices are taking over !!!

Microsecond latencies are the norm

Page 33: Node.js Frameworks & Design Patterns Webinar

API “Decomposition” is the game changer

{JSON} {JSON}

{JSON}

<SOAP/XML>

<TABLE>

Web SaaS Mobile loT

HTML JSON

App Server API Server

Page 34: Node.js Frameworks & Design Patterns Webinar

Is micro services a pattern too ?

Not just infrastructure virtualization !

Page 35: Node.js Frameworks & Design Patterns Webinar

Pattern 7: Micro-services (Design Time)

Client SDK

REST Endpoints

Store Cache

API Micro Services

One URL Space

SL API PaaS REST/JSON

API Gateway

Router Remoting Model

API Orchestrator

Cloud Services

Model

Model

Connector

Connector

Connectors

Page 36: Node.js Frameworks & Design Patterns Webinar

Pattern 8: Micro-services (Run Time)

Page 37: Node.js Frameworks & Design Patterns Webinar

Now I know !!!

Page 38: Node.js Frameworks & Design Patterns Webinar

A Shameless Plug…

Page 39: Node.js Frameworks & Design Patterns Webinar
Page 40: Node.js Frameworks & Design Patterns Webinar

First there was Node

Thank you!

JUST WIN,BABY!