tezvyn:

Node.js & Express

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

276 bites

Node.js & Express85 sec read

Multi-stage Docker builds for lean production images?

WHAT IT TESTS: Docker build optimization and separation of build and runtime. OUTLINE: build stage compiles/installs, runtime stage copies artifacts only, discards build tools.

Node.js & Express84 sec read

Graceful shutdown implementation and zero-downtime deployments?

WHAT IT TESTS: process lifecycle, signal handling, and connection draining. OUTLINE: listen for SIGTERM, stop accepting new connections, drain in-flight requests, close resources, exit.

Node.js & Express2 min read

PM2 cluster mode and multi-core utilization?

WHAT IT TESTS: understanding multi-process concurrency and PM2's cluster mode. OUTLINE: cluster mode forks multiple worker processes using Node.js cluster module, distributes load, uses all CPU cores.

Node.js & Express87 sec read

dependencies vs devDependencies in production?

WHAT IT TESTS: understanding package requirements and deployment optimization. OUTLINE: dependencies are needed at runtime, devDependencies only for development. npm install includes both, npm ci --only=production excludes dev.

Node.js & Express70 sec read

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

WHAT IT TESTS: Docker containerization fundamentals for Node.js. OUTLINE: use lightweight base image, copy app, install deps, expose port, set NODE_ENV, run.

Node.js & Express77 sec read

How does NODE_ENV=production change Express behavior?

WHAT IT TESTS: understanding environment-specific optimizations and conventions. OUTLINE: NODE_ENV is a convention signal, production disables verbose logging and enables caching.

Node.js & Express76 sec read

What does PM2 do for Node.js applications?

WHAT IT TESTS: production process lifecycle and automatic recovery. OUTLINE: PM2 restarts crashed processes and manages multiple workers. OUTLINE: solves (1) app crash requiring manual restart, (2) single-process bottleneck.

Node.js & Express81 sec read

Environment configuration and secrets management in Node.js?

WHAT IT TESTS: production safety and configuration best practices. OUTLINE: use environment variables, load from .env file (dev only), never commit secrets.

Node.js & Express2 min read

WebSocket optimization for high-frequency data?

WHAT IT TESTS: real-time protocol efficiency and data transfer optimization. OUTLINE: large payloads increase latency, frequent tiny messages waste overhead, solutions include compression, selective fields, and batching.

Node.js & Express80 sec read

Cross-server Socket.IO communication in horizontal scaling?

WHAT IT TESTS: distributed system messaging and adapter patterns. OUTLINE: local io.emit() only reaches local sockets, need adapter (Redis) for inter-server broadcast. RED FLAG: assuming io.emit() broadcasts globally without an adapter; it doesn't.

Node.js & Express86 sec read

How to sync state across multiple user devices?

WHAT IT TESTS: multi-device presence and state coherence patterns. OUTLINE: attach userId to each socket, track active sockets per user, broadcast user state to all their sockets.

Node.js & Express81 sec read

How to authenticate WebSocket connections using JWTs?

WHAT IT TESTS: WebSocket auth patterns and middleware understanding. OUTLINE: client sends JWT on connection, server validates via middleware, socket is attached to user.

Node.js & Express83 sec read

How does Socket.IO handle WebSocket failures with fallbacks?

WHAT IT TESTS: understanding transport negotiation and fallback resilience. OUTLINE: transports are communication protocols, WebSocket is primary, long-polling is fallback, client auto-detects and downgrades.

Node.js & Express78 sec read

How do Socket.IO rooms organize client communication?

WHAT IT TESTS: understanding Socket.IO's grouping mechanism and message targeting. OUTLINE: Rooms group sockets for targeted broadcasting, socket can join multiple rooms, emit to room broadcasts to all members.

Node.js & Express65 sec read

How to add Socket.IO to an Express application?

WHAT IT TESTS: basic Socket.IO setup and HTTP server integration. OUTLINE: Create HTTP server with express(), attach Socket.IO to it, listen on server not app, define event handlers.

Node.js & Express78 sec read

Socket.IO emit methods: socket, io, broadcast differences?

WHAT IT TESTS: Socket.IO API design and message scope understanding. OUTLINE: socket.emit() sends to one client, broadcast.emit() to all except sender, io.emit() to all.

Node.js & Express77 sec read

HTTP request-response versus WebSocket connections?

WHAT IT TESTS: understanding request-response versus persistent bidirectional models. OUTLINE: HTTP is request-initiated, pull-based, client waits for response. WebSocket is persistent, bidirectional, either side sends data anytime.

Node.js & Express82 sec read

How do you handle errors across piped streams safely?

WHAT IT TESTS: stream lifecycle and error propagation understanding. OUTLINE: pipe connects streams but errors don't auto-propagate, must listen on each stream. Use pipeline() helper for auto-cleanup.

Node.js & Express71 sec read

postMessage vs SharedArrayBuffer in worker_threads tradeoffs?

WHAT IT TESTS: IPC performance and memory model understanding. OUTLINE: structured cloning copies data, SharedArrayBuffer shares memory. OUTLINE: cloning has overhead but safety isolation, SharedArrayBuffer is zero-copy but requires atomic operations.

Node.js & Express68 sec read

How does Node.js cluster module enable zero-downtime restarts?

WHAT IT TESTS: understanding graceful process replacement. OUTLINE: master-worker architecture, graceful shutdown of old workers, routing new requests to new workers. RED FLAG: forcing immediate termination of all workers instead of draining connections.