# Installation (https://session-kit.pages.dev/docs/installation)

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
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](https://github.com/monarcode/session-kit/blob/main/CHANGELOG.md)
before upgrading.

Session kit checks each user against a schema from any
[Standard Schema](https://standardschema.dev) library. The examples use Zod.
To install it, run the following command:

```npm
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](https://session-kit.pages.dev/docs/reference/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/`](https://github.com/monarcode/session-kit/tree/main/examples)
that signs in against DummyJSON's public test API:

| Setup                                      | Import                                       | Guide                                                                      | Example app                                                                                                                                                                                                                    |
| ------------------------------------------ | -------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| React without a router                     | `@monarcode/session-kit/react`               | [Getting started](https://session-kit.pages.dev/docs/getting-started)                                   | None                                                                                                                                                                                                                           |
| TanStack Router                            | `@monarcode/session-kit/tanstack-router`     | [TanStack Router](https://session-kit.pages.dev/docs/setups/tanstack-router)                            | [`tanstack-router`](https://github.com/monarcode/session-kit/tree/main/examples/tanstack-router)                                                                                                                               |
| TanStack Start, SPA mode                   | `@monarcode/session-kit/tanstack-router`     | [TanStack Router](https://session-kit.pages.dev/docs/setups/tanstack-router#tanstack-start-in-spa-mode) | [`tanstack-start-spa`](https://github.com/monarcode/session-kit/tree/main/examples/tanstack-start-spa), [`tanstack-start-spa-effetch`](https://github.com/monarcode/session-kit/tree/main/examples/tanstack-start-spa-effetch) |
| TanStack Start with server rendering       | `@monarcode/session-kit/tanstack-start`      | [TanStack Start](https://session-kit.pages.dev/docs/setups/tanstack-start)                              | [`tanstack-start-ssr`](https://github.com/monarcode/session-kit/tree/main/examples/tanstack-start-ssr)                                                                                                                         |
| React Router, declarative mode             | `@monarcode/session-kit/react-router`        | [React Router](https://session-kit.pages.dev/docs/setups/react-router#declarative-mode)                 | [`react-router-declarative`](https://github.com/monarcode/session-kit/tree/main/examples/react-router-declarative)                                                                                                             |
| React Router, data mode                    | `@monarcode/session-kit/react-router`        | [React Router](https://session-kit.pages.dev/docs/setups/react-router#data-mode)                        | [`react-router-data`](https://github.com/monarcode/session-kit/tree/main/examples/react-router-data)                                                                                                                           |
| React Router, framework mode, `ssr: false` | `@monarcode/session-kit/react-router`        | [React Router](https://session-kit.pages.dev/docs/setups/react-router#framework-mode-with-ssr-false)    | [`react-router-framework-spa`](https://github.com/monarcode/session-kit/tree/main/examples/react-router-framework-spa)                                                                                                         |
| React Router, framework mode with SSR      | `@monarcode/session-kit/react-router/server` | [React Router with SSR](https://session-kit.pages.dev/docs/setups/react-router-ssr)                     | [`react-router-framework-ssr`](https://github.com/monarcode/session-kit/tree/main/examples/react-router-framework-ssr)                                                                                                         |
| Next.js 16, App Router                     | `@monarcode/session-kit/next`                | [Next.js](https://session-kit.pages.dev/docs/setups/next)                                               | [`next-app`](https://github.com/monarcode/session-kit/tree/main/examples/next-app)                                                                                                                                             |
| Expo Router on iOS and Android, SDK 53+    | `@monarcode/session-kit/expo`                | [Expo Router](https://session-kit.pages.dev/docs/setups/expo)                                           | [`expo-router`](https://github.com/monarcode/session-kit/tree/main/examples/expo-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](https://session-kit.pages.dev/docs/reference) lists every import path.

Two guides apply to more than one setup:

- [Server sessions](https://session-kit.pages.dev/docs/server-rendering/server-sessions) covers what the
  three server-rendered setups share.
- [Effect and effetch](https://session-kit.pages.dev/docs/effect) works with any setup.

## Docs for coding assistants

These docs are also available as plain Markdown, for AI coding assistants.
Point yours at [`/llms.txt`](https://session-kit.pages.dev/llms.txt), which links every page in reading
order, or at [`/llms-full.txt`](https://session-kit.pages.dev/llms-full.txt), which holds them all in one
file. For one page alone, add `.md` to its URL.

## Next steps

- [Getting started](https://session-kit.pages.dev/docs/getting-started): start here for a setup that
  keeps the session in the browser. The web router guides build on its app.
- [Expo Router](https://session-kit.pages.dev/docs/setups/expo): start here for an iOS or Android app. The
  guide starts from scratch.
- [Server rendering](https://session-kit.pages.dev/docs/server-rendering): start here for TanStack Start,
  Next.js, or React Router with server rendering.