Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Why Loopback rocks?

Jeremy Lu
November 19, 2014

Why Loopback rocks?

This is the talk I gave on Nov. 19, 2014 at Taipei Javascript Enthusiasts (http://goo.gl/KSz7Ic), which covers the main benefits of using loopback for node.js-based API development.

Jeremy Lu

November 19, 2014
Tweet

More Decks by Jeremy Lu

Other Decks in Technology

Transcript

  1. Why Loopback Rocks?

    View Slide

  2. Jeremy Lu
    @thecat | [email protected]
    Founder and builder,
    Lovelyreader | Pubulous | Visualmarks | Docknote

    View Slide

  3. Developer

    10+ years hands-on
    experience"
    !

    View Slide

  4. Consulting"
    Social Media"
    Finance"
    Real Estate"
    Digital Publishing"

    View Slide

  5. Founder"
    Lovelyreader"
    Pubulous"
    Visualmarks"
    Docknote"

    View Slide

  6. !
    FullstackRocks.com
    LATEST

    View Slide

  7. What is Loopback?
    - An open source project from StrongLoop"
    - Main contributor behind Node.js, Express and
    others"
    - A Node.js framework for creating APIs real
    quick"
    - With robust and well-thought out features
    built-in

    View Slide

  8. It’s good for?
    - API service and gateway"
    - Mobile backend and hybrid apps"
    - Web (sites and SPAs)"
    - Anything real-time

    View Slide

  9. What’s in the box?
    - A development framework"
    - A bunch of DevOP toolsets"
    - and a lot of wisdom packed in

    View Slide

  10. The Framework

    View Slide

  11. Create API endpoints quickly
    - Create schema in JSON and translate it to Model
    automagically"
    - Each model comes in with 10+ CRUD methods"
    - Methods become end points instantly

    View Slide

  12. {"
    "name": "user","
    "base": "PersistedModel","
    "trackChanges": true,"
    "properties": {"
    "id": {"
    "id": true,"
    "type": "string""
    },"
    "title": "string","
    "completed": {"
    "type": "boolean","
    "default": false"
    },"
    "created": {"
    "type": "number""

    View Slide

  13. Highly customizable domain Models
    - before/after hook for implementing business
    logics"
    - Create new remote methods for end points
    easily

    View Slide

  14. ORM
    - Mongodb, MySql, Postgres, MSSQL, Oracle"
    !
    - and a bunch of other DataSources"
    !
    - Forked from JugglingDb"
    !
    - Easy to use APIs and very efficient"
    !
    - Highly customizable"
    " " "
    - Support all kinds of relationships: hasMany, belongsTo...

    View Slide

  15. Cloud Storages
    - Uploading files to S3"
    - Amazon, Openstack, Rackspace, Azure"
    - Just like a normal dataSource which provides
    create/read/update/delete commands"

    View Slide

  16. Built-in API Explorer
    - Test APIs on the fly"
    - Adjustable parameters"
    * http://goo.gl/nmj0u0

    View Slide

  17. View Slide

  18. Authentication
    - Built-in User model provides register, login,
    logout, forgot password and reset"
    - Complete ACL rules setting

    View Slide

  19. Role-based access control
    - Who has right to access what?"
    - Support dynamic $role definition too

    View Slide

  20. oAuth2
    - Using Passport"
    - facebook/google/twitter/github "
    - and 100+ providers"
    * http://goo.gl/bmHMxO

    View Slide

  21. Sync
    - Stores data offline"
    - App continues to work offline"
    - Sync data when online"
    - Conflict resolution and 3-way merging"
    - Supports socket.io for real-time syncing"
    * http://goo.gl/plVBhr

    View Slide

  22. Studio API Composer
    - Editing models and datasources"
    - Generate models from db schemas"
    - Generate db schemas from models"
    * http://goo.gl/jODKSJ

    View Slide

  23. View Slide

  24. Push Notification
    - Support iOS and Android"
    * http://goo.gl/9zRZZ6

    View Slide

  25. Web Socket
    - Coming feature"
    - Real time notification when model changes

    View Slide

  26. Native SDK for iOS/Android/Angular
    * http://goo.gl/OW2TBf

    View Slide

  27. Leverage Express
    - Continue to use all middlewares"
    - Reuse your existing skills"
    - Build hybrid website and API end points in one"
    - Could use Reactjs as server-side templating
    engine (via express)

    View Slide

  28. DevOP Tools

    View Slide

  29. In the box
    - Debugger"
    - Build/Package"
    - Deploy"
    - Logging"
    - Monitoring"
    - Clustering

    View Slide

  30. Debugger
    - slc debug" "
    - Using node-inspector

    View Slide

  31. View Slide

  32. Build/Package
    - A standard way of packaging and building your
    apps"
    * http://goo.gl/5ghCIv

    View Slide

  33. Deploy
    - StrongLoop Process Manager (slc-pm)"
    - Works tightly with build/deploy tools"
    - Provides zero-downtime application updates" " "
    * http://goo.gl/aUeTp3"
    - Deployment best practices"
    * http://goo.gl/O1MDha

    View Slide

  34. Logging
    - Log to file, syslog, remote log, Splunk"
    - Using Winston or Bunyan"
    * http://goo.gl/aPlim9

    View Slide

  35. Clustering
    - Fully utilize all cores on the server"
    - View cluster status anytime"
    - Resizing clusters at runtime"
    * http://goo.gl/lF3ZKg

    View Slide

  36. Monitoring
    - Collecting metrics"
    - Diagnose memory leaks"
    - Profile CPU consumption"
    - With web UI"
    - On-premises or hosted"
    * http://goo.gl/7F3miH

    View Slide

  37. Other Benefits

    View Slide

  38. No Vendor Lock-in
    - Everything is open sourced"
    - Host on your own server

    View Slide

  39. Paid commerical support
    - When shit hits the fan, you know whom to ask
    help for"
    * http://goo.gl/ldeCDF

    View Slide

  40. Active response and community
    - google groups"
    * http://goo.gl/FEqhTL)"
    - github issues"
    * http://goo.gl/dXAUcM)

    View Slide

  41. The Bad

    View Slide

  42. - Still evolving very fast hence incomplete
    documentation and changing examples"
    - Took one month to get my ahead around it initially "
    - With professional guidance it shall take just 1 week
    to pick up

    View Slide

  43. When to use what?

    View Slide

  44. For quick and simple tasks
    - Koa and misc. middlewares"
    - You gotta know what you are doing when home
    brewing the whole stack though

    View Slide

  45. For Enterprise-grade API services
    and platform
    - Loopback"
    - Because it’s well thought out and got all ends
    covered

    View Slide

  46. For EC/Forum site
    - Express or Loopback"
    - Because it’s battle-tested

    View Slide

  47. Do not reinvent the
    wheels, especially
    flaky ones!

    View Slide

  48. Side Notes

    View Slide

  49. Learn from the best
    - Excellent coding skills for node.js development"
    - Lot of test cases"
    - Learn best practices for build/package/deploy/
    cluster/monitor node.js apps

    View Slide

  50. Stand on the shoulders
    of giants and get yourself
    a head start!

    View Slide

  51. The Holy Grail
    - The holy grail of fullstack development"
    - React + Flux for front-end apps"
    - Node.js and Loopback for backends"
    - Isomorphic javascript FTW"
    - Highly efficiency, shorter time to market, robust
    quality

    View Slide

  52. Loopback is way more than just a framework
    to help you build the application, it also
    provides a rich set of tools to help you debug,
    build, package, deploy, cluster and monitor
    the app.

    View Slide

  53. In short, you are fully covered.

    View Slide

  54. Professional training on
    fullstack development at
    fullstackrocks.com

    View Slide

  55. [email protected]
    Questions?

    View Slide