# Watch your web app

> Add Relia to a React, Vue, Svelte or other browser app with one command, so visits, errors, broken buttons and page speed show up in Relia.

Section: Set up your stack · Page: https://tryrelia.com/docs/web-app-setup · Last checked against the product: 2026-11-01
Video walkthrough: https://youtu.be/-dkUYYsaXNc

This page sets up a browser app on its own, for example a React app built with Vite. Using Next.js? Set up its server with [Set up a Next.js app](https://tryrelia.com/docs/nextjs-setup.md); for its browser side, run the setup below and choose **Session & User journey monitoring** (Next.js source maps are not wired by the setup). To have your AI assistant do the setup, see [Set up Relia with your AI assistant](https://tryrelia.com/docs/setup-with-ai-assistant.md).

## Before you start

- A Relia account ([Create your account](https://tryrelia.com/docs/create-account.md)).
- A terminal open in your web app's folder (the one with its `package.json`).

## Steps

1. **Run the setup:**

   ```bash
   npx relia-sdk@latest init
   ```

   Always use `relia-sdk`: the npm package called `relia` belongs to someone else.

2. **Sign in.** Choose the browser option, copy the token from the **CLI Authentication** page, and paste it back into the terminal.

3. **Choose what to set up.** The setup finds your app (for example *React app (Vite)*). Choose **Everything Relia found here**, then pick your Relia project or create one.

4. **Choose what Relia records in the browser:**
   - **1) Clicks, pages and errors** (recommended, the default). This is how Relia finds broken buttons, slow pages and stuck visitors.
   - **2) The same, plus screen replays.** Only lets you watch a session; it records what is on the screen.
   - **3) Page views only.** Visitor analytics and errors, the cheapest option: 1 unit per page view, no click data. Good for a marketing site. Your file then gets `mode: "pageviews"`.

5. **Answer "Tell Relia who your users are?"** Say yes if your app has sign-in. See [Identify your users](https://tryrelia.com/docs/identify-users.md).

6. **Check what it wrote:**
   - A new file, `src/relia.ts`, with your project's settings.
   - Your entry file (for example `src/main.tsx`) imports it first: `import "./relia"`.
   - Source maps, so browser errors point at your real files: Vite apps get `reliaSourcemaps(...)` in `vite.config`; other bundlers get an upload added to the `build` script.
   - An upload-only `RELIA_TOKEN` in `.env.local`, which is kept out of git.
   - `relia-sdk` added to your `package.json`.

7. **Run your dev server, open the app and click around once.**

## What Relia records

- Every visit as a journey: pages, clicks, form submits and errors.
- Page speed: loading (LCP), responsiveness (INP) and layout shift (CLS).
- Browser errors with stack traces mapped back to your source files.
- Which API request a click made, so a failing button and a failing API become one problem.

The text people type is not captured (`captureText: false`), and nothing is screen recorded unless you set `replay: true`.

## Set it up by hand instead

```bash
npm install relia-sdk
```

Create `src/relia.ts` (your project's id and key are on your project page under **Setup Guide & SDK**):

```ts
import { Relia } from "relia-sdk"

Relia.init({
  project_id: "<your project id>",
  key: "<your project key>",
  service_name: "shop-web",
  captureText: false,
  replay: false,
})
```

Import it as the first line of your entry file:

```ts
import "./relia"
```

For readable errors with Vite, add the plugin to `vite.config`:

```ts
import { reliaSourcemaps } from "relia-sdk/vite"

export default { plugins: [reliaSourcemaps({ projectId: "<your project id>" })] }
```

Then run this once in the app's folder to get the upload-only token:

```bash
npx relia-sdk@latest token
```

## When you deploy

Hosted builds (Vercel, Netlify, Render, CI) don't have your `.env.local`. Add `RELIA_TOKEN` with the same value to the host's environment variables. Until you do, builds still succeed; they just skip the source map upload. The maps are removed from the build output either way, so your source code is never published.

> **Tip:** watch [Browser errors show minified code? Upload source maps to fix it](https://youtu.be/ArLJuvippU8) (2 min).

## Check it worked

Open your project in Relia and go to the **Setup** tab. **Visits to your web app** changes from *Not yet* to *Arriving*. With no server, **Requests from your server** shows *Optional*. **Source maps** follows after your first build. Your visits appear under **Users**: **Visitors**, **Sessions** and **Page speed**.

## If something's wrong

- **No visits:** make sure `import "./relia"` is the first line of the entry file your app really loads, then reload the page. See [Relia shows no data](https://tryrelia.com/docs/no-data.md).
- **Browser errors show minified code:** the source maps weren't uploaded. Check `RELIA_TOKEN` is set where the build runs. See [Upload source maps](https://tryrelia.com/docs/source-maps.md).
- **Lost the token value:** run `npx relia-sdk@latest token` again in the app's folder.

## Next

- [Identify your users](https://tryrelia.com/docs/identify-users.md)
- [Visitors, sessions and page speed](https://tryrelia.com/docs/users-and-visitors.md)
- [Control what Relia collects](https://tryrelia.com/docs/sdk-settings.md)
- [Privacy in Relia](https://tryrelia.com/docs/privacy.md)

---
All Relia docs for AI assistants: https://tryrelia.com/llms.txt (index) · https://tryrelia.com/llms-full.txt (everything in one file)
