Cheerio

The fast, flexible library for parsing and manipulating HTML and XML with a familiar jQuery-style API.

Library
npm
v1.2.0
30,455stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
90/100Excellent
Development Activity100
Maintenance84
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
89/100Excellent
Architecture92
Code Quality90
Innovation85
Learning Curve90

Cheerio implements a subset of core jQuery designed specifically for the server, giving Node.js and browser developers a familiar, expressive API for parsing, traversing, and manipulating HTML and XML documents without the overhead of a full browser environment. It wraps parse5 for spec-compliant parsing (with an optional forgiving htmlparser2 mode) and operates directly against a lightweight DOM model, making it dramatically faster than driving a real browser or headless DOM implementation for the same job.

Widely used as the parsing layer inside web scrapers, static site generators, RSS/feed processors, and server-side rendering pipelines, Cheerio is a foundational dependency across the JavaScript scraping and content-processing ecosystem. Version 1.x ships full TypeScript types, dual ESM/CommonJS builds, and a slim entry point for bundle-size-sensitive environments.

What You Get

  • A cheerio.load() entry point that parses an HTML or XML string into a queryable, mutable document
  • A jQuery-compatible subset of selector, traversal, and manipulation methods (.find(), .attr(), .text(), .html(), .css(), .each(), and more)
  • Pluggable parsing backends — the spec-compliant parse5 parser by default, or the forgiving, faster htmlparser2 parser via the xmlMode and parser options
  • First-class TypeScript types, dual ESM/CommonJS builds, and a cheerio/slim entry point for smaller bundles

Common Use Cases

  • Scraping and extracting structured data from HTML pages fetched via fetch, undici, or another HTTP client
  • Server-side templating and post-processing of HTML output before it’s sent to the client
  • Parsing RSS/Atom feeds or other XML documents with xmlMode enabled
  • Asserting against rendered HTML output in unit and integration tests

Under The Hood

Architecture Cheerio’s execution flow begins in src/load.ts, which normalizes CheerioOptions (src/options.ts) and hands the input HTML/XML string to a pluggable parser via src/parsers/parse5-adapter.ts (or htmlparser2 directly in xmlMode), producing a domhandler-based node tree. That tree is wrapped by src/cheerio.ts’s abstract Cheerio class, which mixes in six method modules — src/api/traversing.ts, manipulation.ts, attributes.ts, css.ts, forms.ts, and extract.ts — via a MethodsType intersection, so the public $ object is a static factory (src/static.ts) plus this composed instance prototype. Serialization back to a string goes through dom-serializer, and selector matching is delegated to the separate cheerio-select package (itself built on css-select), keeping selection, DOM representation, and rendering as cleanly separated concerns.

Tech Stack Cheerio is TypeScript-first, targeting ES2019 with Node16 module resolution per tsconfig.json, and depends on a small, well-factored set of single-purpose packages: parse5 plus parse5-htmlparser2-tree-adapter/parse5-parser-stream for spec-compliant parsing, htmlparser2 for the forgiving fallback, domhandler/domutils/dom-serializer for the DOM model, cheerio-select for CSS selector matching, encoding-sniffer and whatwg-mimetype for charset/MIME detection, and undici for the optional fromURL HTTP fetch. Builds are produced as dual ESM/CommonJS output (dist/esm, dist/commonjs) via the package.json exports map, with a browser-specific entry (index-browser.mts) and a dependency-light cheerio/slim build for bundle-conscious consumers.

Code Quality The src tree pairs nearly every module with a co-located .spec.ts file (14 spec files covering cheerio.ts, load.ts, parse.ts, options.ts, static.ts, utils.ts, and each src/api/.ts module), run via Vitest per vitest.config.ts, with Biome (biome.json) and an ESLint flat config (eslint.config.js) enforcing style. Public methods carry structured TSDoc comments with @example blocks (visible throughout src/load.ts and src/cheerio.ts), strict TypeScript is enabled project-wide (strict: true, isolatedDeclarations: true in tsconfig.json), and the project publishes a SECURITY.md/THREAT_MODEL.md/INCIDENT_RESPONSE.md trio — an unusually mature process footprint for a library of its size.

API Design Cheerio’s headline design choice is deliberately mirroring jQuery’s $(selector) API, so anyone with browser-jQuery experience is productive immediately — cheerio.load(html) returns a bound $ with .find(), .attr(), .text(), .css(), .each(), and more. Getting started requires only one line (const $ = cheerio.load(html)) with no configuration, while power users can opt into xmlMode, a custom parser, or the cheerio/slim build without touching core call sites — a low floor for beginners paired with enough surface area across six method modules for advanced DOM manipulation without boilerplate.

Used by 43 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

64,914

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
91
Repo Health
78
Technical
68
Dependency
Built with
JavaScript95%
Updated today
TypeScript
49%
MPL 2.0

Artillery

Devops · Developer Tools

9,054

Cloud-scale load testing and functional testing for APIs, WebSockets, gRPC, and headless browsers, distributed across AWS Lambda or Fargate with zero infrastructure to manage.

View details
89
Repo Health
73
Technical
68
Dependency
Built with
TypeScript49%
JavaScript48%
Updated 5 days ago
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,872

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
95
Repo Health
82
Technical
66
Dependency
Built with
TypeScript100%
Updated yesterday
TypeScript
69%
Other

Budibase

Low Code Platforms · No Code Platforms

28,220

Build AI agents, automations, and internal apps on a single open-source platform with full self-hosting control.

View details
92
Repo Health
81
Technical
63
Dependency
Built with
TypeScript69%
Svelte26%
Updated today
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

50,753

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
88
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
Java
48%
Apache 2.0

ClearFlask

Product Management · Community

448

Open-source feedback management and roadmap tool that lets product teams collect, prioritize, and respond to user input — with AI-powered summarization and full self-hosting control.

View details
83
Repo Health
73
Technical
63
Dependency
Built with
Java48%
TypeScript47%
Updated 2 weeks ago
TypeScript
97%
Apache 2.0

Cline

AI Code Assistants

66,453

An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.

View details
90
Repo Health
74
Technical
67
Dependency
Built with
TypeScript97%
Updated today
TypeScript
84%
Apache 2.0

Continue

Developer Tools · AI Development · AI Code Assistants

35,532

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
87
Repo Health
88
Technical
65
Dependency
Built with
TypeScript84%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search