Rethinking Enterprise Architectures with Node.js

Rethinking Enterprise Architectures with Node.js

A Node.js platform is built on top of a few principles. One of these is having a small set of functionalities, leaving the rest to the developers. This rule makes the learning curve as small as possible, and in combination with the same language reduces an amount of time spent on switching between front-end and back-end side. We glorify simplicity, we praise reusability, but the question is - how to really take advantage of them? In this talk, you'll learn why NestJS could increase your productivity and how to unlock your full potential as a JavaScript/TypeScript developer.

2c6d09f60e512f388508afe9bebfcd6f?s=128

Kamil Mysliwiec

July 20, 2018
Tweet

Transcript

  1. KAMMYSLIWIEC RETHINKING ENTERPRISE ARCHITECTURES WITH NODE.JS

  2. KAMMYSLIWIEC KAMIL MYŚLIWIEC SOFTWARE ENGINEER | NESTJS CREATOR
 @KAMMYSLIWIEC


  3. KAMIL MYŚLIWIEC SOFTWARE ENGINEER
 @KAMMYSLIWIEC


  4. KAMMYSLIWIEC NODE.JS

  5. KAMMYSLIWIEC NODE.JS IS A JAVASCRIPT RUNTIME BUILT ON TOP OF

    GOOGLE CHROME'S V8 ENGINE
  6. KAMMYSLIWIEC WHY NODE.JS?

  7. KAMMYSLIWIEC LANGUAGE

  8. KAMMYSLIWIEC PRODUCTIVITY

  9. KAMMYSLIWIEC REUSABILITY

  10. KAMMYSLIWIEC COMMUNITY

  11. KAMMYSLIWIEC JAVASCRIPT JAVA PYTHON C# PHP 0% 17,5% 35% 52,5%

    70%
  12. KAMMYSLIWIEC SIMPLICITY

  13. SIMPLICITY IS 
 PREREQUISITE FOR RELIABILITY

  14. KAMMYSLIWIEC NODE.JS IS SIMPLE

  15. KAMMYSLIWIEC NODE.JS IS SIMPLE?

  16. KAMMYSLIWIEC SETUP TIME 1 MINUTE

  17. KAMMYSLIWIEC 2 LINES 
 OF CODE

  18. KAMMYSLIWIEC const app = require('express')(); app.listen(3000);

  19. KAMMYSLIWIEC const app = require('express')(); app.listen(3000);

  20. KAMMYSLIWIEC const app = require(‘express')(); app.get('/', (req, res) =>
 res.send('Hello

    world')); app.listen(3000);
  21. KAMMYSLIWIEC SIMPLICITY?

  22. KAMMYSLIWIEC COMPLEXITY LINES OF CODE y = x

  23. KAMMYSLIWIEC COMPLEXITY LINES OF CODE y = ex

  24. KAMMYSLIWIEC NODE.JS IS SIMPLE
 UP TO A CERTAIN POINT

  25. KAMMYSLIWIEC Simplicity Lines of code y = ex

  26. KAMMYSLIWIEC Simplicity Lines of code y = ex

  27. KAMMYSLIWIEC WHY?

  28. KAMMYSLIWIEC SIMPLICITY

  29. KAMMYSLIWIEC PROJECTS HEAVILY VARY BY PEOPLE’S DESIGN DECISIONS

  30. KAMMYSLIWIEC COMPLEXITY LINES OF CODE y = ex

  31. KAMMYSLIWIEC SIMPLICITY LINES OF CODE y = 1/ex

  32. KAMMYSLIWIEC SIMPLICITY LINES OF CODE y = 1/ex EXPECTED CURVE

  33. RETHINK

  34. KAMMYSLIWIEC SPLIT IT DOWN

  35. KAMMYSLIWIEC MIDDLEWARE

  36. KAMMYSLIWIEC MIDDLEWARE CLIENT REQUEST

  37. KAMMYSLIWIEC MIDDLEWARE CLIENT REQUEST MIDDLEWARE MIDDLEWARE

  38. KAMMYSLIWIEC TOO MANY RESPONSIBILITIES

  39. KAMMYSLIWIEC ERROR HANDLING ACCESS RESTRICTION VALIDATION SIDE-EFFECTS MUTATION

  40. KAMMYSLIWIEC SPLIT IT DOWN

  41. KAMMYSLIWIEC ERROR HANDLING VALIDATION ASYNC
 EFFECTS ACCESS
 RESTRICTION LOGGING MUTATION

  42. KAMMYSLIWIEC IT IS MISLEADING TO CALL THEM IN THE SAME

    WAY
  43. KAMMYSLIWIEC LOOSE COUPLING

  44. KAMMYSLIWIEC RELATIONS

  45. KAMMYSLIWIEC A B

  46. KAMMYSLIWIEC A B C

  47. KAMMYSLIWIEC DECOUPLE MODULES

  48. KAMMYSLIWIEC MODULE FACADE

  49. KAMMYSLIWIEC ORGANISE CODE 
 PER FEATURE

  50. KAMMYSLIWIEC DECOUPLE 
 TRANSFER LAYER

  51. KAMMYSLIWIEC TRANSFER
 LAYER DOMAIN 
 LAYER

  52. KAMMYSLIWIEC MULTILAYERED 
 ARCHITECTURE?

  53. KAMMYSLIWIEC CONTROLLER DATA
 ACCESS

  54. KAMMYSLIWIEC app.get(‘/organizations/:id’, (req, res) => { Organization.find({ name: 'JsCamp' },

    (err, value) => res.json(value)); });
  55. KAMMYSLIWIEC app.get(‘/organizations/:id’, (req, res) => { Organization.find({ name: 'JsCamp' },

    (err, value) => res.json(value)); });
  56. KAMMYSLIWIEC CONTROLLER DATA
 ACCESS SERVICE

  57. KAMMYSLIWIEC ENTITIES

  58. KAMMYSLIWIEC CONTROLLER DATA
 ACCESS SERVICE DOMAIN
 MODEL

  59. KAMMYSLIWIEC BE PROGRESSIVE

  60. KAMMYSLIWIEC app.get('/users', (req, res) => { usersService.findAll() .then((users) => {

    for (let user of users) { delete user.password; } return users; }) .then((users) => res.json(users)); });
  61. KAMMYSLIWIEC app.get('/users', (req, res) => { usersService.findAll() .then((users) => {

    for (let user of users) { delete user.password; } return users; }) .then((users) => res.json(users)); });
  62. KAMMYSLIWIEC app.get('/users', (req, res) => { usersService.findAll() .then((users) => {

    for (let user of users) { delete user.password; } return users; }) .then((users) => res.json(users)); });
  63. KAMMYSLIWIEC app.get('/users', (req, res) => { usersService.findAll() .then((users) => {

    for (let user of users) { delete user.password; } return users; }) .then((users) => res.json(users)); });
  64. KAMMYSLIWIEC @Get('users') async findAll() { return await this.usersService.findAll() .filter(user =>

    !user.isDisabled) .map(user => omit(user, 'password')); }
  65. KAMMYSLIWIEC @Get('users') async findAll() { return await this.usersService.findAll() .filter(user =>

    !user.isDisabled) .map(user => omit(user, 'password')); }
  66. KAMMYSLIWIEC @Get('users') async findAll() { return await this.usersService.findAll() .filter(user =>

    !user.isDisabled) .map(user => omit(user, 'password')); }
  67. KAMMYSLIWIEC TYPES

  68. KAMMYSLIWIEC TYPES ARE 
 PRICELESS

  69. KAMMYSLIWIEC TRADE-OFF?

  70. KAMMYSLIWIEC TYPESCRIPT

  71. KAMMYSLIWIEC MODULE FACADE

  72. KAMMYSLIWIEC FACADE INPUT OUTPUT

  73. KAMMYSLIWIEC LET’S DRAW 
 CONCLUSIONS

  74. KAMMYSLIWIEC CLEAN ARCHITECTURE
 
 BOILERPLATE & DESIGN SPECIFICATION
 NOT DEVELOPER-FRIENDLY

  75. KAMMYSLIWIEC NESTJS WWW.NESTJS.COM
 @NESTFRAMEWORK


  76. KAMMYSLIWIEC WHY?

  77. KAMMYSLIWIEC WE ARE NOT ANOTHER FRAMEWORK

  78. KAMMYSLIWIEC WE ARE THE OPPOSITE

  79. KAMMYSLIWIEC LOW ENTRY
 THRESHOLD

  80. KAMMYSLIWIEC FULLY-FEATURED

  81. KAMMYSLIWIEC REACTIVE

  82. KAMMYSLIWIEC COMPATIBILITY

  83. KAMMYSLIWIEC

  84. KAMMYSLIWIEC

  85. KAMMYSLIWIEC OPEN SOURCE

  86. KAMMYSLIWIEC

  87. KAMMYSLIWIEC THANK
 YOU @KAMMYSLIWIEC