Web Framework Internals interview question · Most asked

What is a request lifecycle, and why should a backend engineer know it for their framework?

Summary

The request lifecycle is the ordered sequence of steps a framework runs for each HTTP request: server hand-off, bootstrap, middleware or filters, routing, authentication and validation, the controller or view, response creation, the response passing back out, and post-response work. Knowing it tells you where to put each piece of logic and explains many production bugs.

Longer Answer

Ordering bugs are common: middleware that runs before the user is loaded, exceptions raised in a layer the error handler doesn't cover, guards that see unvalidated input, expensive bootstrap work paid on every request, or state leaking between requests in long-running workers. Each framework names the stages differently, but the shape is the same.

Key Points

  • Ordered steps from server hand-off to post-response work.
  • Tells you where cross-cutting logic belongs.
  • Explains ordering and error-handling bugs.
  • Same shape, different names per framework.

Deep dive: Request Lifecycle: The Anatomy of a Request

Explanation

What interviewers look for

A general model plus concrete examples from at least one framework.

Follow-up questions

  • Describe the lifecycle in the framework you use most.
  • What runs after the response is sent?

More most-asked Web Framework Internals questions

← All Web Framework Internals questions