Skip to main content

Node

API Reference: https://nodejs.org/api

https://endoflife.date/nodejs

https://github.com/goldbergyoni/nodebestpractices

Shell scripting with Node.js (Axel Rauschmayer) - https://exploringjs.com/nodejs-shell-scripting

tip

Use the watch mode with node --watch (added in v18.11.0). For example do node --watch index.js.

Libraries

Libraries: https://nodejs.libhunt.com

HTTP clients

https://github.com/sindresorhus/got#comparison

HTTP testing

Logging

https://betterstack.com/community/guides/logging/nodejs-logging-best-practices

Email

Rate limit

See https://github.com/goldbergyoni/nodebestpractices/blob/master/sections/security/login-rate-limit.md

With Redis:

Environment variables

Version managers

https://twitter.com/Netlify/status/1496177878182121472

REPL

https://nodejs.dev/learn/how-to-use-the-nodejs-repl

Use node to start it. To exit, type .exit, or press Ctrl+C twice, or press Ctrl+D once.

You can watch files without nodemon with --watch, eg node --watch index.js.

Commands:

  • .help - list commands
  • .break or .clear
  • .editor
  • .load <filename> - load file
  • .save <filename> - save commands you've run into a file

Debug

https://nodejs.org/api/debugger.html

Write debugger where you want to stop and then run node inspect index.js.

Then:

  • n steps to the next line
  • c continues the execution. Will stop if a debugger is found
  • repl allows you to inspect variables with console.log

Performance

Clinic.js - Performance profiling suite - https://clinicjs.org - https://github.com/clinicjs/node-clinic

Detecting Node Event Loop Blockers - https://www.ashbyhq.com/blog/engineering/detecting-event-loop-blockers - https://news.ycombinator.com/item?id=30713567

https://nodejs.org/en/docs/guides/dont-block-the-event-loop/

Databases

https://blog.logrocket.com/why-you-should-avoid-orms-with-examples-in-node-js-e0baab73fa5/

https://contra.com/p/gkOQlbLq-validating-postgre-sql-query-results-using-runtime-checks

ESLint plugin: https://safeql.dev

PostgreSQL client

Query Builder

ORM

Data mapper

Generate TypeScript from SQL

Sample code repos and starters

HTTP2

https://github.com/azat-co/practicalnode/blob/master/chapter13/chapter13.md

Docker

https://github.com/azat-co/practicalnode/blob/master/chapter15/chapter15.md