semver

The semantic version parser and range matcher that powers npm itself.

Library
npm
v7.8.5
5,458stars
ISC

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
71/100Good
Development Activity52
Maintenance52
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
86/100Excellent
Architecture85
Code Quality90
Innovation82
Learning Curve88

semver is the JavaScript implementation of the Semantic Versioning 2.0.0 specification, maintained by the npm CLI team and used internally by npm to parse, validate, compare, and sort package versions. It exposes both a full range-matching engine (tilde, caret, hyphen, and x-ranges) and a collection of small, pure comparison functions that can be imported individually to minimize bundle size.

Beyond the library API, semver ships a standalone command-line tool for validating and incrementing version strings from shell scripts and CI pipelines. Because it underpins version resolution across the entire npm ecosystem, it has become the de facto standard for semver parsing in JavaScript, with hundreds of millions of weekly downloads.

What You Get

  • SemVer, Comparator, and Range classes for structured version and range objects
  • A full set of comparison functions (gt, lt, eq, satisfies, compare, diff, etc.) importable individually
  • Range utilities for max/min satisfying versions, intersection checks, and range simplification
  • A standalone semver CLI binary for shell and CI version comparisons and increments

Common Use Cases

  • Resolving which published version satisfies a dependency’s declared range
  • Validating and normalizing user- or config-supplied version strings
  • Bumping a package’s version programmatically during a release script
  • Sorting a list of tags or releases by semantic precedence

Under The Hood

Architecture semver’s execution flow starts at index.js, which eagerly requires every submodule and re-exports them as a single flat object; a preload.js entry point exists solely to force this eager loading for environments that need pre-warmed regex caches. Parsing centers on classes/semver.js, whose SemVer constructor runs the input string through a single greedy regex (internal/re.js, built from anchored token fragments in internal/constants.js) to populate major/minor/patch/prerelease/build fields, memoizing repeat parses of the same version+options pair via an LRU cache in internal/lrucache.js. Range matching layers classes/range.js (which desugars hyphen, tilde, caret, and x-range syntax into primitive comparator sets) on top of classes/comparator.js (a single operator+SemVer pair), with the ranges/ directory (max-satisfying.js, min-version.js, outside.js, subset.js, etc.) implementing higher-level range algebra by iterating candidate comparators rather than re-parsing strings. Nearly all consumer-facing behavior in functions/ (compare.js, satisfies.js, diff.js, coerce.js, etc.) is a thin wrapper that constructs a SemVer or Range and delegates to its methods, keeping the public API a flat set of pure functions layered over a small, well-isolated OOP core.

Tech Stack semver is dependency-free at runtime — package.json declares zero production dependencies, keeping it safe to install transitively without pulling in an ecosystem. Its devDependencies are entirely tooling: tap for testing (configured in package.json’s tap block with a coverage-map pointing at map.js), @npmcli/eslint-config and @npmcli/template-oss for lint and style enforcement shared across npm’s own packages, and benchmark for the perf suite under benchmarks/. The engines field requires a modern Node.js runtime, and the code is plain CommonJS (require/module.exports) with no build or transpile step — index.js and every submodule ship as-is, and the files field in package.json whitelists exactly the directories published to the registry (bin/, lib/, classes/, functions/, internal/, ranges/).

Code Quality Test coverage is comprehensive and mirrors the source layout 1:1 — test/classes/, test/functions/, test/internal/, and test/ranges/ each contain a file per corresponding source module, plus test/bin/semver.js for the CLI and test/integration/whitespace.js for edge-case regression coverage, all run through tap with an nyc coverage-map (map.js) that excludes tap-snapshots/. Error handling is explicit and typed: the SemVer constructor throws TypeError with descriptive messages (“Invalid Version: …”, version-too-long errors) rather than returning null or undefined, while the top-level functions/ wrappers instead catch and return null for invalid input, giving callers a predictable choice between throw-on-parse and null-on-check semantics. Naming is consistent and short (gt/lt/eq/gte/lte/cmp/rcompare mirror mathematical comparison conventions), internal state is guarded (the LRU cache size is capped via constants in internal/constants.js), and a debug() helper (internal/debug.js) gated behind an environment flag replaces ad hoc console.log calls.

API Design The public API favors small, single-purpose pure functions (gt, lt, satisfies, coerce, diff, inc) that can be required individually straight from functions/ or ranges/ to minimize bundle size, alongside three classes (SemVer, Comparator, Range) for callers who need richer objects — this dual surface lets consumers pick the minimal-footprint or object-oriented style per use case. Naming directly mirrors mathematical and spec vocabulary (gt/lt/gte/lte/eq/neq/cmp) so experienced developers can guess most of the API without reading docs, and the top-level require(‘semver’) convenience export needs zero configuration to produce a working comparison. The README is exhaustive, documenting every range-syntax edge case (hyphen ranges, x-ranges, tilde/caret semantics, prerelease-tag matching rules) with runnable examples for each exported function, and the CLI (semver -h) mirrors the library’s flag names closely, reducing the conceptual gap between scripting and programmatic use.

Used by 106 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
TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript59%
Python39%
Updated today
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
JavaScript
94%
MIT

Another Redis Desktop Manager

Developer Tools · Databases

34,643

Fast, stable Redis GUI with cluster, SSH, and massive key support

View details
84
Repo Health
56
Technical
67
Dependency
Built with
JavaScript94%
Updated yesterday
Go
60%
Apache 2.0

Apache Answer

Community

15,652

Open-source Q&A platform for communities, help centers, and knowledge bases with AI assistant and plugin extensibility

View details
85
Repo Health
78
Technical
69
Dependency
Built with
Go60%
TypeScript36%
Updated 2 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

Search