# Set up Relia on Cloudflare Workers, Vercel Edge and Deno

> Wrap your edge handler in withRelia and add three settings, so each call to a Cloudflare Worker, Vercel or Netlify Edge function or Deno app shows up in Relia.

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

Edge runtimes don't run Node.js, so Relia has a small entry made for them: `relia-sdk/edge`. It uses only web-standard APIs and has no dependencies, so the same wrapper works on every platform. Supabase Edge Functions work the same way; see [Set up a Supabase app](https://tryrelia.com/docs/supabase-setup.md).

> **Tip:** watch [How to monitor a Supabase app: database, Edge Functions and errors](https://youtu.be/lgFYplJANic) (2 min).

## Before you start

- A Relia account ([Create your account](https://tryrelia.com/docs/create-account.md)).
- Your project's id and key. In Relia, open your project, click **Setup Guide & SDK** and pick **Cloudflare Workers**: every step there already has your project's values.

## Steps (Cloudflare Workers)

1. **Install the package** in your worker's folder:

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

2. **Wrap your fetch handler** in `withRelia`. Your handler stays unchanged:

   ```ts
   import { withRelia } from "relia-sdk/edge"

   export default {
     fetch: withRelia(async (req, env, ctx) => {
       // your handler, unchanged
     }),
   }
   ```

   Already have a handler object? Wrap its fetch: `fetch: withRelia(handler.fetch)`.

3. **Add the settings** to `wrangler.toml`:

   ```toml
   [vars]
   RELIA_PROJECT_ID = "<your project id>"
   RELIA_SERVICE_NAME = "shop-worker"
   RELIA_KEY = "<your project key>"
   ```

   You can keep the key as a secret instead:

   ```bash
   wrangler secret put RELIA_KEY
   ```

4. **For `wrangler dev`**, put the same names in `.dev.vars`, plus `RELIA_ENV=development` so test traffic stays apart from production.

5. **Start the worker and call it once.** Relia sends its data after the response, through `ctx.waitUntil`, so your users never wait for it.

## Deno and Deno Deploy

No install. Import from npm directly and wrap the handler you pass to `Deno.serve`:

```ts
import { withRelia } from "npm:relia-sdk/edge"

Deno.serve(withRelia(async (req) => {
  // your handler, unchanged
}))
```

Set `RELIA_PROJECT_ID`, `RELIA_KEY` and `RELIA_SERVICE_NAME` as environment variables.

## Vercel Edge and Netlify Edge

Install `relia-sdk`, import `withRelia` from `relia-sdk/edge`, and wrap the exported handler the same way, for example:

```ts
import { withRelia } from "relia-sdk/edge"

export default withRelia(async (request) => {
  // your handler, unchanged
})
```

Put `RELIA_PROJECT_ID`, `RELIA_KEY` and `RELIA_SERVICE_NAME` in your host's environment variables.

## What Relia records

- Each call as one request, with its route, status and time, and the error behind a failure.
- Calls your handler makes with `fetch`, as outgoing calls. Supabase table calls become database calls, without their values.
- Calls to AI models made with `fetch` inside the handler (OpenAI, Anthropic, Gemini, OpenRouter and others), as AI runs. See [Monitor AI calls in your app](https://tryrelia.com/docs/ai-calls-setup.md).

## Settings

| Name | What it does | Default |
|---|---|---|
| `RELIA_PROJECT_ID` | Your project id. Without it, Relia stays off. | none |
| `RELIA_KEY` | Your project key | none |
| `RELIA_SERVICE_NAME` | The name your worker shows under in Relia | the first part of the request path |
| `RELIA_ENV` | Environment label; use `development` locally | `production` |
| `RELIA_FLUSH` | `before` sends before answering, for local servers that stop right after the response | after the response when the platform allows it, else before |
| `RELIA_AI_CAPTURE` | `0` stops recording model calls | on |

On Cloudflare Workers these are read from the `env` your handler receives; elsewhere from the environment.

## Check it worked

Open your project in Relia and go to the **Setup** tab. **Requests from your server** changes from *Not yet* to *Arriving*. Your worker shows up under **APIs** by its service name.

## If something's wrong

- **Nothing arrives:** check that `RELIA_PROJECT_ID` is set where the code runs. Without it, `withRelia` passes requests straight through and sends nothing.
- **Nothing arrives from a local server:** add `RELIA_FLUSH=before` to your local settings.
- **Still "Not yet":** see [Relia shows no data](https://tryrelia.com/docs/no-data.md).

## Next

- [Set up a Supabase app](https://tryrelia.com/docs/supabase-setup.md)
- [Monitor AI calls in your app](https://tryrelia.com/docs/ai-calls-setup.md)
- [Teach Relia what matters](https://tryrelia.com/docs/teach-relia.md)

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