Web-standard loaders
TanStack Start speaks the Web Fetch API, so the auth loader takes a standard Request and returns a standard Response. It slots straight into your server functions and route loaders.
- Request in, Response out
- No adapter layer
TanStack Start
Add auth with the primitives TanStack Start already gives you: server functions and Web-standard loaders. The Authdog loader takes a Request and returns a Response, so it drops straight into your routes.
Resolve the session
// app/routes/index.tsx
import { createServerFn } from "@tanstack/react-start"
import { identityLoader } from "@authdog/tanstack-start"
export const loadIdentity = createServerFn({ method: "GET" }).handler(
async () => (await identityLoader()({ request })).json(),
)
Wrap your app once
// app/router.tsx
import { AuthdogProvider } from "@authdog/tanstack-start/client"
<AuthdogProvider>
{children}
</AuthdogProvider>
Web fundamentals, not magic
Auth that works with server functions, Web-standard loaders, and cookie sessions, just as the framework was designed.
TanStack Start speaks the Web Fetch API, so the auth loader takes a standard Request and returns a standard Response. It slots straight into your server functions and route loaders.
Resolve the session inside a createServerFn handler and hand a verified identity to your routes. Auth lives on the server, right where your data loading does.
Sessions ride secure, HTTP-only cookies set on the server. The provider strips the ?token=… from the URL once the session is persisted, so there is no client token juggling.
Tokens are validated against the trusted identity host and never exposed to browser code, so there's nothing for client scripts to read or leak.
Sessions renew transparently inside the loader, so expired tokens refresh without an extra round trip you have to write yourself.
A fully typed SDK gives you autocomplete for the user, claims, and roles returned from the identity loader to your routes.
Add @authdog/tanstack-start and your environment keys.
Add AuthdogProvider around your app.
Call identityLoader() from a server function.
Install the SDK, wrap your app with the provider, and resolve the session in a server function today. Free to start, with secure defaults built in.