Firecrawl: an engine waterfall for turning any URL into LLM-ready data

November 18, 2026

|repo-review

by Florian Narr

Firecrawl: an engine waterfall for turning any URL into LLM-ready data

Firecrawl is a TypeScript API that takes a URL and returns markdown, HTML, screenshots or LLM-extracted JSON. It also crawls whole sites, maps them via sitemaps, and searches the web. The repo sits at roughly 212k stars.

Why I starred it

Every agent project I see ends up with the same ugly module: a fetch, a headless browser fallback, a PDF parser, a regex pile to strip nav bars. Firecrawl is that module, productised, with a monorepo behind it. I wanted to see how the fallback logic is actually built, because "try fetch, then Playwright" is the easy 80% and everything interesting is in the other 20%.

I shallow-cloned it and stayed on the scrape path in apps/api. The last commits (at the time of writing) touch CI tokens, dead TeamFlags fields and a refactor to share one Rust core between the Node addon and the local build. This is a moving target, with several merges a day.

How it works

The scrape entry point is apps/api/src/scraper/scrapeURL/index.ts, a 2000-line file. The README.md in that folder still describes a simple flow: build a fallback list, run an engine, parse markdown, check whether it worked, and try the next engine if not. The code has outgrown that diagram, but the shape holds.

The engines are declared as static metadata in engines/metadata.ts. No imports from config or Redis, so the service can describe itself cheaply:

{
  name: "playwright",
  quality: 20,
  features: { waitFor: true, skipTlsVerification: true },
  method: "scrapeURLWithPlaywright",
},
{
  name: "fetch",
  quality: 5,
  features: { skipTlsVerification: true, useFastMode: true },
  method: "scrapeURLWithFetch",
},
{ name: "pdf", quality: -20, fileOnly: true, ... }

The request is turned into a set of feature flags (actions, screenshot, waitFor, stealthProxy, pdf, ...), and each flag has a priority weight: waitFor is 1, screenshot is 10, actions and stealthProxy are 20, pdf and document are 100.

The selection in selectFallbackList (engines/index.ts:311) is a small scoring system. Sum the priorities of all requested flags, halve it, and drop every engine whose supported-flag score falls below that threshold:

const priorityThreshold = Math.floor(prioritySum / 2);
...
if (supportScore >= priorityThreshold) {
  selectedEngines.push({ engine, supportScore, unsupportedFeatures });
}

Then it sorts by support score, with quality as tie-breaker. So a plain scrape gets playwright first and fetch behind it, while a request with actions (weight 20) knocks out fetch entirely. A PDF flag at 100 swamps everything else and leaves only the file engines. It's a majority-vote threshold, not a hard capability match, which is why engines that miss a flag stay in the list and carry an unsupportedFeatures set. That set becomes a warning on the response ("may be partial") instead of a failure.

Two details I liked. First, the stealthProxy flag is only scored when a candidate engine actually uses a stealth proxy. The comment explains why: counting it otherwise "would narrow an HTML scrape down to file parsers." Second, the quality > 0 filter: if any real engine survives, the negative-quality file parsers get dropped, so an HTML page never gets handed to the PDF engine as a last resort.

The waterfall itself lives in scrapeURLLoop (index.ts:938). It doesn't run engines strictly in sequence. It can race them: the loop keeps earlier engine promises in flight while it starts the next one (the comment at index.ts:1237 literally says "just keep racing"). Control flow is by exception. WaterfallNextEngineSignal means "start the next one now", while AddFeatureError and RemoveFeatureError restart the selection with a changed flag set. Those errors are rethrown out of the engine loop so the feature set can change and the list gets rebuilt; I did not trace every producer of them.

Policy runs inside the same filter. isEngineAllowedByPolicy rejects the Wikipedia engine for zero-data-retention scrapes, and refuses any non-profile-aware engine when the request carries an authenticated browser profile. The reasoning in the comment is the right one: a profile must never silently fall back to anonymous content.

The Rust core

The parts that run on every page moved to Rust: apps/api/native/crates/firecrawl-core. It's about 2.5k lines, built on kuchikiki for HTML, roxmltree for sitemaps and texting_robots for robots.txt. html.rs holds transform_html, extract_metadata and extract_links. crawler.rs holds filter_links, which applies include/exclude regexes, robots rules and crawl scope to every discovered link, and returns a map of denial reasons per URL. That map is a nice touch: when a crawl skips a page you can ask why.

The binding goes through napi, and a recent commit (refactor(native)) shares the crate between the Node addon and the self-hosted build.

Using it

The hosted API is one POST:

curl -X POST https://api.firecrawl.dev/v2/scrape \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "formats": ["markdown", "screenshot"]}'

There are SDKs (the repo contains a .NET one with NuGet trusted publishing, so the surface is wide), a CLI under firecrawl-cli/, and agent skills under skills/. Self-hosting goes through docker-compose.yaml and SELF_HOST.md.

Rough edges

  • License. The core is AGPL-3.0; SDKs and some UI are MIT. If you want to embed the server in a closed product, that matters.
  • Self-hosted is not the product. The Playwright engine is only enabled when PLAYWRIGHT_MICROSERVICE_URL is set (engines/index.ts, coreEngineRuntime.playwright.enabled). Without it you are on fetch, and the Wikipedia engine needs enterprise credentials in config.
  • Size. scrapeURL/index.ts is over 2000 lines, and the loop at :938 has many exception branches. The README in that folder is stale (it still mentions LlamaParse and "WebScraperDataProvider"). I traced the real behaviour from the code, not from the doc.
  • Tests. There are 163 test files in apps/api, but I did not run any. They need Redis and other services, and I didn't install anything from an untrusted clone.
  • Churn. Dead feature flags get removed every few days (browserBeta, researchBeta). The internal API moves quickly, so pin versions if you fork.

Bottom line

Use the hosted API if your agent needs clean page content and you don't want to run browsers. Read engines/metadata.ts and selectFallbackList if you're building your own fallback chain: the weighted threshold with a quality tie-break is a compact idea worth copying.

firecrawl/firecrawl on GitHub
firecrawl/firecrawl