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.
-
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…
-
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…
-
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…
-
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,…
-
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…
-
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.…
-
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…
-
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…
-
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,…
-
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…
-
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…
-
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…
-
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.
-
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),…
-
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;…
-
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…
-
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…