$30 off During Our Annual Pro Sale. View Details »

Node.js Recipes: Road to Production.

Node.js Recipes: Road to Production.

In IT, the terms Day 0/Day 1/Day 2 refer to different phases of the software development life cycle. During this talk, Nikita will show recipes for each day:

For day 0 (design and PoC) – how to choose tech stack and design API.
For day 1 (development and deploying) – how to test application, dockerize and configure.
For day 2 (maintaining and monitoring) – how to collect logs& metrics and create business reports.

Nikita Galkin

May 23, 2021
Tweet

More Decks by Nikita Galkin

Other Decks in Programming

Transcript

  1. Road to Production by Nikita Galkin May 23, 2021

  2. Nikita Galkin Love and Know: ▰ How to make developers

    and business happy ▰ Technical and process debt elimination Believe that: ▰ Any problem must be solved at the right level ▰ Software is easy. People are hard ▰ A problem should be highlighted, an idea should be "sold", a solution should be demonstrated Links: Site GitHub Twitter Facebook 2
  3. ▰ Cloud Native, k8s, etc ▰ Google Cloud Study Jams

    ▰ Case studies ▰ Telegram channel, daily ▰ Voice chat, weekly ▰ Workshops, coming soon
  4. MAIN IDEA

  5. Understand Software Development Life Cycle and know what to do

    at every phase
  6. SDLC and Day 0, 1, 2

  7. None
  8. very general and therefore useless

  9. None
  10. Day 0: Design

  11. Day 0 activities: ▰ Requirements analysis ▰ Domain terms definition

    ▰ Architecture creation ▰ Choosing a technical stack
  12. Requirements analysis: ▰ Milestones ▰ User stories: As a <persona>

    I want <goal> So that <reason> ▰ No-functional requirements
  13. Domain terms definition: ▰ Term definition starts with noun ▰

    Team knows Single Source of Truth of this definition list ▰ Used at access-control list ▰ Subset exists at API specification
  14. Architecture & Tech Stack ▰ What architecture approach use? ▰

    Is Node.js right tool? ▰ What DB and why? ▰ What protocol chose for API? ▰ How host Node.js?
  15. How host Node.js? ▰ Virtual machine ▰ Docker ▰ Kubernetes

    ▰ Serverless ▰ Cloud Native
  16. How host Node.js? ▰ Virtual machine ▰ Docker ▰ Kubernetes

    ▰ Serverless ▰ Cloud Native
  17. PM2

  18. None
  19. None
  20. Cloud Native

  21. None
  22. None
  23. Day 1: Start development

  24. Day 1 activities: ▰ package.json content ▰ Code style ▰

    Setup environments ▰ API specification ▰ Testing framework ▰ Setup CI/CD
  25. package.json content: ▰ CommonJS or ECMAScript modules ▰ How write

    code: without or with transpiling (babel or ts) ▰ What code patterns? ▰ Internal (set of packages) or open-source framework
  26. JS or TS?

  27. None
  28. Codestyle: ▰ .editorconfig ▰ prettier ▰ eslint ▰ custom eslint

    rules ▰ IDEA settings ▰ git hooks with husky and lint-staged
  29. None
  30. Setup environments: ▰ Follow 12 factor manifest ▰ DevOps Engineer

    with IoC setup environment ▰ Local env setup with docker-compose and npm install
  31. Typical 12 factor manifest mistakes: ▰ EventEmitter for business logic

    ▰ Hardcoded or default config values ▰ Bootstrap without graceful shutdown
  32. Human or/add computer readable API specification: ▰ Swagger ▰ gRPC

    ▰ GraphQL How will it evolve?
  33. Day 1: Setup CI/CD

  34. Artefact Repo

  35. None
  36. Day 2: Going life

  37. Day 2 activities: ▰ Setup logging ▰ Monitoring and alerting

    ▰ Business metrics collection and reports creation ▰ Admin panel creation
  38. Logging: ▰ Use JSON for production and human readable for

    local ▰ Use LOG_LEVEL ▰ Logging manifest ▰ Only stdout and stderr
  39. stdout stderr

  40. stdout stderr

  41. Monitoring and alerting: ▰ Node.js metrics (event-loop, http response time)

    ▰ Infrastructure state and metrics ▰ Business metrics ▰ Some services (Pingdom, GCP alerting, Pager Duty, etc)
  42. Day 2: Business metrics collection and reports creation

  43. None
  44. Day 2: Admin panel

  45. Admin panel creation: ▰ Limit DB and 3rd party access

    ▰ Integration with BI tools ▰ Specific solutions like ▻ Admin bro ▻ React Admin ▻ cube.dev
  46. MAIN IDEA

  47. Understand Software Development Life Cycle and know what to do

    at every phase
  48. QUESTIONS TIME! Waiting for you at Speakers' Corner and at

    the channel ➡