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

# Supabase Edge Functions

> Use Evocrawl with Supabase Edge Functions to search, scrape, and interact with web data at the edge.

## Prerequisites

* Supabase project with CLI (`supabase init`)
* A EvoCrawl API key — [get one free](https://www.evocrawl.com/app/api-keys)

## Setup

```bash theme={null}
supabase functions new evocrawl-search
supabase functions new evocrawl-scrape
supabase functions new evocrawl-interact
```

Set the secret:

```bash theme={null}
supabase secrets set EVOCRAWL_API_KEY=fc-YOUR-API-KEY
```

## Search the web

Edit `supabase/functions/evocrawl-search/index.ts`:

```typescript theme={null}
import Evocrawl from "npm:@mendable/evocrawl-js";

const evocrawl = new Evocrawl({
  apiKey: Deno.env.get("EVOCRAWL_API_KEY"),
});

Deno.serve(async (req) => {
  const { query } = await req.json();
  const results = await evocrawl.search(query, { limit: 5 });

  return new Response(JSON.stringify(results), {
    headers: { "Content-Type": "application/json" },
  });
});
```

## Scrape a page

Edit `supabase/functions/evocrawl-scrape/index.ts`:

```typescript theme={null}
import Evocrawl from "npm:@mendable/evocrawl-js";

const evocrawl = new Evocrawl({
  apiKey: Deno.env.get("EVOCRAWL_API_KEY"),
});

Deno.serve(async (req) => {
  const { url } = await req.json();
  const result = await evocrawl.scrape(url);

  return new Response(JSON.stringify(result), {
    headers: { "Content-Type": "application/json" },
  });
});
```

## Interact with a page

Edit `supabase/functions/evocrawl-interact/index.ts`:

```typescript theme={null}
import Evocrawl from "npm:@mendable/evocrawl-js";

const evocrawl = new Evocrawl({
  apiKey: Deno.env.get("EVOCRAWL_API_KEY"),
});

Deno.serve(async (_req) => {
  const result = await evocrawl.scrape("https://www.amazon.com", {
    formats: ["markdown"],
  });
  const scrapeId = result.metadata?.scrapeId;

  await evocrawl.interact(scrapeId, {
    prompt: "Search for iPhone 16 Pro Max",
  });
  const response = await evocrawl.interact(scrapeId, {
    prompt: "Click on the first result and tell me the price",
  });
  console.log(response.output);

  await evocrawl.stopInteraction(scrapeId);

  return new Response(JSON.stringify({ output: response.output }), {
    headers: { "Content-Type": "application/json" },
  });
});
```

## Deploy

```bash theme={null}
supabase functions deploy evocrawl-search
supabase functions deploy evocrawl-scrape
supabase functions deploy evocrawl-interact
```

## Test it

```bash theme={null}
curl -X POST https://<project-ref>.supabase.co/functions/v1/evocrawl-search \
  -H "Authorization: Bearer <ANON_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"query": "evocrawl web scraping"}'
```

## Next steps

<CardGroup cols={2}>
  <Card title="Search docs" icon="magnifying-glass" href="/features/search">
    Search the web and get full page content
  </Card>

  <Card title="Scrape docs" icon="file-lines" href="/features/scrape">
    All scrape options including formats, actions, and proxies
  </Card>

  <Card title="Interact docs" icon="hand-pointer" href="/features/interact">
    Click, fill forms, and extract dynamic content
  </Card>

  <Card title="Node SDK reference" icon="node" href="/sdks/node">
    Full SDK reference with crawl, map, batch scrape, and more
  </Card>
</CardGroup>
