Skip to Content

Entry points

Every import path Session kit publishes, and what each one exports.

Find the import path for your setup here, then open its page for the options and types of each export. Import from these paths only: the internal dist paths aren't part of the public API.

Entry points

Each entry point, what it's for, and what it exports:

ImportUse it forExports
@monarcode/session-kitCreating the client, in every setupcreateAuth, createMirrorAuth, fromAccessToken, webStorage, memoryStorage, isSignedIn, safeReturnTo, loginHref, AuthError, types
@monarcode/session-kit/reactReading the session in React: the provider and hooksAuthProvider, useAuth, useAuthClient, createAuthHooks, useMirrorAuth, types
@monarcode/session-kit/tanstack-routerGuarding routes with TanStack RouterconnectAuth, requireSession, redirectIfSignedIn, SessionOutlet, useAuth, useAuthClient, types
@monarcode/session-kit/react-routerGuarding routes with React Router in the browserrequireSession, requireSessionLoader, redirectIfSignedIn, redirectIfSignedInLoader, SessionOutlet, useAuthRevalidation, types
@monarcode/session-kit/react-router/serverServer sessions with React RoutersessionMiddleware, requireSession, redirectIfSignedIn, sessionRoute, routerAuth, cookieJarMiddleware, routerJar, types
@monarcode/session-kit/httpCalling your API with the access tokencreateAuthFetch, types
@monarcode/session-kit/serverServer sessions on any servercreateServerAuth, sessionHandler, types
@monarcode/session-kit/tanstack-startThe browser side of TanStack Start with server sessionsconnectSession, loadSession
@monarcode/session-kit/tanstack-start/serverThe server side of TanStack StartstartAuth, refreshSession, sessionRoute, startJar, types
@monarcode/session-kit/nextServer sessions with Next.jsnextSession, sessionRoute, nextJar, proxyJar, types
@monarcode/session-kit/expoExpo Router apps on iOS and AndroidsecureStorage, SessionGate, deepLinkHandler, rememberDeepLink, types
@monarcode/session-kit/effectReading the session from Effect codeAuth, AuthFailure, types
@monarcode/session-kit/effetchCalling your API with effetchsessionBearer, types

Bundle size

The package is tree-shakeable, so a bundle holds only what you import. An entry point you don't import adds nothing.

Errors

Errors from Session kit's own logic are AuthErrors, with a code you can match on. Error codes lists every code, and Effect and effetch how they reach Effect code.

Next steps

On this page