Cheerio

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

Library
npm
v1.2.0
30,505 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
90 /100 Excellent
Development Activity 100
Maintenance 84
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
89 /100 Excellent
Architecture 92
Code Quality 90
Innovation 85
Learning Curve 90

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 45 apps in this directory

TypeScript
100%
Other

Activepieces

AI Assistants · Automation · Mcp

24,756

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
64
Dependency
Built with
TypeScript 100%
Updated 4 days ago
Go
59%
Apache 2.0

agent-orchestrator

AI Agents · AI Code Assistants · Developer Tools

12,440

A local desktop workspace that gives every coding task its own agent, Git branch, and worktree, then tracks tasks, pull requests, CI, and reviews for 27 coding agents on one live Kanban board.

View details
86
Repo Health
83
Technical
68
Dependency
Built with
Go 59%
TypeScript 38%
Updated 4 days ago
JavaScript
95%
MIT

AnythingLLM

AI Assistants · Automation · Developer Tools

66,533

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

View details
90
Repo Health
78
Technical
64
Dependency
Built with
JavaScript 95%
Updated 6 days ago
TypeScript
49%
MPL 2.0

Artillery

Developer Tools · Devops

9,083

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
TypeScript 49%
JavaScript 48%
Updated 1 weeks ago
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,924

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
94
Repo Health
82
Technical
64
Dependency
Built with
TypeScript 100%
Updated 1 weeks ago
TypeScript
70%
Other

Budibase

Low Code Platforms · No Code Platforms

28,324

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

View details
91
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 70%
Svelte 26%
Updated 1 weeks ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

52,202

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

View details
89
Repo Health
84
Technical
70
Dependency
Built with
TypeScript 99%
Updated 4 days ago
Java
48%
Apache 2.0

ClearFlask

Community · Product Management

451

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
62
Dependency
Built with
Java 48%
TypeScript 47%
Updated 6 days ago
TypeScript
98%
Apache 2.0

Cline

AI Code Assistants

69,455

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
65
Dependency
Built with
TypeScript 98%
Updated 4 days ago

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