Documentation Index
Fetch the complete documentation index at: https://firecrawl-mog-search-exclude-include-domains.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Wrangler CLI (
npm install -g wrangler)
- A Firecrawl API key — get one free
Setup
npm create cloudflare@latest my-scraper
cd my-scraper
npm install @mendable/firecrawl-js
Add your API key as a secret:
wrangler secret put FIRECRAWL_API_KEY
Search the web
Create a handler that searches the web and returns results with full page content.
Edit src/index.ts:
import Firecrawl from "@mendable/firecrawl-js";
export interface Env {
FIRECRAWL_API_KEY: string;
}
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const firecrawl = new Firecrawl({ apiKey: env.FIRECRAWL_API_KEY });
const url = new URL(request.url);
if (request.method === "POST" && url.pathname === "/search") {
const { query } = (await request.json()) as { query: string };
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.
if (request.method === "POST" && url.pathname === "/scrape") {
const { url: targetUrl } = (await request.json()) as { url: string };
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.
if (request.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",
});
await firecrawl.stopInteraction(scrapeId);
return Response.json({ output: response.output });
}
Deploy
Test it
curl -X POST https://my-scraper.<your-subdomain>.workers.dev/search \
-H "Content-Type: application/json" \
-d '{"query": "firecrawl web scraping"}'
Next steps
Search docs
Search the web and get full page content
Scrape docs
All scrape options including formats, actions, and proxies
Interact docs
Click, fill forms, and extract dynamic content
Node SDK reference
Full SDK reference with crawl, map, batch scrape, and more