# Add an AI chatbot to a Next.js site

> Install the Knosite chat assistant on a Next.js site with @knosite/next. It answers visitors from your own pages and ranks them as leads by how they engage.

[←Home](https://knosite.fyi/)[Blog](https://knosite.fyi/blog)[Guides](https://knosite.fyi/blog#guides)

# Add Knosite to a Next.js site

Knosite is a chat assistant that answers your visitors from your own pages, with sources, and ranks them as leads by how they engage. The [`@knosite/next`](https://www.npmjs.com/package/@knosite/next) package adds it to Next.js. It loads with next/script using lazyOnload, so it never competes with your page. It works with the App Router and the Pages Router.

## Install it

1. [Sign up](https://app.knosite.fyi/login) and add your website address. Knosite reads your pages.
2. Copy your site key from the dashboard’s Install page.
3. Install the package.

```
npm install @knosite/next
```

Then add the component near the root of your app, `app/layout.tsx`:

```
import { Knosite } from '@knosite/next';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Knosite siteKey="ks_live_…" />
      </body>
    </html>
  );
}
```

Using the Pages Router? Render the same component in pages/_app.tsx.

Deploy, and the chat appears in the bottom right corner of every page.

## Options

- `siteKey`: required, from the dashboard’s Install page.
- `theme`: `light`, `dark` or `auto`.
- `position`: `right` or `left`.

## Or from the terminal

The Knosite CLI finds your framework, adds the widget to the right file and tells you what to install. Run it in your project:

```
npx @knosite/cli install --key ks_live_…
```

Add `--dry-run` to see the change first. After you deploy, `npx @knosite/cli verify https://yoursite.com --key ks_live_…` checks it on the live page.

## Or let your AI agent do it

Connect Claude, Cursor, Copilot, Codex, ChatGPT, Gemini or Windsurf to Knosite and it adds the package, sets up Engage and tests it on your real site, asking before every change. [Set it up with your agent](https://knosite.fyi/docs/mcp).

## Then add Engage

On the same site, [Engage](https://knosite.fyi/engage) adds glossary tooltips, help tips and short on-site surveys, and ranks every engaged visitor hot, warm or nurture, with plain reasons. Plans start at [$35 a month](https://knosite.fyi/pricing).

Source: https://knosite.fyi/install/nextjs
