What problem does it solve? TanStack Start developers need a structured way to run shared logic—authentication, logging, validation, context injection—across server functions and server routes without duplicating code, while avoiding subtle security mistakes like trusting client-sent context. ## Core Features & Use Cases - Two Middleware Types: Request middleware (.server() only, runs on all server requests) and server function middleware (.client() + .server(), runs per createServerFn call). - Context Passing: Pass typed context down the chain via next({ context }) and transfer data between client and server phases with sendContext. - Global Middleware: Register app-wide request and function middleware through createStart in src/start.ts. - Middleware Factories: Build parameterized, reusable authorization middleware that composes on top of an auth middleware. - Use Case: Protect a workspace-scoped server function by validating the client-sent workspaceId shape with Zod, then verifying the session principal's membership before querying the database. ## Quick Start Show me how to create an auth middleware in TanStack Start that loads the session and attaches it to every server function.