DOMPurify
Fast XSS sanitizer for HTML, MathML and SVG protecting against injection attacks.
Auth and security libraries npm (MPL-2.0 OR Apache-2.0)
Used in agent projects
96
0.8% of 12,697 public repos built with AI coding agents
Rank in auth and security libraries
#12 of 47
by use in those projects
Downloads
70.4M
npm, last 7 days, dompurify
GitHub stars
17.5K
last push Oct 10, 2026
How DOMPurify is used
DOMPurify is a dependency in 96 of the 12,697 public GitHub projects set up for AI coding agents that we scanned (0.8%), #12 of 47 in auth and security libraries. The most used alternative there is NextAuth.js. Projects that use it most often also use Vitest (47.9%), Playwright (JavaScript) (42.7%), jsdom (42.7%). It is more common in projects set up for Kiro (4.8%) than for GitHub Copilot (1.3%).
Often used with DOMPurify
| Vitest | 47.9% of DOMPurify projects · 3.9× more than average |
|---|---|
| Playwright (JavaScript) | 42.7% of DOMPurify projects · 4.9× more than average |
| jsdom | 42.7% of DOMPurify projects · 8.0× more than average |
| Tailwind CSS | 77.1% of DOMPurify projects · 2.2× more than average |
| ESLint | 78.1% of DOMPurify projects · 2.1× more than average |
| Testing Library | 39.6% of DOMPurify projects · 5.5× more than average |
| Vite | 60.4% of DOMPurify projects · 2.6× more than average |
| React | 82.3% of DOMPurify projects · 1.9× more than average |
By coding agent
| Claude Code | 1.5% of projects set up for it |
|---|---|
| GitHub Copilot | 1.3% of projects set up for it |
| Cursor | 1.5% of projects set up for it |
| Gemini CLI | 2.1% of projects set up for it |
| OpenAI Codex | 1.8% of projects set up for it |
| Kiro | 4.8% of projects set up for it |
| OpenCode | 2.2% of projects set up for it |
| Devin Desktop | 2.6% of projects set up for it |
Share of public repos configured for each agent that list DOMPurify as a dependency.
Install
| Package | npm install dompurify |
|---|---|
| Main stacks | TypeScript / JavaScript (53), Next.js (31), Python (5), PHP (4) |
| Example projects | crbnos/carbon, Doist/todoist-mcp, zkoss/zk, JNTMTMTM/eIsland, blopa/Resume-Builder |
Alternatives to DOMPurify
| Tool | Used in agent projects | Downloads / wk | GitHub stars | License |
|---|---|---|---|---|
| NextAuth.js npm Complete open-source authentication solution designed for Next.js applications. |
266 (2.1%) | 6.7M | 28.4K | ISC |
| bcryptjs npm Pure JavaScript bcrypt implementation for secure password hashing without dependencies. |
256 (2.0%) | 14.7M | 3,797 | BSD-3-Clause |
| jsonwebtoken npm Create, verify and decode JSON Web Tokens for authentication and secure data transmission. |
241 (1.9%) | 59.3M | 18.2K | MIT |
| cryptography pypi Python library providing cryptographic recipes and primitives for secure applications. |
213 (1.7%) | 281M | 7,803 | — |
| jose npm Comprehensive JWT and JWK handling for Node.js and web runtimes. |
141 (1.1%) | 151M | 7,824 | MIT |
| PyJWT pypi Python library for encoding and decoding JSON Web Tokens. |
128 (1.0%) | 154M | 5,714 | — |
| Better Auth npm Comprehensive authentication framework for TypeScript with multiple strategies. |
126 (1.0%) | 11.4M | 30.2K | MIT |
| Helmet npm Express middleware that sets HTTP security headers to prevent vulnerabilities. |
125 (1.0%) | 16.2M | 10.7K | MIT |