> ## 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

> Supabase Edge FunctionsでEvocrawlを使って、エッジでWebデータを検索、スクレイピング、操作できます。

<div id="prerequisites">
  ## 前提条件
</div>

* CLIで初期化した Supabase プロジェクト (`supabase init`)
* EvoCrawl APIキー — [無料で取得できます](https://www.evocrawl.com/app/api-keys)

<div id="setup">
  ## セットアップ
</div>

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

シークレットを設定します:

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

<div id="search-the-web">
  ## Webを検索する
</div>

`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" },
  });
});
```

<div id="scrape-a-page">
  ## ページをスクレイピング
</div>

`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" },
  });
});
```

<div id="interact-with-a-page">
  ## ページに対して Interact する
</div>

`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" },
  });
});
```

<div id="deploy">
  ## デプロイ
</div>

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

<div id="test-it">
  ## 試してみる
</div>

```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"}'
```

<div id="next-steps">
  ## 次のステップ
</div>

<CardGroup cols={2}>
  <Card title="Search ドキュメント" icon="magnifying-glass" href="/ja/features/search">
    ウェブを検索してページ全体のコンテンツを取得
  </Card>

  <Card title="スクレイピング ドキュメント" icon="file-lines" href="/ja/features/scrape">
    フォーマット、アクション、プロキシなど、スクレイピングのオプションを網羅
  </Card>

  <Card title="Interact ドキュメント" icon="hand-pointer" href="/ja/features/interact">
    クリック、フォーム入力、動的コンテンツの抽出
  </Card>

  <Card title="Node SDK リファレンス" icon="node" href="/ja/sdks/node">
    クロール、map、batch スクレイピング などを含む SDK リファレンス
  </Card>
</CardGroup>
