> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ouim.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install logto-authkit using your preferred package manager

# Installation

logto-authkit is available as a single npm package that includes both frontend and server features.

## Install the package

<CodeGroup>
  ```bash npm theme={null}
  npm install @ouim/logto-authkit
  ```

  ```bash yarn theme={null}
  yarn add @ouim/logto-authkit
  ```

  ```bash pnpm theme={null}
  pnpm add @ouim/logto-authkit
  ```
</CodeGroup>

## Peer dependencies

logto-authkit requires the following peer dependencies for frontend features:

* `@logto/react` - ^3.0.0 || ^4.0.0
* `react` - ^17.0.0 || ^19.0.0
* `react-dom` - ^17.0.0 || ^19.0.0

These should be installed automatically by your package manager, but if not, install them manually:

<CodeGroup>
  ```bash npm theme={null}
  npm install @logto/react react react-dom
  ```

  ```bash yarn theme={null}
  yarn add @logto/react react react-dom
  ```

  ```bash pnpm theme={null}
  pnpm add @logto/react react react-dom
  ```
</CodeGroup>

<Note>
  Server features work independently and don't require React dependencies.
</Note>

## Package exports

logto-authkit provides three main exports:

### Main entry (frontend)

```typescript theme={null}
import { AuthProvider, useAuth, UserCenter, CallbackPage } from '@ouim/logto-authkit'
```

Includes all frontend components and hooks for React applications.

### Server entry

```typescript theme={null}
import { verifyAuth, createExpressAuthMiddleware, verifyNextAuth } from '@ouim/logto-authkit/server'
```

Includes JWT verification, Express middleware, and Next.js helpers.

### Bundler config entry

```typescript theme={null}
import { viteConfig, webpackConfig, nextjsConfig } from '@ouim/logto-authkit/bundler-config'
```

Pre-configured bundler settings for Vite, Webpack, and Next.js.

<Tip>
  When editing build-time scripts, import from `@ouim/logto-authkit/bundler-config` to avoid executing the main library bundle.
</Tip>

## TypeScript support

logto-authkit is written in TypeScript and provides comprehensive type definitions out of the box.

```typescript theme={null}
import type {
  LogtoUser,
  AuthOptions,
  AuthMiddleware,
  CallbackPageProps,
  NavigationOptions,
  AdditionalPage
} from '@ouim/logto-authkit'

// Server types
import type {
  AuthContext,
  AuthPayload,
  VerifyAuthOptions
} from '@ouim/logto-authkit/server'
```

## Next steps

<Card title="Quick start" icon="rocket" href="/logto-authkit/quickstart">
  Get up and running with authentication in minutes
</Card>
