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

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.

Avatar for Nikita Galkin

Nikita Galkin

May 23, 2021
Tweet

More Decks by Nikita Galkin

Other Decks in Programming

Transcript

  1. 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
  2. ▰ Cloud Native, k8s, etc ▰ Google Cloud Study Jams

    ▰ Case studies ▰ Telegram channel, daily ▰ Voice chat, weekly ▰ Workshops, coming soon
  3. Day 0 activities: ▰ Requirements analysis ▰ Domain terms definition

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

    I want <goal> So that <reason> ▰ No-functional requirements
  5. 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
  6. 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?
  7. PM2

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

    Setup environments ▰ API specification ▰ Testing framework ▰ Setup CI/CD
  9. 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
  10. Codestyle: ▰ .editorconfig ▰ prettier ▰ eslint ▰ custom eslint

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

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

    ▰ Hardcoded or default config values ▰ Bootstrap without graceful shutdown
  13. Day 2 activities: ▰ Setup logging ▰ Monitoring and alerting

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

    local ▰ Use LOG_LEVEL ▰ Logging manifest ▰ Only stdout and stderr
  15. 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)
  16. Admin panel creation: ▰ Limit DB and 3rd party access

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