Skip to content

M5 · Architecture with types

Relay becomes a real service: dependencies are types, errors accumulate in the signature, resources are always released. The capstone wires them together: Relay’s worker with injected dependencies, a typed error union, and guaranteed cleanup on shutdown.

# Lesson
1 Dependencies as types: ports and requirements
2 Accumulating error unions
3 using, await using and Symbol.dispose
4 Cancellation with AbortSignal
5 Variance in service interfaces
6 Type-checking performance
7 Capstone: Relay’s worker, with injected dependencies, typed errors and cleanup on shutdown