Skip to content
Preptima

Node.js & TypeScript interview questions and answers

Server-side JavaScript depth, where nearly every question eventually reduces to understanding the event loop and the type system.

15 published across 5 topics.

Phases, microtasks versus macrotasks, blocking the loop, and streams and backpressure.

mediumConcept

Walk me through the phases of the Node event loop.

Node.js event loop phases explain callback ordering across timers, poll, check, nextTick and promise microtasks. Correct answers separate macro-task phases from microtasks instead of memorising one log order.

4 minmid, senior, staff
All 3 in Event Loop & Async

CommonJS versus ESM, worker threads, clustering, buffers, and process and memory limits.

mediumConcept

You add one small npm package to a service. What have you just taken on?

Not one package but its whole transitive closure, install-time scripts from every node in it, a build that now depends on the registry being reachable, and the possibility of two resolved copies of the same library whose instances fail each other's identity checks.

5 minmid, senior, staff
All 3 in Node Runtime & Modules

Express & NestJS

3 questions

Middleware ordering, error handling, DI in Nest, and structuring a service beyond a single file.

All 3 in Express & NestJS

Structural typing, generics, narrowing, and modelling domain constraints in the type system.

All 3 in TypeScript for Services

Jest and Vitest, mocking modules, build and bundling choices, and monorepo workflows.

mediumConceptCodingDesign

How do you test a service that calls a third-party API, without calling it?

Substitute at the network layer or behind your own client interface, not at the HTTP library's function. Stubbing the library couples the test to how you make the call rather than to what you send, so the test keeps passing through refactors that change the request and breaks on refactors that change nothing.

4 minmid, senior
mediumConceptDesign

How do you test a Node service, and what do you refuse to mock?

Drive business logic through injected dependencies rather than module mocks, intercept at the process boundary for outbound HTTP and time, and use a real database in a container for anything where the database is the logic — SQL, constraints, transactions and migrations.

6 minmid, senior, staff
All 3 in Testing & Tooling