awesome-everything RU
↑ Back to the climb

Backend Architecture

Middleware and DI: free-recall review

Crux Free-recall prompts across the middleware and DI unit. Answer each from memory first, then reveal the model answer and compare.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 14 min

Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall is what fixes the unit’s two axes in long-term memory.

Goal

Reconstruct the unit’s spine without looking back: the request vs wiring axes, the middleware contract, the composition root, the three injection scopes and their traps, the testing seam, and what a container does in production.

Recall before you leave
  1. 01
    What are the request axis and the wiring axis, and why is naming the axis a senior reflex?
  2. 02
    State the Express middleware contract and the two ways it is broken.
  3. 03
    What is inversion of control, what does the composition root do, and why is a service locator an anti-pattern?
  4. 04
    Name the three DI scopes, the trap each invites, and the rule that avoids both main traps.
  5. 05
    What is the test seam, and what is the difference between a fake and a mock?
  6. 06
    What does a DI container do under the hood, why do circular dependencies break it, and why prefer eager startup?
Recap

If you reconstructed each answer from memory, you hold the unit’s spine: name the axis first; on the request axis a middleware does exactly one of pass/terminate/forward and order is a security-and-cost boundary; on the wiring axis classes declare needs and a composition root supplies them; default to stateless singletons and escalate scope only when forced; DI’s payoff is the seam where you fake what you own and mock the boundaries you don’t; and a container is that composition root mechanized — topologically sorting the graph, refusing cycles, and failing fast at boot.

Continue the climb ↑Middleware and DI: code and config reading
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.