Skip to content
tezvyn:

Node.js & Express

Node.js, Express, Fastify, NestJS, Bun, Deno

65 bites

Test yourself: Top 30 intermediate Node.js & Express interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Intermediate interview questions in Node.js & Express, page 3

intermediate2 min read

Offloading CPU work with worker_threads

Heavy sync work blocks the single event loop and stalls all requests; move it to a Worker, message the input, await the result asynchronously, and ideally pool workers.

intermediate1 min read

worker_threads versus cluster: when to use each

Worker_threads offloads CPU-bound compute within one process with shared-memory transfer; cluster forks processes to scale IO-bound request throughput across cores.

intermediate2 min read

Implementing a custom filtering Transform stream

Subclass Transform with objectMode, implement _transform to parse each chunk, push only matching objects, and call the callback; handle parse errors.

intermediate1 min read

How do Socket.IO rooms organize client communication?

Rooms group sockets for targeted broadcasting, socket can join multiple rooms, emit to room broadcasts to all members.

intermediate1 min read

How does Socket.IO handle WebSocket failures with fallbacks?

Transports are communication protocols, WebSocket is primary, long-polling is fallback, client auto-detects and downgrades.

intermediate1 min read

How to authenticate WebSocket connections using JWTs?

Client sends JWT on connection, server validates via middleware, socket is attached to user.

intermediate1 min read

How to sync state across multiple user devices?

Attach userId to each socket, track active sockets per user, broadcast user state to all their sockets.

intermediate1 min read

What are key Dockerfile steps for Node.js Express apps?

Use lightweight base image, copy app, install deps, expose port, set NODE_ENV, run.

intermediate1 min read

dependencies vs devDependencies in production?

Dependencies are needed at runtime, devDependencies only for development. npm install includes both, npm ci --only=production excludes dev.

intermediate2 min read

PM2 cluster mode and multi-core utilization?

Cluster mode forks multiple worker processes using Node.js cluster module, distributes load, uses all CPU cores.

intermediate1 min read

Role of libuv in the Node.js runtime

Libuv provides the event loop, a thread pool for blocking work, and OS async I/O abstractions.

intermediate1 min read

Microtask versus macrotask execution order in Node

NextTick drains before promises, both microtask queues flush fully between each macrotask, timers and setImmediate are macrotasks.

intermediate1 min read

Detecting and diagnosing event loop lag

Measure delay between scheduled and actual timer fire, expose it as a metric, find synchronous CPU-bound code.

intermediate1 min read

V8 generational GC and event loop responsiveness

Young-generation scavenges are frequent but short, old-generation major GC is rarer but longer, stop-the-world pauses block the single JS thread.

intermediate1 min read

Validating request bodies with Express middleware

Run validation middleware before the handler, check email format and password length, return 400 with errors on failure, call next on success.

intermediate1 min read

Purpose of an ORM like Sequelize

Maps rows to objects, gives a model-based API, handles associations, migrations, and parameterized queries across dialects.

intermediate1 min read

Pinpointing validation errors in nested request data

Use schema validation that reports a path, collect all errors not just the first, return a 400 with field paths and messages.

intermediate1 min read

Managing user presence with reconnection grace periods

Rely on heartbeats, apply a grace period before marking offline, reconcile reconnects by user not socket id, use a shared store for multi-instance.

intermediate1 min read

Blocking versus non-blocking I/O in Node

Blocking calls halt the thread until done, non-blocking returns immediately and notifies via callback or promise, fs.readFileSync versus fs.readFile.

intermediate1 min read

Callback hell and how to refactor it

Deeply nested callbacks (pyramid of doom) hurt readability and error handling, refactor with promises or async/await.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles