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

# Next.js SDK

> Full support for Next.js 14/15 App Router, Server Actions, RSC, and Edge Runtime.

## Installation

```bash theme={null}
npm install @traceback/nextjs
```

***

## Automatic Setup via CLI

Run the interactive setup wizard:

```bash theme={null}
npx @traceback/cli init nextjs
```

***

## Manual Configuration

Create `instrumentation.ts` in your root directory:

```typescript theme={null}
// instrumentation.ts
export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    await import("./traceback.server.config");
  }

  if (process.env.NEXT_RUNTIME === "edge") {
    await import("./traceback.edge.config");
  }
}
```

```typescript theme={null}
// traceback.client.config.ts
import * as Traceback from "@traceback/nextjs";

Traceback.init({
  dsn: process.env.NEXT_PUBLIC_TRACEBACK_DSN,
  tracesSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
});
```
