Middleware / 12-stage hook chain (CSRF, headers, guards)
Generated from
mcp/patterns.registry.json— do not edit by hand; change the registry and runbun run patterns:build.
Index card — the docs below are the canonical explanation; deep-tier pattern pages additionally carry invariants and emulation notes.
Category: Architecture & Request Pipeline · Tier: light · Risk: low — structural pattern, no external services
Describes the ordered SvelteKit hook chain in src/hooks.server.ts — security headers, i18n, auth, CSRF, session, consent, and guards — as the single source of truth for request interception.
When to use: Reach for it when adding or reordering cross-cutting request handling such as auth, CSRF, or security headers.
Docs
Code
Machine-readable record: architecture-middleware in mcp/patterns.registry.json.