TodayTools

Node.js flashcards

JavaScript on the server, files and the network.

Donate
Beginner friendly, starts from zero
Section
How to study
0
Node.jsStart from zero · 1 of 12

What is Node.js, in one plain sentence?

Node.js is a program that lets you run JavaScript on your own computer or on a , not only inside a web page.

JavaScript, let out of the browser.

All topics

Node.js at a glance

Node.js lets you run JavaScript on your computer or a server, not only inside a web page.

JavaScript is a cook; Node gives him his own kitchen where the fridge (files) and phone (network) are unlocked.

Words you will meet

Server
A computer that waits for requests and answers them
Terminal
A text window where you type commands
Module
A JavaScript file that shares code with other files
Package
Ready-made code someone shared for you to install
npm
The tool that downloads and manages packages
Async
Start a slow job and carry on without waiting
Event loop
The part of Node that picks up each finished job
LTS
A Node version that gets fixes for a long time

The steps

  1. 1. Start from zero (12 cards): What Node is, the words you need, and your first script in the terminal.
  2. 2. Core basics (16 cards): Running files, modules, npm, files, env vars and the built-in tools you get for free.
  3. 3. Next steps (16 cards): The event loop, HTTP, streams, errors, testing and dependency hygiene.
  4. 4. Go deeper (16 cards): libuv internals, threads, backpressure, observability, security and production operations.
All 12 cards in Start from zero
What is Node.js, in one plain sentence?
Node.js is a program that lets you run JavaScript on your own computer or on a server, not only inside a web page.
Before Node, what was the problem for web builders?
JavaScript only ran inside browsers, so the code behind a website, which stores accounts and sends pages, had to be written in a different language. Node let one language do both sides.
Where might you already meet Node in daily life?
Many online shops, chat apps and streaming sites answer your clicks with Node running on their servers. Many coding tools that developers use every day also run on Node.
What everyday picture fits Node best?
JavaScript is a cook. A browser is a restaurant kitchen with locked cupboards, for safety. Node gives the same cook his own kitchen, with the fridge (your files) and the phone (the network) unlocked.
What do 'browser', 'server' and 'program' mean?
A browser is the app you open websites in, like Chrome. A server is a computer that waits for requests and answers them, like sending a web page. A program is a set of instructions a computer runs.
What are a 'terminal' and a 'command'?
A terminal is a text window where you type commands instead of clicking. A command like node -v tells the computer to run a program; this one prints which Node version you have, such as v24.11.0.
What do 'module', 'import' and 'export' mean?
A module is one JavaScript file that shares some of its code. export marks what it shares, and import pulls it into another file. Node also has built-in modules, like node:fs for files.
What are a 'package', 'npm' and package.json?
A package is ready-made code someone shared, like a date formatter. npm is the tool and online store that downloads packages into a node_modules folder. package.json lists your project's name, packages and scripts.
What do 'blocking', 'async', 'await' and 'event loop' mean?
Reading a file or calling a website takes time. Blocking code makes everything wait; async code starts the job and moves on, and await waits for its result without freezing the rest. The event loop is the part of Node that picks up each finished job.
What do you need before starting this topic?
A computer with Windows, macOS or Linux, a text editor, and Node installed from its official site; pick the LTS (long-term support) version. Knowing basic JavaScript helps a lot.
Your first tiny win: what happens when you run this file?
Save it as hello.js, then type node hello.js in the terminal. console.log prints a line, so you see the greeting with no browser at all.
What will you be able to do after this topic?
Run scripts, read and write files, call web APIs, build a small web server, and use packages safely, with a clear picture of how Node handles many jobs at once.
Node.js cheatsheet

Run flags

  • node --watch server.js Restart on file change
  • node --env-file=.env app.js Load env vars from a file
  • node app.ts Run TypeScript (types stripped)
  • node --test --watch Run tests on change
  • node --inspect-brk app.js Debugger, paused on line 1
  • node --cpu-prof app.js Write a CPU profile
  • node --max-old-space-size=3072 Heap limit in MB
  • node --permission --allow-fs-read=. Restrict file and process access
  • node --run build Run a package.json script, fast

npm

  • npm ci Clean, exact install from lock file
  • npm ci --omit=dev Production install
  • npm i -D vitest Add a dev dependency
  • npm ls react Why is this version installed
  • npm outdated List available updates
  • npm audit --omit=dev Known vulnerabilities in runtime deps
  • npm pkg set scripts.lint="eslint ." Edit package.json from the shell
  • npm exec -- tsc --noEmit Run a local binary

Core modules

  • node:fs/promises readFile, writeFile, mkdir, watch
  • node:stream/promises pipeline with cleanup
  • node:path join, resolve, extname
  • node:crypto randomUUID, createHmac, timingSafeEqual
  • node:worker_threads CPU work off the main thread
  • node:child_process spawn, execFile
  • node:async_hooks AsyncLocalStorage
  • node:util parseArgs, styleText, promisify
  • node:sqlite Built-in SQLite (experimental)

Event loop order

  • sync code Runs to completion first
  • process.nextTick(fn) Before promises, same turn
  • queueMicrotask(fn) / .then Microtasks, same turn
  • setTimeout(fn, 0) Timers phase, next turn
  • I/O callbacks Poll phase
  • setImmediate(fn) Check phase, right after poll

Production globals

  • AbortSignal.timeout(5000) Cancel after 5 s
  • AbortSignal.any([a, b]) Cancel on either signal
  • structuredClone(order) Deep copy
  • import.meta.dirname Folder of this module
  • process.loadEnvFile() Load .env in code
  • process.memoryUsage() rss, heapUsed, external
  • process.on("SIGTERM", fn) Graceful shutdown hook
Donate