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

# Hono

> Firecrawl を Hono と組み合わせて、あらゆる環境で動作する軽量な Web スクレイピング API と検索 API を構築します。

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

* Node.js 18+、Bun、または Deno
* Firecrawl APIキー — [無料で取得できます](https://www.firecrawl.dev/app/api-keys)

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

```bash theme={null}
npm install hono firecrawl
```

`.env` に APIキーを追加します:

```bash theme={null}
FIRECRAWL_API_KEY=fc-YOUR-API-KEY
```

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

```typescript theme={null}
import { Hono } from "hono";
import { Firecrawl } from "firecrawl";

const app = new Hono();
const firecrawl = new Firecrawl({ apiKey: process.env.FIRECRAWL_API_KEY });

app.post("/search", async (c) => {
  const { query } = await c.req.json();
  const results = await firecrawl.search(query, { limit: 5 });
  return c.json(results);
});

export default app;
```

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

```typescript theme={null}
app.post("/scrape", async (c) => {
  const { url } = await c.req.json();
  const result = await firecrawl.scrape(url);
  return c.json(result);
});
```

<div id="interact-with-a-page">
  ## ページを Interact で操作する
</div>

Interact を使うと、ライブのブラウザセッションを操作して、ボタンのクリック、フォーム入力、動的コンテンツの抽出を行えます。

```typescript theme={null}
app.post("/interact", async (c) => {
  const { url } = await c.req.json();

  const result = await firecrawl.scrape(url, { formats: ['markdown'] });
  const scrapeId = result.metadata?.scrapeId;

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

  await firecrawl.stopInteraction(scrapeId);

  return c.json({ output: response.output });
});
```

<div id="deploy-anywhere">
  ## どこでもデプロイ可能
</div>

Hono は複数のランタイムで動作します。Cloudflare Workers では、環境バインディングから APIキーを渡します。

```typescript theme={null}
import { Hono } from "hono";
import { Firecrawl } from "firecrawl";

type Bindings = { FIRECRAWL_API_KEY: string };
const app = new Hono<{ Bindings: Bindings }>();

app.post("/search", async (c) => {
  const firecrawl = new Firecrawl({ apiKey: c.env.FIRECRAWL_API_KEY });
  const { query } = await c.req.json();
  const results = await firecrawl.search(query, { limit: 5 });
  return c.json(results);
});

export default app;
```

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

<CardGroup cols={2}>
  <Card title="スクレイピングのドキュメント" icon="file-lines" href="/ja/features/scrape">
    フォーマット、アクション、プロキシを含むスクレイピングのオプション一覧
  </Card>

  <Card title="検索ドキュメント" icon="magnifying-glass" href="/ja/features/search">
    Webを検索してページ全体のコンテンツを取得
  </Card>

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

  <Card title="Node SDK リファレンス" icon="node" href="/ja/sdks/node">
    クロール、map、バッチスクレイプなどを含むSDKの完全なリファレンス
  </Card>
</CardGroup>
