01 / 10

What is nodejs?

Node.js is an open-source, cross-platform runtime environment that allows developers to execute JavaScript code outside of a web browser. It is built on Chrome's V8 JavaScript engine, which compiles JavaScript directly to native machine code for high performance.

Key Features of Node.js:
  1. 1

    Asynchronous and Event-Driven: Node.js uses non-blocking, event-driven architecture, making it lightweight and efficient for real-time applications.

  2. 2

    Single-Threaded with Event Loop: It operates on a single-threaded model with event looping, enabling it to handle multiple connections simultaneously without creating new threads.

  3. 3

    NPM (Node Package Manager): Node.js comes with npm, the largest ecosystem of open-source libraries and tools, making it easy to integrate third-party modules.

  4. 4

    Cross-Platform: It can run on various platforms like Windows, macOS, and Linux.

  5. 5

    Scalable: Ideal for building scalable network applications due to its non-blocking I/O model.

Difficulty: 3/10
Topics: event loop, non-blocking I/O, runtime environment

Scenario Questions

0-2 years experience
  1. 1

    If you need to read a file and then send its contents over HTTP in a Node.js service, how would you implement that without blocking the event loop?

  2. 2

    What happens if you call a synchronous, CPU‑intensive function inside an Express route handler? How would the server behave?

2-5 years experience
  1. 1

    We added a new third‑party library that uses many callbacks, and the request latency spiked. How would you investigate whether Node's event loop is the bottleneck?

  2. 2

    When deploying a Node.js microservice behind a load balancer, why might you choose the cluster module versus running multiple container instances? What trade‑offs are involved?

  3. 3

    Our Node app started throwing 'ERR_MAX_CALL_STACK_SIZE' after a recent refactor. Walk me through how you'd debug it.

5-8 years experience
  1. 1

    Design a high‑throughput logging pipeline in Node.js that must handle millions of events per second while preserving order. What architectural patterns would you use and why?

  2. 2

    Explain how you would mitigate memory leaks in a long‑running Node.js service that processes user uploads, and how you'd monitor it in production.

  3. 3

    If you need to support both CPU‑bound image processing and I/O‑bound API calls in the same Node.js service, how would you structure the code to avoid blocking?

8+ years experience
  1. 1

    Our organization is migrating a legacy monolithic Java API to a Node.js based platform. What considerations would you raise regarding performance, observability, and team ownership?

  2. 2

    When scaling a Node.js backend to serve billions of requests daily across multiple regions, how would you decide between using serverless functions, container orchestration, or a hybrid approach?

  3. 3

    Describe how you would establish a cross‑team standard for handling async errors and unhandled promise rejections in a large codebase, and how you'd enforce it.

Follow-up Questions

  • What metrics would you watch to know the event loop is becoming a bottleneck?
  • How do you decide between callbacks, promises, or async/await in a new feature?
  • Can you give an example of a situation where Node's single‑threaded model could cause problems?