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:
| Import | Use it for | Exports |
|---|---|---|
@monarcode/session-kit | Creating the client, in every setup | createAuth, createMirrorAuth, fromAccessToken, webStorage, memoryStorage, isSignedIn, safeReturnTo, loginHref, AuthError, types |
@monarcode/session-kit/react | Reading the session in React: the provider and hooks | AuthProvider, useAuth, useAuthClient, createAuthHooks, useMirrorAuth, types |
@monarcode/session-kit/tanstack-router | Guarding routes with TanStack Router | connectAuth, requireSession, redirectIfSignedIn, SessionOutlet, useAuth, useAuthClient, types |
@monarcode/session-kit/react-router | Guarding routes with React Router in the browser | requireSession, requireSessionLoader, redirectIfSignedIn, redirectIfSignedInLoader, SessionOutlet, useAuthRevalidation, types |
@monarcode/session-kit/react-router/server | Server sessions with React Router | sessionMiddleware, requireSession, redirectIfSignedIn, sessionRoute, routerAuth, cookieJarMiddleware, routerJar, types |
@monarcode/session-kit/http | Calling your API with the access token | createAuthFetch, types |
@monarcode/session-kit/server | Server sessions on any server | createServerAuth, sessionHandler, types |
@monarcode/session-kit/tanstack-start | The browser side of TanStack Start with server sessions | connectSession, loadSession |
@monarcode/session-kit/tanstack-start/server | The server side of TanStack Start | startAuth, refreshSession, sessionRoute, startJar, types |
@monarcode/session-kit/next | Server sessions with Next.js | nextSession, sessionRoute, nextJar, proxyJar, types |
@monarcode/session-kit/expo | Expo Router apps on iOS and Android | secureStorage, SessionGate, deepLinkHandler, rememberDeepLink, types |
@monarcode/session-kit/effect | Reading the session from Effect code | Auth, AuthFailure, types |
@monarcode/session-kit/effetch | Calling your API with effetch | sessionBearer, 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
- Installation: find the guide for your setup.
- Compatibility: the versions and runtimes each entry point supports.