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

# Vercel native integration

> Deploy personalized Next.js applications without exposing credentials or creating a separate NSL account.

The NeuronSearchLab Vercel integration provisions a ready-to-use recommendation workspace, injects server-only configuration, and opens the NSL console through Vercel SSO. You do not need to create a separate NeuronSearchLab account before installing it.

## Deploy the personalized starter

1. Open Vercel Marketplace, install **NeuronSearchLab**, and choose Free, Starter, or Pro.
2. Create a NeuronSearchLab resource and connect it to your Vercel project.
3. Deploy the **Next.js Personalized Content Starter**.
4. Open several Football stories, then refresh the homepage to see the ranking adapt.

When the resource is connected, Vercel creates these environment variables in the project:

| Variable                | Purpose                                           |
| ----------------------- | ------------------------------------------------- |
| `NSL_API_URL`           | Core API base URL                                 |
| `NSL_TOKEN_URL`         | OAuth token endpoint                              |
| `NSL_CLIENT_ID`         | Resource-specific OAuth client ID                 |
| `NSL_CLIENT_SECRET`     | Resource-specific OAuth client secret             |
| `NSL_CONTEXT_ID`        | Numeric ID of the provisioned homepage context    |
| `NSL_EVENT_VIEW_ID`     | Numeric ID of the provisioned view event type     |
| `NSL_EVENT_CLICK_ID`    | Numeric ID of the provisioned click event type    |
| `NSL_EVENT_PURCHASE_ID` | Numeric ID of the provisioned purchase event type |

All eight values are server-only configuration. Never copy one into a variable beginning with `NEXT_PUBLIC_`. The Next.js package uses the provisioned context and event IDs automatically, so the starter works across deployed Core API versions without hard-coded numeric identifiers.

## Use the Next.js package

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

```ts app/api/nsl/events/route.ts theme={null}
import { createEventRoute } from '@neuronsearchlab/nextjs/server';

export const POST = createEventRoute();
```

```tsx theme={null}
import { nsl } from '@neuronsearchlab/nextjs/server';

const recommendations = await nsl.recommend({
  userId: user.id,
  context: 'homepage',
  limit: 10,
});
```

Browser components can use `NSLTracker` or `trackNSLEvent`; both call your Route Handler and never receive the OAuth secret.

## What is provisioned

Each Vercel resource maps to a separate NSL workspace with:

* a homepage context
* view, click, and purchase event types
* an active default ranking pipeline
* a dedicated OAuth client
* Free, Starter, or Pro resource-level billing

Use **Manage** on the installed Vercel integration to open the NSL console through Vercel SSO. Rotating resource secrets replaces the dedicated OAuth credential and returns an updated keyset to Vercel.

Removing the resource revokes its OAuth credential and disconnects it from Vercel projects. The historical recommendation data in the NSL workspace is retained.
