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

# Web Example Setup

> Detailed setup for the Next.js + Convex web demo

## What This Example Is

`icrl-ts/web-example` is a Next.js app that demonstrates feedback-driven training with Convex-backed persistence and configurable LLM providers.

## 1. Install Dependencies

From `icrl-ts/web-example/`:

```bash theme={null}
pnpm install
```

## 2. Set Up Convex

```bash theme={null}
npx convex dev
```

This generates `convex/_generated/*` and a deployment URL.

## 3. Configure `.env.local`

Required:

```env theme={null}
NEXT_PUBLIC_CONVEX_URL=https://<your-deployment>.convex.cloud
```

Provider options:

```env theme={null}
# Option A: Anthropic standard API
ANTHROPIC_API_KEY=...

# Optional explicit provider selection: anthropic | gemini-vertex
LLM_PROVIDER=anthropic

# Option B: Gemini Vertex
GOOGLE_CREDENTIALS_JSON={...full service account json...}
GOOGLE_VERTEX_LOCATION=global
```

Notes:

* If `LLM_PROVIDER` is unset, selection order is: Anthropic first, then Gemini Vertex.
* Unsupported `LLM_PROVIDER` values fail configuration checks.

## 4. Start Dev Server

```bash theme={null}
pnpm dev
```

Open `http://localhost:3000`.

## 5. Data Model (Convex)

The web demo uses these tables:

* `databases`
* `trajectories`
* `curationMetadata`
* `embeddings`
* `examples`
* `suggestionCache`

Defined in `icrl-ts/web-example/convex/schema.ts`.

## 6. Production Deploy

* Deploy Next app (for example Vercel).
* Configure same env vars in deployment settings.
* Keep `NEXT_PUBLIC_CONVEX_URL` aligned with production Convex deployment.
