Node.js Glossary — 115 definitions
- All terms defined across the guide's 29 sections, in alphabetical order.
- Tip: press Ctrl + F to search for a term on this page.
- .on() / .emit()
- on(event, callback): register a listener. emit(event, data): fire the event (all listeners are called with the data).
- .once() / .off()
- once(): listen to an event once (auto-unsubscribe). off()/removeListener(): stop listening to an event.
- .pipe()
- Connects a readable stream to a writable stream: data flows automatically from one to the other, chunk by chunk, with backpressure handling.
- "It works on my machine"
- The problem Docker solves: an app depends on its environment and may fail elsewhere; the container bundles its environment and runs identically everywhere.
- Progressive adoption
- TypeScript is learned incrementally (light then advanced typing); as a superset of JS, your JavaScript knowledge is reused — you add types on top.
- API + separate front end (SPA)
- Modern alternative: Node exposes a REST API (JSON) consumed by a separate front end (React/Vue/Angular) that handles rendering in the browser.
- REST API
- Web API architectural style: expose resources (clear URLs) manipulated via HTTP semantics, JSON responses with proper status codes.
- async/await
- Modern syntax (sugar over Promises): `await` waits for an async operation without blocking; async code reads like sync. Errors via try/catch.
- Non-blocking asynchronous
- Model where slow operations (files, network, DB) don't block the program: Node registers a callback and moves on while waiting.
- Async vs sync (fs)
- Async (non-blocking) is preferred on the server to avoid blocking the event loop; sync (Sync) is reserved for startup scripts/config.
- Authentication vs authorization
- Authentication: WHO is the user (401 if not authenticated). Authorization: does they have the RIGHT to do this action (403 if not authorized).
- Database / persistence
- System that stores data durably (users, products…). Two families: NoSQL (MongoDB) and SQL/relational (section 3.4).
- Benefits of Docker
- Reproducibility (identical everywhere), isolation (no conflicts), portability (any Docker host), easy deployment, fast onboarding (docker compose up).
- Benefits of TypeScript
- Catches errors at compile time, superior autocomplete/tooling, implicit documentation (types describe), robustness and maintainability on large projects.
- Benefits of tests
- Confidence (code does what it should), regression safety (catch what a change breaks), documentation (expected behavior), better design (testable code = better structured).
- REST best practices
- Consistent plural URLs, correct methods/status codes, clean error handling, pagination, versioning (/api/v1/), structured JSON response.
- Event loop
- Central mechanism orchestrating execution: it runs slow operations in the background and calls functions back when results arrive.
- Buffer
- Raw byte memory area for handling binary data (files, network) that JavaScript doesn't have natively; streams often carry Buffers.
- Callback
- Function passed as argument, called when an async operation completes. Node "error-first" convention: first argument = error (null if OK), then result.
- Callback hell
- Unreadable nesting of callbacks when chaining dependent async operations; the problem Promises and async/await solve.
- What Express simplifies
- The native server handles everything by hand (if-based routing, body parsing, headers); Express provides routing, parsing, middlewares — but rests on the http module.
- Module path
- Local: starts with ./ or ../ (project files). Bare name: native module (fs) or npm package from node_modules (express).
- CI/CD (GitHub Actions)
- Automating the path from code to production: CI (on each push, test/verify), CD (deploy automatically if checks pass). GitHub Actions creates these pipelines.
- Clustering
- Running several instances of the app (one per core, via cluster module or PM2) that share requests; uses all cores (Node being single-threaded).
- CommonJS (CJS)
- Node's historical module system: export with `module.exports`, import with `require()`. Synchronous, simple, ubiquitous in npm ecosystem.
- Compilation (tsc) / tsconfig
- TS doesn't run directly: the compiler (tsc) checks and transforms .ts into .js. Configured via tsconfig.json; ts-node runs TS directly in dev.
- console.log()
- Function to print to the terminal (like "print"); basic tool to inspect values, debug and trace execution.
- const / let (vs var)
- const: non-reassignable constant (prefer). let: reassignable variable. Both block-scoped. `var` should be avoided (confusing scope).
- CRUD
- The four basic operations: Create, Read, Update, Delete; in Mongoose, async methods (await).
- dependencies vs devDependencies / node_modules
- dependencies: needed in production. devDependencies: dev-only (-D). node_modules: folder of installed packages (not versioned, regeneratable).
- Deployment
- Running the app on a server accessible on the Internet (instead of localhost); via a PaaS platform (simple) or VPS/cloud (more control and responsibility).
- Destructuring
- Extracting values from objects/arrays in one line: `const { name } = obj;` or `const [a, b] = arr;`. Ubiquitous (imports, data).
- Docker / containerization
- Tool that packages an app WITH its entire environment (Node, dependencies, config) into an isolated, portable container that runs identically everywhere.
- Docker Compose
- docker-compose.yml file defining several containers (Node app + DB + cache…) and their relations, launched together (docker compose up); describes the whole stack.
- emit / on / broadcast
- emit(event, data): send. on(event, callback): receive. The server emits to one client, to ALL (io.emit, broadcast), or to groups (rooms).
- Expected vs unexpected errors
- Expected: resource not found (404), validation failed (400) — handled explicitly. Unexpected: bugs (500). Also: handle async errors (try/catch around await).
- error-first / try-catch
- Error handling: error as first callback argument; .catch() for Promises; try/catch around await.
- ES Modules (ESM)
- Standard language module system: export with `export`, import with `import`. The future direction; enabled via .mjs or "type":"module" in package.json.
- Production essentials
- Environment variables (config + secrets, never in code/Git), HTTPS (encryption), logs and monitoring (observe), separate environments (dev/staging/prod).
- error event
- Special event: an emitter that emits 'error' without a listener crashes the program — always listen for errors.
- EventEmitter
- Native class (events module) at the heart of Node's event-driven model; many native objects (HTTP server, streams…) inherit from it.
- Running a file
- The main way to work: write code in a .js file and run it with `node file.js` (Node executes the whole file).
- Express
- Reference web framework for Node (minimalist, flexible), built on the http module; simplifies routing, parsing and request handling. Foundation of most Node apps.
- express.Router()
- Tool that groups routes by resource in separate files (users router, products…) mounted on the app; organizes a growing API.
- Static files
- Fixed resources delivered to the browser (CSS, images, client JS, fonts); served simply with the express.static('public') middleware.
- Arrow function
- Concise syntax `(a) => ...` for writing functions, widely used for callbacks; without its own `this` (avoids pitfalls).
- fs (file system)
- Module for reading/writing files and folders; available as async (preferred, fs.promises + await) or sync (Sync, blocking).
- Centralized error handling
- Special Express middleware (err, req, res, next) placed last, that receives errors and returns a consistent response (correct code, clear message, no sensitive leak).
- Node globals vs browser
- Node has NO window/document/DOM (no web page); it provides process, __dirname, __filename, global and system access.
- Password hashing (bcrypt)
- Never store a password in plain text, but its one-way hash (bcrypt, with salt, intentionally slow). On login, compare without decrypting.
- http (native module)
- Module to create a web server with no dependency: http.createServer() with a function called on each request, then .listen(port).
- I/O-intensive vs CPU-intensive
- Node excels at I/O tasks (servers, APIs, real-time); it is less suited to prolonged heavy computations (single-threaded).
- Image / Dockerfile / container
- Image: frozen template of the app + environment, defined by a Dockerfile (build recipe). Container: running instance of an image.
- SQL injection
- Critical flaw: NEVER concatenate user data into a SQL query; use parameterized queries (ORMs protect automatically).
- JWT (JSON Web Token)
- Cryptographically signed token issued after login, sent by the client on each request (Authorization header) and verified by the server; stateless, popular for APIs.
- LTS vs Current
- LTS (Long Term Support, even versions): stable and long-maintained, preferred. Current (odd): newer but less stable, for testing novelties.
- map / filter / reduce
- Modern array methods to transform, filter and aggregate collections functionally; the modern way to process data.
- HTTP methods & status codes
- Methods: GET (read), POST (create), PUT/PATCH (update), DELETE (delete). Codes: 200 OK, 201 Created, 400/401/404 (client errors), 500 (server error).
- Middleware
- Function (req, res, next) running during request processing; can inspect/modify, run code, then next() to pass on. THE key Express concept.
- Caching (Redis)
- Storing expensive results in memory (or Redis) for frequent queries/computations to avoid recomputing; often the most impactful performance lever.
- Module
- Separate file with a single responsibility, exporting what it makes available and importing what it needs; basis of code organization.
- Built-in modules
- Libraries integrated into Node (no install), giving system access: fs, path, os, http, crypto, events, stream… Imported by name.
- MongoDB (document NoSQL)
- Database storing DOCUMENTS (JSON/BSON-like structures) grouped in COLLECTIONS, without rigid schema; close to JS objects, popular with Node.
- Mongoose (ODM)
- Object Document Mapper adding a handy layer on MongoDB: schemas (structure + validation), models (manipulation methods).
- Template engine (views)
- Tool that generates dynamic HTML from templates (HTML + logic: variables, loops, conditions) and data; EJS, Handlebars, Pug…
- V8 engine
- Google Chrome's JavaScript engine (written in C++) that compiles and runs JS very quickly; the core of Node.js.
- MVC / separation of concerns
- Models (data), Controllers (processing logic), Routes (URLs delegating to controllers); separates concerns for maintainable, evolvable code.
- Node + npm
- Installing Node brings both the Node executable (which runs your scripts) AND npm (the package manager), installed together.
- Node.js
- Runtime that lets you run JavaScript outside the browser (server-side), based on the V8 engine plus a system-access library.
- npm & registry
- Node's package manager, giving access to the world's largest open-source registry (hundreds of thousands of reusable libraries).
- nvm (Node Version Manager)
- Tool to install several Node versions and switch between them; valuable when projects require different versions.
- ORM (Prisma, Sequelize)
- Object-Relational Mapper mapping tables to JS objects and generating SQL; manipulate objects/methods rather than raw SQL (readable, safe, productive).
- os
- Module for system info: platform, CPUs (os.cpus), memory, standard folders (homedir, tmpdir).
- PaaS (Render, Railway…)
- Platforms simplifying deployment: connect your Git repo, they build, run, manage server/HTTPS/scaling; often free tier. Ideal to start.
- package-lock.json
- File locking the EXACT installed versions; ensures everyone installs the same versions (reproducibility).
- package.json
- Project manifest: name, version, dependencies, scripts, metadata. Created with `npm init`; reference point of any Node project.
- path
- Portable path manipulation module (path.join, resolve, basename, extname…): handles separator differences between OSes (/ vs \).).
- Middleware pipeline
- Chain of functions each request traverses; routing, parsing (express.json), auth, error handling are all middlewares (app.use or per route).
- Prisma (modern)
- Popular ORM: declarative schema (schema.prisma), migrations (version schema), generated and TYPED client (autocomplete, type safety — excellent with TypeScript).
- process
- Global Node object giving access to the process: arguments (process.argv), env variables (process.env), exit (process.exit()).
- Profiling / measure before optimizing
- Identify real bottlenecks by measuring before optimizing (golden rule); avoid blind or premature optimization.
- Event-driven programming
- Model where objects emit events and other parts of code react by listening; decoupling via event name.
- Promise
- Object representing a future value (result of an async operation). Three states: pending, fulfilled (success), rejected (error). Handled via .then() and .catch().
- When to use streams
- Whenever handling large volumes (big files, uploads/downloads, network flows); for small files, classic readFile is enough.
- REPL
- Interactive environment opened by typing `node` alone: reads/evaluates/prints JavaScript line by line. Great for experimenting without creating a file.
- req (request)
- Incoming request object: method (req.method: GET/POST…), path (req.url), headers (req.headers), and body (read as stream for POST).
- Enriched req / res
- req: req.params (route), req.query (query string), req.body (body). res: res.json(data), res.status(201).json(...), res.send, res.redirect.
- require vs import
- require() (CommonJS) and import (ESM) are the two import syntaxes; understand both because both coexist in real code.
- res (response)
- Response-building object: status (res.statusCode), headers (res.setHeader), body (res.write/res.end).
- res.render()
- Express method rendering a view: res.render('page', { data }) generates HTML by injecting data into the template (views/ folder).
- HTTP resources & methods
- GET /users (list), GET /users/:id (read one), POST /users (create), PUT/PATCH /users/:id (update), DELETE /users/:id (delete) — consistent conventions.
- Rooms
- Groups of clients (a chat room, a game) to which you broadcast selectively; organize real-time communication.
- Routing
- Mapping URL + HTTP method to handlers: app.get('/users', ...), app.post(...), etc. Dynamic route params: '/users/:id' → req.params.id.
- Horizontal scaling / load balancer
- Distributing load across several servers/instances behind a load balancer; to serve very many users (favours stateless apps).
- Schema & model
- Schema defines document structure (types, validations: required, unique, defaults); model, created from schema, provides manipulation methods.
- Cross-cutting security
- Helmet (security headers), HTTPS, secrets in env variables (never in code), rate limiting, validation — and "never trust inputs".
- semver & npm scripts
- Versioning MAJOR.MINOR.PATCH (^ / ~ control accepted updates). npm scripts define reusable commands (npm run <name>).
- Session vs JWT
- Session: server-side state + ID cookie. JWT: self-contained token with no server storage. Two ways to keep authentication (HTTP being stateless).
- Socket.IO
- Reference library for real-time in Node: event-based (emit/on), with auto-reconnect, fallbacks, rooms and namespaces.
- SQL (language)
- Structured Query Language: SELECT (read), INSERT (create), UPDATE (modify), DELETE (delete), JOIN (combine related tables).
- SQL / relational
- Databases organizing data in tables (typed columns), rows and relations via foreign keys; PostgreSQL, MySQL. Strong guarantees (strict schema, ACID transactions).
- SSR (Server-Side Rendering)
- The server generates the complete HTML and sends it to the browser; approach of classic sites (content, SEO).
- Stream
- Processing data chunk by chunk, as it arrives, rather than loading everything into memory; efficient for large volumes (memory and time).
- Template literal
- String with backticks allowing variable insertion: `Hello ${name}` — cleaner than + concatenation.
- Real-time
- Situations where the server sends data to the client without it asking, instantly (chat, notifications, live data, games); unsuited to HTTP request-response.
- Terminal / PATH
- Console where you run node and npm; `node -v` and `npm -v` verify installation (if they respond, Node is in the PATH).
- Automated tests (Jest)
- Code that tests your code: unit (single isolated function), integration (several parts/a route with its DB), end-to-end. Jest is the popular framework.
- Static vs dynamic typing
- Static (TS): types declared and checked BEFORE execution (at compile) — catches errors early. Dynamic (JS): types checked only at runtime (flexible but runtime bugs).
- Stream types
- Readable (read), Writable (write), Duplex (both, e.g. socket), Transform (transforms on the fly: compression, encryption).
- TypeScript
- Superset of JavaScript adding static typing (every valid JS is valid TS); compiles to plain JavaScript that Node runs.
- Input validation
- Checking that data received from a client matches the expected format (required fields, types, constraints) BEFORE processing; reject with 400 if invalid. Libraries: Zod, Joi.
- VPS
- Rented virtual server you administer yourself (Node, config, security, PM2, Nginx, HTTPS); more control and flexibility, but more responsibilities.
- VS Code
- Standard editor for Node/JavaScript: free, built-in JS support, integrated terminal, extensions (ESLint, Prettier) for code quality and formatting.
- WebSocket
- Protocol establishing a PERSISTENT, BIDIRECTIONAL connection: it stays open, and client and server send messages to each other at any time, both ways.
- Worker threads
- Separate threads to run CPU-intensive tasks (heavy computations) without blocking the main thread / event loop.