Files
firecrawl/CONTRIBUTING.md
Gergő Móriczandcapy-ai[bot] 7605448d5f ci(api): run the core unit tests on every pull request (#5782)
* ci(api): run the core unit tests on every pull request

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* ci(api): build the native lib without running dependency install scripts

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(api): bring stale unit tests in line with the code they cover

These tests ran in no workflow, so they drifted from the code:

- generateURLPermutations returns unique URLs, so a root URL has 12 permutations, not 16.
- The section-link check moved into the native link filter; the test now reaches it through filterURL.
- Google Docs and Slides URLs are rewritten to the HTML export, not PDF.
- getEngineForUrl returns undefined before initialization; it never threw.

One engine forcing case is skipped: a wildcard pattern also matches the base domain, which ENGINE_FORCING.md says it must not.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(api): ignore empty image sources when extracting images

An empty src, data-src, poster, content or href resolved against the page URL, so the page itself was listed as an image. Lazy-loading placeholders commonly use an empty src. The extractImages unit test already expects them to be ignored.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* ci(api): drop the named step for tests the core job runs

src/lib/error-serde.test.ts and src/controllers/v2/__tests__/crawl-errors.test.ts are part of the core unit test suite, so the Server Test Suite no longer needs a step that names them.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* ci(api): key the native and Go library caches on every build input

The native key now includes Cargo.lock, build.rs and .cargo/config.toml, and the Go key includes go.mod, so a change to any of them rebuilds the library instead of restoring an older one. Both workflows use the same keys and keep sharing the caches.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(api): open no Redis connection when the core suite imports a module

Several modules create a Redis client on import. In the core suite those clients now connect on first use, so the suite attempts no connection unless a test issues a command.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-11-17 00:55:11 +01:00

3.5 KiB

Contributing to Firecrawl

Thanks for helping make Firecrawl better. Keep each change focused, prove the behavior you changed, and make the pull request easy to review.

Choose the right workflow

If you want to Start here
Change the API, workers, or tests Run Firecrawl locally for development
Run Firecrawl on your own infrastructure without changing product code Self-hosting Firecrawl
Change an SDK The matching directory under apps/ and its package scripts
Improve the public documentation The firecrawl-docs repository

Local development and self-hosting are different paths. Development uses the API harness and apps/api/.env; the Docker Compose deployment uses the root configuration. Do not copy one environment file into the other.

Set up API development

The public Running Locally guide is the canonical first-success path. It covers Node.js 22, pnpm 11.4.0, Redis, the harness-managed PostgreSQL and RabbitMQ containers, and a verified local scrape.

The source-owned commands live in apps/api/package.json. From apps/api:

pnpm install
pnpm start

pnpm start builds Firecrawl and launches the API, workers, and local dependency containers. Keep Redis running separately as described in the public guide.

Make a focused change

  1. Fork the repository and create a branch whose name describes the change.
  2. Reproduce the current behavior before editing.
  3. Add or update coverage for the successful path and relevant failures.
  4. Make the smallest change that satisfies those tests.
  5. Run the narrowest useful checks before opening a pull request.

For API changes, prefer end-to-end snippet coverage when the behavior crosses routes, workers, queues, or scraping engines.

Run API tests with the harness

From apps/api, run the snippet suites with their dependencies:

pnpm harness pnpm test:snips

For a narrower test, pass the relevant Vitest path through the same harness:

pnpm harness pnpm exec vitest run path/to/test.ts

The harness starts the API, workers, PostgreSQL, and RabbitMQ for the command, then cleans up the processes and containers it started.

Run the core unit tests

Unit tests that need no credentials and no running services form the core suite. From apps/api:

pnpm test:core

The suite runs every src/**/*.test.ts file that vitest.core.config.ts does not exclude, so a new unit test joins it without being registered. CI runs it on every pull request.

Do not bypass failing checks. Fix failures caused by your change and call out unrelated repository failures with enough detail for a reviewer to reproduce them.

Open the pull request

Include:

  • why the change is needed;
  • what behavior changed;
  • the exact tests or checks you ran;
  • any configuration, migration, security, or deployment impact; and
  • screenshots or request/response evidence when they make the result easier to verify.

Keep credentials, local environment files, raw user data, and generated secrets out of commits and pull requests.

Get help

Use GitHub issues for reproducible bugs and feature discussions. For community help, join the Firecrawl Discord.