Skip to Content

Installation

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

Your app needs Session kit, a schema library to describe your users, and the packages your setup already uses, such as React and your router. Install the first two here, then follow the guide for your setup.

To install Session kit, run the following command:

npm install @monarcode/session-kit

Release candidates are published to the latest distribution tag. The API is frozen for 0.1: later 0.1 releases only add to it. 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. Each is an optional peer dependency, so install only the ones your setup imports.

Session kit needs TypeScript 5.4 or newer, and Effect asks for 5.9 or newer. Compatibility lists the runtimes and the peer dependency versions it supports.

Pick your setup

Find your setup in the following table. Each row names the entry point for your router or framework, and the guide to follow. 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

Every setup also imports its client from @monarcode/session-kit: createAuth, or with server rendering, createMirrorAuth. Server-rendered setups import more on the server, and each guide shows what. Entry points lists every import path.

Two guides apply to more than one setup:

Docs for coding assistants

These docs are also available as plain Markdown, for AI coding assistants. Point yours at /llms.txt, which links every page in reading order, or at /llms-full.txt, which holds them all in one file. For one page alone, add .md to its URL.

Next steps

  • Getting started: start here for a setup that keeps the session in the browser. The web router guides build on its app.
  • Expo Router: start here for an iOS or Android app. The guide starts from scratch.
  • Server rendering: start here for TanStack Start, Next.js, or React Router with server rendering.

On this page