What is serverless computing and how does Node.js fit in?

Why Interviewers Ask This

Senior Node.js engineers are expected to reason about architecture, performance, and edge cases. This question separates mid-level from senior candidates by testing deep system-level understanding.

Answer

Serverless computing (Functions as a Service — FaaS) allows you to deploy individual functions that run in response to events, without managing servers. The cloud provider (AWS Lambda, Google Cloud Functions, Azure Functions, Vercel, Netlify) handles provisioning, scaling, and infrastructure. Node.js is the most popular runtime for serverless functions due to its fast startup time, small footprint, and JavaScript's suitability for event-driven architectures. Benefits: no server management, automatic scaling (scales to zero when idle — saving cost), pay-per-invocation pricing, high availability built-in. Limitations: cold starts — first invocation after idle period has higher latency as the runtime initializes (Node.js cold starts are faster than Java/Python); execution time limits (AWS Lambda: 15 minutes max); stateless (no persistent connections — use connection proxies like RDS Proxy for databases); vendor lock-in. Best for: API endpoints, webhook handlers, background jobs, scheduled tasks, event processors. Less suitable for: long-running processes, WebSocket servers (though possible with API Gateway), heavy stateful computation. Frameworks: Serverless Framework, AWS SAM, SST for structured serverless development.

Pro Tip

This topic has Node.js-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.