What problem does it solve?
Protects TanStack React Start applications from unauthorized access by providing clear, repeatable patterns for middleware configuration, server-side auth checks, and route-level guards so developers can secure routes, loaders, and API endpoints consistently.
Core Features & Use Cases
- Route Guards with beforeLoad: Server-run beforeLoad checks that call auth() and throw redirect to block unauthenticated access.
- Authenticated Server Functions: createServerFn handlers that call auth(), validate isAuthenticated, and return userId/orgId for downstream loaders or components.
- Loader and Org-aware Patterns: Pass auth-derived context (userId, orgId) from beforeLoad into loaders to fetch user- or org-scoped data and conditionally handle missing orgs.
Use case: Protect a /dashboard layout and its child routes on a Vinxi-hosted TanStack Start app by registering clerkMiddleware, wrapping the root with ClerkProvider, and using createServerFn-based guards that supply loader context.
Quick Start
Add a server-side beforeLoad guard that calls auth() via createServerFn and throws redirect to /sign-in when unauthenticated.