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

# Deno Deploy

> Use Firecrawl with Deno Deploy to search, scrape, and interact with web data at the edge.

## Prerequisites

* Deno 1.40+ or Deno 2
* A Firecrawl API key — [get one free](https://www.firecrawl.dev/app/api-keys)

## Setup

Create `main.ts`:

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

const firecrawl = new Firecrawl({
  apiKey: Deno.env.get("FIRECRAWL_API_KEY"),
});
```

## Search the web

Add a `/search` route that searches the web and returns results with full page content.

```typescript theme={null}
Deno.serve(async (req) => {
  const url = new URL(req.url);

  if (req.method === "POST" && url.pathname === "/search") {
    const { query } = await req.json();
    const results = await firecrawl.search(query, { limit: 5 });
    return Response.json(results);
  }

  return new Response("Not found", { status: 404 });
});
```

## Scrape a page

Add a `/scrape` route to extract clean markdown from any URL.

```typescript theme={null}
if (req.method === "POST" && url.pathname === "/scrape") {
  const { url: targetUrl } = await req.json();
  const result = await firecrawl.scrape(targetUrl);
  return Response.json(result);
}
```

## Interact with a page

Add an `/interact` route to control a live browser session — click buttons, fill forms, and extract dynamic content.

```typescript theme={null}
if (req.method === "POST" && url.pathname === "/interact") {
  const result = await firecrawl.scrape("https://www.amazon.com", {
    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",
  });
  console.log(response.output);

  await firecrawl.stopInteraction(scrapeId);
  return Response.json({ output: response.output });
}
```

## Run locally

```bash theme={null}
FIRECRAWL_API_KEY=fc-YOUR-API-KEY deno run --allow-net --allow-env main.ts
```

## Deploy

Install the Deno Deploy CLI (`deployctl`) and deploy:

```bash theme={null}
deployctl deploy --project=my-scraper main.ts
```

Set the environment variable in the Deno Deploy dashboard or via CLI:

```bash theme={null}
deployctl env set FIRECRAWL_API_KEY=fc-YOUR-API-KEY --project=my-scraper
```

## Test it

```bash theme={null}
curl -X POST https://my-scraper.deno.dev/search \
  -H "Content-Type: application/json" \
  -d '{"query": "firecrawl 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>
