Skip to Content

Installation

Install Session kit and a schema library, then find the guide and example app for your setup.

Install Session kit, a schema library, and the packages your setup needs, then follow the guide for that setup.

To install the package, run the following command:

npm install @monarcode/session-kit

Alpha releases are published to the latest distribution tag and may change the public API, so pin an exact version and read the release notes before upgrading.

Session kit checks each user against a schema from any Standard Schema library. The examples use Zod. To install it, run the following command:

npm install zod

Then install React, and the router or framework your setup uses. Compatibility lists every optional peer dependency and the versions it supports.

Pick your setup

Find your setup in the following table. Each one has an import path and a guide. All but the first also have a runnable app in examples/ that signs in against DummyJSON's public test API:

SetupImportGuideExample app
React without a router@monarcode/session-kit/reactGetting startedNone
TanStack Router@monarcode/session-kit/tanstack-routerTanStack Routertanstack-router
TanStack Start, SPA mode@monarcode/session-kit/tanstack-routerTanStack Routertanstack-start-spa, tanstack-start-spa-effetch
TanStack Start with server rendering@monarcode/session-kit/tanstack-startTanStack Starttanstack-start-ssr
React Router, declarative mode@monarcode/session-kit/react-routerReact Routerreact-router-declarative
React Router, data mode@monarcode/session-kit/react-routerReact Routerreact-router-data
React Router, framework mode, ssr: false@monarcode/session-kit/react-routerReact Routerreact-router-framework-spa
React Router, framework mode with SSR@monarcode/session-kit/react-router/serverReact Router with SSRreact-router-framework-ssr
Next.js 16, App Router@monarcode/session-kit/nextNext.jsnext-app
Expo Router on iOS and Android, SDK 53+@monarcode/session-kit/expoExpo Routerexpo-router

Two guides apply to more than one setup:

Next steps

  • For a setup that keeps the session in the browser or on the device, start with Getting started. The router guides build on its app.
  • For a server-rendered setup, start with Server rendering.

On this page