Serverless: a backend thing that gives superpowers to frontend developers #FEC2018

Serverless: a backend thing that gives superpowers to frontend developers #FEC2018

From Frontend Conference Zürich 2018: https://frontendconf.ch/speakers/slobodan-stojanovic

2663a9ac90cc6ed420e0e1560db57782?s=128

Slobodan Stojanović

August 30, 2018
Tweet

Transcript

  1. None
  2. None
  3. None
  4. None
  5. @slobodan_

  6. @slobodan_

  7. @slobodan_

  8. @slobodan_

  9. @slobodan_

  10. @slobodan_

  11. @slobodan_

  12. @slobodan_

  13. @slobodan_

  14. @slobodan_

  15. @slobodan_ How simple static website hosting should work?

  16. @slobodan_ You should focus on your app only! And deployment

    should be simple.
  17. @slobodan_ • Fast one command deployment • Cheap • Free

    if (almost) no one is using it • Caching + Auto-scaling
  18. @slobodan_ That feature list sounds familiar!

  19. @slobodan_

  20. @slobodan_ Serverless

  21. @slobodan_ Serverless a backend thing

  22. @slobodan_ Serverless a backend thing that gives superpowers to frontend

    developers
  23. @slobodan_ Before we continue…

  24. @slobodan_ Slobodan Stojanovic CTO @ Cloud Horizon co-author of Serverless

    Applications with Node.js book AWS Serverless Hero @slobodan_ effortless-serverless.com
  25. @slobodan_ So, serverless…

  26. @slobodan_ So, serverless… Less servers?

  27. @slobodan_ So, serverless… Less servers? No servers?

  28. @slobodan_ So, serverless… Less servers? No servers? Or even more

    servers?
  29. @slobodan_ So, serverless… No one cares about servers anymore!

  30. @slobodan_ So, serverless… No one cares about servers anymore! (except

    providers, hopefully)
  31. @slobodan_ To, understand serverless, let's go a step back…

  32. @slobodan_ To, understand serverless, let's go a step back… What

    do you need to do to make your app function properly?
  33. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Make your app available (deploy it) • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code
  34. @slobodan_ What's important for your business?

  35. @slobodan_ What's important for your business? Or what's important to

    you, if you are building your app for yourself or for fun?
  36. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code
  37. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code Isn't cloud helping?
  38. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code ✔ Isn't cloud helping?
  39. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code ✔ ✔ Isn't cloud helping?
  40. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code Serverless is a next step!
  41. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code Serverless is a next step! ✔ ✔
  42. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code Serverless is a next step! ✔ ✔ ✔ ✔
  43. @slobodan_ Again, what's important for your business?

  44. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code
  45. @slobodan_ And, what do you need to take care about

    with serverless?
  46. @slobodan_ • Buy or rent a server • Install Operating

    System • Setup the server (libs, framework, etc.) • Write your code (business logic, etc.) • Deploy your code to the server • Make sure your app works (monitoring) • Manage server and software updates • Manage your app code
  47. @slobodan_

  48. @slobodan_ But, you need servers to serve the app!

  49. @slobodan_ "It is serverless the same way WIFI is wireless"

    Gojko Adzic
  50. @slobodan_ What are the benefits of serverless?

  51. @slobodan_ • Managed infrastructure, so you can focus on the

    code • Cheap • Auto-scaling and auto-failover • Per function isolation • Easy to start with (beginner friendly)
  52. @slobodan_ But the most important one is…

  53. @slobodan_ Pricing model of serverless

  54. @slobodan_ • You are paying for used, not reserved capacity

    • Pay-per-execution model • If no one is using your app, it costs you $0 + there are generous free tiers
  55. @slobodan_

  56. @slobodan_ But pricing model doesn't give superpowers

  57. @slobodan_ But pricing model doesn't give superpowers at least not

    to frontend developers
  58. @slobodan_ But pricing model doesn't give superpowers at least not

    to frontend developers
  59. @slobodan_ What is the frontend developer kryptonite?

  60. @slobodan_ What is the frontend developer kryptonite? The Myth of

    the Fullstack Developer?
  61. @slobodan_ But how does serverless help in practice?

  62. @slobodan_ But how does serverless help in practice? Is anyone

    using that at all?
  63. @slobodan_ Story time!

  64. @slobodan_

  65. @slobodan_

  66. @slobodan_ How many DevOps team members you need to be

    able to handle 250 million preprocessor API requests per month?
  67. @slobodan_ 0

  68. @slobodan_ 0 Yes, zero/null/nulla/nula…

  69. @slobodan_ • Team of mostly frontend devs + one DevOps

    • Ruby on Rails backend • Many preprocessors that needs full isolation • > 200k requests/hour in peak • Unexpected peaks (you never know when some pen will become popular)
  70. @slobodan_

  71. @slobodan_

  72. @slobodan_

  73. @slobodan_

  74. @slobodan_

  75. @slobodan_ • Lack of resources • DevOps engineer recommended serverless

    • Frontend dev wrote a SASS converter • Everything worked, so frontend team migrates other preprocessors
  76. @slobodan_

  77. @slobodan_ Results?

  78. @slobodan_ • Full isolation between services • Auto-scaling (up to

    5000 parallel requests) • Decreased infrastructure cost (250 million requests costs $1180/month) • More DevOps time for RoR part of the app • Frontend developers with superpowers
  79. @slobodan_

  80. @slobodan_ Vacation Tracker Bot vacationtracker.io

  81. @slobodan_ • Started as a small startup with one full

    time developer (+ small help) • "Fullstack" developer • Slack chatbot + API + Angular dashboard
  82. @slobodan_ To minimize initial cost and to speed up development,

    we used serverless from the beginning
  83. @slobodan_ Current state of the system

  84. @slobodan_

  85. @slobodan_ Results?

  86. @slobodan_ • Almost 100 teams using the product • Current

    infrastructure cost is $0 • Fast development cycles • Easy refactoring, because of microservices • Reusable parts for our next products
  87. @slobodan_ vacationtracker.io

  88. @slobodan_

  89. @slobodan_

  90. @slobodan_ Where to start?

  91. @slobodan_

  92. @slobodan_ A Single Page App or a static website

  93. @slobodan_ A Single Page App or a static website

  94. @slobodan_ npm install scottyjs -g

  95. @slobodan_ An Express.js application or API

  96. @slobodan_ An Express.js application or API

  97. @slobodan_ What's the benefit? Beside being easy to deploy it

  98. @slobodan_

  99. @slobodan_ bit.ly/serverless-expressjs

  100. @slobodan_ Not the best solution, because…

  101. @slobodan_ A better API

  102. @slobodan_ A better API

  103. @slobodan_ Claudia.js + Claudia API Builder claudiajs.com

  104. @slobodan_ Looks the same, but it's not!

  105. @slobodan_ Faster means cheaper! You pay per execution time, milliseconds

    matter
  106. @slobodan_ P.S. You can do server-side rendering using similar approach!

    There are also Lambda@Edge and Cloudflare workers
  107. @slobodan_ APIs are boring, GraphQL FTW! That's easy too!

  108. @slobodan_ AWS AppSync aws.amazon.com/appsync

  109. @slobodan_ • Serverless GraphQL • Preconfigured access to AWS data

    sources
 (DynamoDB, Lambda or Elastic Search) • Real-time data access and updates • Offline data synchronization • Authorizers • Minimize backend development
  110. @slobodan_ "Oh, and I only hire front-end developers at this

    point. I have been the sole DevOps/backend/ middle-tier developer in the last two companies I started, and it’s been fine." Joe Emison (@JoeEmison)
  111. @slobodan_ "With AppSync I could continue to be the CTO,

    do all the backend and middle-tier code, and support up to probably about a hundred front-end developers before I would need a dedicated backend developer." Joe Emison (@JoeEmison)
  112. @slobodan_ A file converter

  113. @slobodan_ A file converter

  114. @slobodan_ Claudia.js or AWS Serverless Application Repository serverlessrepo.aws.amazon.com/applications

  115. @slobodan_

  116. @slobodan_

  117. @slobodan_ Do we have time (and internet) for a short

    live demo?
  118. @slobodan_

  119. @slobodan_ Links to mentioned things

  120. @slobodan_ • Claudia.js - https://claudiajs.com • Scotty.js - https://github.com/stojanovic/scottyjs •

    Vacation Tracker - https://vacationtracker.io • AWS App Sync - https://aws.amazon.com/appsync/
  121. @slobodan_ Summary

  122. @slobodan_ • Serverless is easy to start with (beginner friendly)

    • No server maintenance and other boring things • Pay-per-usage model + it's cheap • You can deploy SPAs, APIs or GraphQL in minutes • It gives you superpowers!
  123. @slobodan_ One more thing!

  124. @slobodan_

  125. @slobodan_

  126. @slobodan_ Serverless Applications with Node.js Use claudia40 promo code for

    40% off effortless-serverless.com/book @slobodan_