Skip to content

Middleware

Middleware runs in declared order around command and component handlers. Call next() exactly once; duplicate continuation is rejected. A middleware may short-circuit by replying or throwing a typed framework error.

Use middleware for cross-cutting policy, not hidden command registration or unmanaged listeners. Execution supplies an abort signal and bounded timeout, and invokes completion hooks once even when middleware fails.