docs: add guide on building custom extensions - #2106
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new documentation guide that serves as a “map” of Crawlee’s primary extension points (crawlers, HTTP clients, storage clients, and browser plugins), briefly describing when to subclass vs configure and linking to the deeper, existing guides for each contract.
Changes:
- Add
docs/guides/extending_crawlee.mdxwith an overview of extension points and links to the relevant detailed guides/examples. - Include a high-level Mermaid class diagram summarizing the main extensibility surfaces.
- Add a short “Choosing an extension point” decision checklist to help integrators pick the right layer.
Suppressed comments (1)
docs/guides/extending_crawlee.mdx:73
- This section describes
PlaywrightBrowserPluginas the base for browser plugins, but the abstract contract isBrowserPlugin(withPlaywrightBrowserPluginbeing the built-in Playwright implementation). Updating the wording avoids confusion about which class defines the core interface vs which class is the default implementation to configure/subclass.
Subclass a browser plugin when an integration launches browsers through an API other than the standard Playwright one. Configuration options on <ApiLink to="class/PlaywrightBrowserPlugin">`PlaywrightBrowserPlugin`</ApiLink> cover the cases where the standard launch API is enough, so reach for a subclass only when the launch path itself differs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Mantisus
left a comment
There was a problem hiding this comment.
Thanks for the PR and the contribution. The direction is right, but the page needs further refinement.
In its current state the guide doesn't match the documentation style of the project, and that's what most of my comments are about.
A few things that run across the page rather than sitting in one place:
- Sections open with "subclass X when...", so they assume the reader already knows what the component is. Our guides describe the component first, then get to the details.
- Class names are given in prose instead of
ApiLink, which we use everywhere else. - The contracts aren't named anywhere, even though the page description promises them.
- Style details: we use contractions, we don't glue independent clauses with a semicolon, and we avoid both repeating the same opening across parallel list items and using bold to carry meaning.
The rest is inline. I think this needs another pass over the structure rather than line edits, happy to take another look once it's reworked.
|
Thanks for the detailed review — that was exactly the kind of feedback the page needed. Reworked the structure rather than line-editing, as you suggested. Every section now opens with what the component is and what it does, then names its contract, then gets to what you subclass. Point by point: Intro (L9/L11). Now leads with the motivation — the cases where Crawlee doesn't do what you need and forking is the wrong answer — before any mechanics. Dropped the possessive pile-up and the "stable" promise; the third-party paragraph is one sentence and no longer mixes "you" and "your users". "Four extension points" (L15). Reworded to say these are the main ones and explicitly names The diagram (L51). Redrawn to show what the sections actually describe: Crawlers (L59). Starts from Storage clients (L75). Starts with what a storage client is and why swapping it is useful. Contracts. Each section now names its contract explicitly — that was promised in the page description and missing before. Style. Class names go through Verified locally: all 23 |
Mantisus
left a comment
There was a problem hiding this comment.
Thanks for the rework, this is a big step up.
One thing that runs across the page. We don't use a spaced hyphen to join clauses. We split them into separate sentences instead.
Crawlee has four extension points, and each already documents its own contract in the guide that owns it: crawlers in the HTTP crawlers guide, HTTP clients and storage clients in theirs, and browser plugins in the Playwright crawler guide. What was missing is the map: a page that names the extension points, says what each contract covers, and points at the guide that goes deep. That page is also what a third-party integration can link to, which is the case apify#1936 was opened for: the integration hosts its own guide and references a stable statement of the interface it implements. Refs apify#1936
9150dc8 to
1c16751
Compare
|
@Mantisus, thanks for the second pass. I’ve rebased onto the latest Validation is green:
I’ve replied to each of the nine actionable threads. Could you take another look? |
Mantisus
left a comment
There was a problem hiding this comment.
Thanks for the update. It looks good!
Description
Refs #1936. Adds
docs/guides/extending_crawlee.mdx, a page that maps Crawlee's extension points.The four extension points you listed in the issue each already document their own contract in the guide that owns them: crawlers in the HTTP crawlers guide, HTTP clients and storage clients in theirs, and browser plugins in the Playwright crawler guide (#2089). What is still missing is the map, so someone who wants to extend Crawlee has to already know which guide to open, and a third-party project has no single page to point its users at for "here is the interface this integration implements".
This page is that map. For each extension point it states when to subclass rather than configure, names the base class and what its contract covers, and links to the guide that goes deep. It deliberately does not restate those guides.
Contents
AbstractHttpCrawler), HTTP clients (HttpClient), storage clients (StorageClient), and browser plugins (PlaywrightBrowserPlugin), each linking to its detailed guide.Notes
autogeneratedoverdocs/guides).Testing
uv run poe build-docs— build succeeds, the page renders at/docs/next/guides/extending-crawlee, and the build reports no broken links or anchors for it (the broken anchors in the log are pre-existing ones on API pages).http-crawlers,http-clients,storage-clients,playwright-crawler,architecture-overview), theplaywright-crawler-with-camoufoxexample, and each ApiLink class (AbstractHttpCrawler,BasicCrawler,HttpClient,StorageClient,PlaywrightBrowserPlugin,PlaywrightBrowserController,BrowserPool) againstsrc/crawlee/.AI assistance
Written with AI assistance (Claude). The scoping decision was mine to check first what each extension point already documents, which is why this is a map rather than four new sections; the browser-plugin quarter was covered by my earlier #2089.