Node.js Backend Interview Master
200+ Node.js interview questions covering Event Loop architecture, Libuv thread pool, Streams, Buffers, Cluster module, Worker Threads, and Express.
Difficulty Filters
Tools & Options
What is Node.js?
Node.js is a cross-platform, open-source JavaScript runtime environment that executes JavaScript code outside a web browser. It is built on Google Chrome's V8 JavaScript engine.
Is Node.js single-threaded?
Yes, Node.js is primarily single-threaded for its event loop, but it uses internal worker threads (via libuv) for handling expensive I/O operations like file system access or network requests.
What is the difference between Node.js and JavaScript?
JavaScript is a programming language, whereas Node.js is a runtime environment that allows you to run JavaScript on the server side.
What is npm?
What is REPL in Node.js?
What are the core modules of Node.js?
How do you create a simple server in Node.js?
What is the role of 'package.json'?
What is the difference between `require` and `import`?
What is a callback function?
What is the Event Loop in Node.js?
What is the difference between `setImmediate()` and `setTimeout()`?
What is the purpose of `module.exports`?
What is `process.argv`?
Explain 'Non-blocking I/O'.
What is the `fs` module?
What is 'Callback Hell'?
What is a Promise?
What is Async/Await?
What is Global Object in Node.js?
Explain `__dirname` and `__filename`.
What is the use of 'path' module?
What is 'error-first callback'?
How do you install a specific version of a package?
What is the difference between `dependencies` and `devDependencies`?
What is 'nodemon'?
What is 'event-driven' programming?
What is an EventEmitter?
What is a Buffer in Node.js?
What is the purpose of `os` module?
What is 'Stream' in Node.js?
Name the types of Streams in Node.js.
What is 'piping' in streams?
What is 'Chaining' in Node.js?
What is the use of `util.promisify()`?
What is 'Express.js'?
What is 'Middleware' in Express?
How do you handle routing in Express?
What is 'body-parser'?
What is 'REST API'?
What is 'JSON'?
Explain `cors` package.
What is `dotenv`?
What is 'Mongoose'?
What is 'JWT'?
How to handle file uploads in Node.js?
What is 'Bcrypt' used for?
What is 'Validation' in Node.js API?
What is the difference between `null` and `undefined` in JS?
What is 'Hoisting'?
Explain the Event Loop phases.
What are 'Microtasks' and 'Macrotasks'?
What is `process.nextTick()`?
How does Node.js handle concurrency?
Explain 'Clustering' in Node.js.
What is 'Worker Threads' module?
Difference between Cluster and Worker Threads?
How to handle memory leaks in Node.js?
Explain 'Backpressure' in Streams.
What is 'libuv'?
How to secure a Node.js API?
Explain 'authentication' vs 'authorization'.
How to scale Node.js applications?
What is 'PM2'?
Explain 'Socket.io'.
What is 'Redis' used for in Node.js?
Explain 'Stub', 'Mock', and 'Spy' in testing.
How to perform 'Graceful Shutdown'?
Explain 'Domain-Driven Design' (DDD) in Node.js.
What is 'Microservices Architecture'?
How to handle distributed tracing?
Explain 'Event Sourcing'.
What is 'CQRS'?
How to optimize expensive database queries?
Explain 'Hydration' in Node.js SSR.
How to handle 10k connections simultaneously?
Explain 'Garbage Collection' in V8.
What is 'Heap' vs 'Stack' memory?
Explain 'Proto-Pollution' vulnerability.
How to use 'crypto' module?
What is 'Passport.js'?
How to handle large file uploads to S3?
Explain 'serverless' with Node.js.
What is 'Cold Start' in Serverless?
Explain 'GRPC'.
What is 'GraphQL'?
Difference between GraphQL and REST?
How to implement 'pagination' correctly?
Explain 'Bull' or 'Bee-Queue'.
How to use 'child_process' module?
Difference between `spawn` and `exec`?
What is 'N-API'?
How to handle 'unhandledRejection' and 'uncaughtException'?
Explain 'Dependency Injection' (DI).
What is 'Inversion of Control' (IoC)?
How to implement 'Rate Limiting'?
What is 'Log Rotation'?
Explain 'Winston' or 'Pino'.
How to handle database migrations?
What is 'Circuit Breaker' pattern?
Explain V8 Engine Pipeline.
What is 'Hidden Classes' in V8?
Explain 'Inlining' optimization.
What is 'Buffer.alloc' vs 'Buffer.allocUnsafe'?
Explain 'Zero-copy' in Node.js.
What is 'V8 Heap Snapshot'?
Explain 'Flame Graphs'.
Deep Dive: libuv thread pool size.
What is 'Isolate' in V8?
Explain 'Crankshaft' (Legacy) vs 'TurboFan'.
How to write Native Addons with C++?
Explain 'SharedArrayBuffer' and 'Atomics'.
Deep Dive: 'Tick' process in Node.js.
What is 'Event Loop Lag'?
How to implement Custom Streams?
Explain 'QUIC' and 'HTTP/3' support.
How to handle 'BigInt' in Node.js?
Explain 'Shadow DOM' vs 'Virtual DOM'.
What is 'Tree Shaking' in Node.js production?
Security: 'ReDoS' (Regular Expression Denial of Service).
How to implement 'Observability'?
Explain 'Chaos Engineering' in Node.js.
Deep Dive: `require()` cache.
Explain 'Circular Dependencies' in Node.js.
How to use 'Inspector' module?
Explain 'Native Messaging' in Chrome Extensions via Node.
What is 'JIT' (Just In Time) Compilation?
How to implement 'Multi-tenant' architecture?
Explain 'Atomic' commits with MongoDB/Node.
How to handle 'Thundering Herd' problem?
What is 'Symlink' in Node.js modules?
Explain 'Module Wrapper' in Node.js.
Difference between `exports` and `module.exports`?
How to handle 'Zlib' for compression?
Explain 'Pre-parsing' in V8.
What is 'Code Cache'?
How to build 'CLI' tools with Node.js?
Explain 'TTY' module.
What is 'Vm' module?
How to implement 'A/B Testing' server-side?
Explain 'Service Discovery' in Microservices.
What is 'API Gateway' pattern?
Explain 'Sidecar' pattern.
How to handle 'Semantic Versioning' (SemVer)?
What is 'NPM Audit'?
Explain 'Peer Dependencies'.
How to use 'AbortSignal' across multiple async tasks?
What is 'Top-level Await'?
Explain 'WebAssembly' (Wasm) with Node.js.
How to implement 'Data Masking' for PII?
Read a file and count words.
Create a basic HTTP server.
Get all files in a directory.
Convert callback-based fs.readFile to Promise.
Implement a simple EventEmitter.
How to parse JSON from body in vanilla Node?
Implement basic authentication middleware in Express.
Calculate file hash (SHA-256).
Pipe a file to response (download).
Merge two objects in JS.
Check if a path is a directory or file.
How to run multiple promises in parallel?
Implement a Delay function.
Find unique values in array.
Get current platform and CPU count.
Zip a file using zlib.
How to catch unhandled promise rejections?
Implement a basic Cluster worker logic.
Filter an array of objects by property.
Format currency in JS.
Generate a random token string.
Check if a variable is an array.
Implement a simple LRU cache (Logic).
How to handle timeouts in Fetch?
Convert string to base64.
Group array of objects by a key.
How to execute a shell command?
Check if a string is a valid JSON.
Implement a custom Writable stream.
Find the intersection of two arrays.
How to detect a memory leak in a simple loop?
Debounce a function (Generic).
Throttle a function (Generic).
Deep clone an object (using structuredClone).
Implement a queue using two stacks.
Check for prime numbers.
Reverse words in a sentence.
Find the median of an array.
Convert epoch to human readable date.
Implement a retry logic for fetch.
Flatten nested JSON.
How to get query params from URL in Node?
Capitalize first letter of string.
Count occurrences of characters in string.
Write a stream-based file copy function.
Find the first non-repeating character.
Implement Binary Search.
How to use worker threads for heavy math?
Implement a simple string template engine.
Check if two strings are anagrams.
Technical Interview Mastery Blueprint
Proven methodologies and frameworks to succeed in technical and architecture rounds.
1. The Engineering STAR Technique
When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.
2. Defending Architectural Trade-Offs
Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.
3. Clean Code & Edge-Case Proactivity
In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.
4. Antipatterns to Avoid
Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.
Explore Related Tools
Hand-picked utilities and calculators related to this tool.
