F6 · the architecture · module 1
Architecture & the request lifecycle
Phoenix is, at heart, one long function from a request to a response — a stack of small
plugs that each take a connection and hand back a connection. A request enters at the
Endpoint, the router matches it to a controller through a pipeline, the controller does
the one piece of real work — it calls the Portal facade from F5 — and a
view renders the result. Understanding that path is the whole of this module, because every later module plugs a
capability into it: routing shapes the match, Ecto and contexts sit behind the facade, HEEx and LiveView own the
render. Learn the lifecycle once and the rest of F6 is filling in stages.
This module maps the path a request travels and the one point where your code meets the engine: the request lifecycle end to end, the endpoint as a supervised process, and the controller/view seam.
One request, four stages
Endpoint — the request enters the plug stack.
The controller is the one stage that calls the Portal facade.
The path, at a glance
Four stages carry every request: the endpoint, the router, the controller, and the view. Three of them are framework plumbing you configure once; the fourth, the controller action, is where the Portal facade is called and the only stage that knows anything about the domain. Select a stage to see what it does and which module builds it out.
The request lifecycle · select a stage
stage: Controller
does: calls the Portal facade
You are not learning four unrelated things; you are learning one pipeline. The endpoint, router, and view are configured once and rarely touched again — the controller is where you work, and all it does is call the facade and choose how to render the answer.
Three deep dives
In order: the lifecycle end to end, from the connection to the response; the endpoint as both the outermost plug and a supervised process in the F5 tree; and the controller/view seam, where your code calls only the Portal facade.
Portal in the middle.Portal, branches on %Portal.Error{}, and picks a view; the view renders assigns.F5 · a headless engine
F5 left a supervised facade — correct and tested, but with no way for a browser to reach it.
F6.01 · a way in
The lifecycle is the path from a URL to a facade call. Once it runs, the platform has a front door.
Start with the request lifecycle, then the endpoint, then the controller and view seam. The next module, F6.02 — Routing, controllers & plugs, builds out the match in the middle. See also the design brief: wiring Phoenix onto the F5 engine.
References
The request lifecycle, the plug abstraction it is built from, and the endpoint at its head.
Sources
- Phoenix — Request life-cycle — endpoint to view, the canonical walkthrough.
- Phoenix — Overview — the framework at a glance.
- Elixir — Plug — the connection-in, connection-out contract every stage shares.
- Phoenix — Endpoint — the plug at the head of the pipeline.
Related in this course
- F6.01.1 · The request lifecycle
- F6.01.2 · The endpoint, supervised
- F6.01.3 · Controllers, views & the facade seam
- F6.0.3 · Wiring Phoenix onto the F5 engine — the seam this module walks.
- F5.09 · The engine lab — the facade the controller calls.