THN Interview Prep

Comprehensive Node.js Guide for Senior Developers - Interview Preparation (2026 Edition)

This page is the study map for senior Node.js interviews. Start with the linked runtime fundamentals, then use the roadmap topics as follow-up prompts for system design, production debugging, and framework tradeoff rounds.

The most important interview skill is not naming APIs. It is explaining what happens to CPU, memory, I/O, queues, and errors when traffic rises.

StepPageWhy it matters
1Event Loopexplains scheduling, starvation, timers, and async callback order
2Asynchronous Patternsteaches error propagation, parallelism, cancellation, and concurrency limits
3Streamscovers backpressure and large-data safety
4Buffers and Binary Dataexplains memory, encodings, binary I/O, and security gotchas
5Event Emittersexplains listener lifecycle, error events, and leak patterns
6CommonJS vs ES Modulesprepares for packaging, migration, and runtime compatibility questions
7Tree shakinguseful when Node code is bundled for serverless, edge, or shared packages

Use the remaining sections as a checklist for future deep pages or interview self-drills.

Core Runtime & Asynchronous Model

  1. Event Loop

    • Phases (timers, pending callbacks, idle/prepare, poll, check, close callbacks)
    • Microtask vs Macrotask queue
    • process.nextTick() vs setImmediate() behavior
    • Blocking the event loop - consequences and prevention
  2. Asynchronous Patterns

    • Callbacks (error-first convention, callback hell)
    • Promises (states, chaining, all/race/allSettled, unhandled rejection handling)
    • Async/Await (syntax, error handling, concurrency patterns, top-level await)
  3. Streams

    • Readable, Writable, Duplex, Transform
    • Backpressure mechanism
    • Piping, custom stream implementation
    • Object mode streams
  4. Buffer & Binary Data

    • Creation methods, encoding/decoding
    • Zero-copy operations
    • TypedArray interoperability
  5. Event Emitters

    • Custom event patterns
    • Memory leak prevention (removeListener, once)
    • Error events and uncaught exceptions

Module System & Code Structure

  1. CommonJS vs ES Modules

    • Syntax differences and loading behavior
    • Dual package publishing strategy
    • Conditional exports, subpath patterns
    • import.meta, createRequire, dynamic import()
  2. Package Management & Dependency Strategies

    • npm vs pnpm vs yarn - practical differences
    • package.json fields (exports, imports, type)
    • Lockfile strategy & reproducible builds
    • Dependency auditing & security scanning

Scaling & Parallel Execution

  1. Cluster Module

    • Master-worker architecture
    • Sticky sessions & load balancing
    • Graceful shutdown patterns
  2. Worker Threads (Deep Understanding)

    • Architecture (isolates, separate event loops)
    • Message passing (structured clone, transferable objects)
    • Shared memory (SharedArrayBuffer + Atomics)
    • Worker pools (Piscina, workerpool) - production patterns
    • Resource limits & per-worker profiling

Web & API Development

  1. RESTful API Design Principles

    • Resource naming, HTTP methods, status codes
    • Versioning strategies
    • HATEOAS considerations
  2. Web Frameworks Comparison

    • Express.js (middleware chain, ecosystem)
    • Fastify (performance, schema validation, plugins)
    • NestJS (modular architecture, TypeScript-first, DI)
  3. Middleware Patterns

    • Application-level, router-level, error-handling
    • Async middleware & error propagation

Security & Network Considerations

  1. CORS Configuration & Security Implications

    • Preflight requests, credentials
    • Origin validation strategies
  2. Modern Security Hardening

    • Secure headers (CSP, Permissions-Policy, Referrer-Policy)
    • Helmet limitations & manual hardening
    • Rate limiting (express-rate-limit vs token bucket)
    • Common attack vectors (prototype pollution, regex DoS)
  3. Authentication & Authorization

    • JWT, OAuth 2.0/OpenID Connect, sessions
    • RBAC, ABAC, policy engines
    • Modern approaches (Lucia, Better-Auth, passkeys)
  4. HTTP Client & Networking

    • Undici (built-in fetch, interceptors, pooling)
    • WebSockets (ws vs Socket.io - scaling, rooms)
    • gRPC (Protocol Buffers, streaming RPC)

File System & Background Processing

  1. File System Operations

    • fs.promises API
    • Large file handling with streams
    • File watching & change detection
  2. Reliable Background Jobs

    • BullMQ (Redis-based, most popular 2025-2026)
    • Job patterns: retries, priorities, dead-letter queues
    • At-least-once vs exactly-once semantics

Testing, Type Safety & Quality

  1. Modern Testing in Node.js

    • Built-in test runner (node --test)
    • Mocking, assertions, coverage
    • Comparison: built-in vs Vitest vs Jest
  2. TypeScript in Node.js Projects

    • Project structure best practices
    • ESM + TypeScript (moduleResolution: nodenext)
    • Decorators, strict typing in frameworks
    • Monorepo patterns (turborepo, nx, pnpm workspaces)

Observability, Performance & Debugging

  1. Diagnostics & Observability

    • OpenTelemetry (distributed tracing - most important 2025+)
    • Clinic.js (flame graphs, doctor, bubbleprof)
    • Heap snapshots, CPU profiling, async_hooks
    • Performance.eventLoopUtilization()
  2. Performance Optimization Patterns

    • Memory leak detection & prevention
    • Caching strategies (Redis, in-memory)
    • Database query optimization & batching

Deployment & Runtime Environment

  1. Serverless Node.js

    • AWS Lambda, Vercel, Deno Deploy
    • Cold start mitigation
    • Layer & dependency optimization
  2. Node.js Internals Overview

    • V8 engine basics (heap, GC phases)
    • libuv role & thread pool
    • Single executable applications (experimental)
  3. Emerging & Experimental Features

    • Permission model (--permission flags)
    • Watch mode improvements
    • Test runner enhancements
    • Single executable applications (pkg-like functionality)

Final Senior-Level Interview Preparation Checklist

A strong senior candidate should be able to discuss with practical depth:

  • Migration strategy from CommonJS → ESM in large legacy codebase
  • When to choose Worker Threads vs child_process vs cluster
  • Production worker pool implementation patterns
  • Distributed tracing implementation with OpenTelemetry
  • Reliable background job architecture with monitoring & recovery
  • Memory leak debugging workflow
  • Modern security headers + CSP configuration
  • Framework selection rationale (Express vs Fastify vs NestJS)
  • Built-in test runner advantages & limitations

Model answer checklist

For each topic, practice answering with this structure:

  1. Define the runtime mechanism.
  2. Show one concrete failure mode.
  3. Explain the production mitigation.
  4. Name the metric, profile, trace, or test that proves the mitigation.
  5. State the tradeoff.

Example for worker threads:

“Worker threads are useful for CPU-bound work that would otherwise block the event loop. I would use a bounded worker pool rather than creating a worker per request, measure queue wait and worker CPU, and compare it with moving the workload to a separate service if isolation or independent scaling matters more.”

Focus on implementing small but representative projects for the highest-impact topics: ESM migration, worker pools, OpenTelemetry instrumentation, reliable jobs, stream pipelines, and modern security hardening.

Mark this page when you finish learning it.

Spotted something unclear or wrong on this page?

On this page