Interview Q&A · questions with model answers

Node.js Developer Interview Questions

Part of the study plan for: Full Stack Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Most asked What is the difference between `process.nextTick`, Promise microtasks, `setImmediate` and `setTimeout(fn, 0)`?

    process.nextTick callbacks run immediately after the current operation, before Promise microtasks; Promise callbacks (then, await continuations) run next; setImmediate runs in the check phase of the…

  2. Most asked When do you use `Promise.all`, `Promise.allSettled`, `Promise.race` and `Promise.any`?

    all waits for every promise and rejects on the first failure; allSettled waits for all and reports each outcome; race settles with the first settled promise (fulfilled or rejected); any fulfills…

  3. Most asked Compare `worker_threads`, `cluster` and `child_process`.

    worker_threads run JavaScript in parallel threads within one process (with message passing and optional shared memory), good for CPU-bound tasks. cluster forks multiple processes sharing a server…

  4. Compare Express, Fastify, NestJS and Hono.

    Express is minimal and ubiquitous with a huge middleware ecosystem; Fastify is performance-focused with JSON schema validation, serialization and a plugin system; NestJS is an opinionated,…

  5. Compare npm, pnpm and Yarn, and explain lockfiles.

    All three install packages from the npm registry. pnpm uses a content-addressable store with symlinks (fast, disk-efficient, strict about undeclared dependencies); Yarn Berry offers Plug'n'Play; npm…

  6. How do Prisma, Drizzle and Kysely differ?

    Prisma uses its own schema language, generates a typed client and handles migrations, which makes it very productive. Drizzle defines schemas in TypeScript with a SQL-like, lightweight query API.…

  7. What's the difference between `exec`, `execFile` and `spawn`, and what's the security concern?

    exec runs a command in a shell and buffers output; execFile runs a binary directly with an argument array (no shell); spawn streams output and also avoids the shell by default. Passing user input to…

  8. Which `node:crypto` APIs should you use for common tasks?

    Use randomUUID()/randomBytes() for IDs and tokens, scrypt (or argon2/bcrypt libraries) for password hashing, createHash('sha256') for checksums, createHmac for signatures, timingSafeEqual for…

  9. Which modern built-in Node.js features reduce the need for third-party tools?

    Built-in fetch, the test runner (node --test), watch mode (--watch), .env loading (--env-file), TypeScript type stripping, util.parseArgs, util.styleText, a WebSocket client, the permission model,…

  10. How do Bun and Deno compare with Node.js?

    Deno (by Node's creator) emphasizes security permissions, built-in TypeScript, web-standard APIs and an integrated toolchain; Bun (JavaScriptCore-based, written in Zig) focuses on speed with a…

  11. When would you use Server-Sent Events instead of WebSockets?

    Use SSE for one-way server-to-client streams (notifications, live feeds, LLM token streaming): it runs over plain HTTP, reconnects automatically with Last-Event-ID, and works well with proxies. Use…

  12. Should Node.js terminate TLS itself?

    It can (https.createServer with certificates), but in most deployments TLS is terminated at a load balancer, reverse proxy (Nginx, Caddy, Envoy) or CDN, which handles certificates, HTTP/2/3 and…

  13. Should a Node.js server compress responses itself?

    It can with middleware (compression, @fastify/compress), but compression is CPU-intensive, so it's usually better done at the reverse proxy or CDN (gzip/brotli), keeping Node's event loop free.

  14. Which Web-standard APIs are available globally in modern Node.js?

    fetch, Request/Response/Headers, URL/URLSearchParams, AbortController, TextEncoder/TextDecoder, Web Streams, structuredClone, BroadcastChannel, Blob, FormData, crypto.subtle (Web Crypto),…

  15. How do you make a Node.js payment or order endpoint idempotent?

    Require an Idempotency-Key header, store the key with the request hash and response in a database (unique constraint) or Redis, and on retries return the stored response instead of reprocessing;…

  16. Which `node:util` functions are most useful?

    util.promisify (callback → promise), util.inspect (debug formatting), util.types checks, util.parseArgs (CLI argument parsing), util.styleText (terminal colors), util.deprecate, and…

  17. How do sessions work with `express-session`, and what store should you use?

    express-session sets a signed session ID cookie and stores session data server-side in a store. The default MemoryStore leaks memory and isn't shared between instances, so production should use…

Was this page helpful?

Report a mistake