Elestia Open Source Ratings
6.5

cosmiconfig

Reasonable, with limits. 7th of 9 config and environment variables.

cosmiconfig finds and loads a tool's config file from package.json, rc files, JSON, YAML, JS or TypeScript. It is a mature, safe choice for authors of CLIs and dev tools. It does not handle env vars, secrets or validation, so it is not the right pick for loading an app's own settings, and its share is shrinking as c12 and lilconfig gain ground.

Best for: Authors of CLIs and dev tools who want users to configure the tool in any of the usual rc and config-file places.

GitHubnpm

Scores

Overall6.5

How strongly do we recommend it for a new project today?

Claude Opus 5.5: 5.5, likely 4.5 to 6.5

It is a solid, safe config-file finder for tool authors and still gets updates. For this category's job of loading app settings and secrets and checking them, it covers only file discovery: no env vars, no validation. In its own niche, c12 offers more and grows faster, and lilconfig is lighter. So it is a reasonable but limited choice today.

GPT-6.2 Sol: 7.5, likely 6.3 to 8.5

Cosmiconfig is a strong new-project choice for conventional config discovery in a Node.js CLI, with a small API and evidence from active downstream tools. c12 offers more for apps that need environment-specific layers and live reload, while T3 Env fits teams whose main need is validated environment variables. The newer Node requirement, concentrated release work, and below-median download growth temper the two-year outlook.

Needed by many4.1

How many developers need a tool for this job?

Claude Opus 5.5: 4.0, likely 3.0 to 5.0

Its job is finding config files for CLIs and dev tools, which is a clear niche within this category. Most app developers here need env vars and validation instead. Many developers run it without knowing it, but few choose it directly.

  • github description: Finds and loads config from package.json, rc files and TS modules: a tool-config job
  • dependents.packages: 3,392 packages depend on it, mostly tools that read user config
  • github.com/cosmiconfig/cosmiconfig/blob/main/CHANGELOG.md: Features are about file search and loading, not env or validation

GPT-6.2 Sol: 4.2, likely 3.1 to 5.4

Config discovery matters across Node.js tooling, especially for CLIs, linters, and generators that let users choose how to configure them. Applications that mainly need deployment settings, validated environment variables, or secrets have less reason to choose it. Adoption by several tools establishes the use case, but the share of developers who need to build that capability is hard to measure.

Helps a lot7.1

How well does it do the job for those who need it?

Claude Opus 5.5: 6.5, likely 5.5 to 7.5

It finds and loads files well. It supports many formats, caching, transforms, $import for config inheritance, and global OS config folders. v10 dropped heavy dependencies and loads TypeScript natively, but it gave up compiled TS syntax and needs a recent Node. It has no watching or env layering like c12, and no validation, so it does only part of the category's job.

GPT-6.2 Sol: 7.6, likely 6.4 to 8.6

The typed search and load API is easy to follow, supports custom loaders, and finds common config formats with little setup. The parsed config is typed as any, and the README still cites Node 14 even though the package requires a newer runtime. A user-reported global search hang remains in v10.0.1. One independent c12 comparison found mixed performance by format, but mostly used Node versions outside cosmiconfig's supported range.

Holds up over time6.4

Will it still be a good choice in two years?

Claude Opus 5.5: 6.0, likely 5.0 to 7.0

It is still maintained: 35 commits and 3 releases in the past year, including a new major version (v10) in August 2026. A small group of maintainers does the work, with no visible funding, and some issues have been open for years. Two breaking majors in a short time and some tools moving to lilconfig or c12 add risk.

GPT-6.2 Sol: 6.8, likely 5.5 to 7.8

The project shipped three GitHub releases and made 35 commits in the past year, including a major update and a dependency security patch. A reported search bug got a merged fix in about three weeks, and that fix is still awaiting a release. One maintainer handled the recent releases, and the higher Node minimum and TypeScript changes create upgrade work. The project lists GitHub Sponsors, but the level of funding and depth of backup maintenance are unclear.

Used widely6.4

How many use it, and is that growing?

Claude Opus 5.5: 6.0, likely 5.0 to 7.5

Its raw numbers are huge: 692M downloads in 4 weeks and 3.5M dependent repos. Almost all of that comes from dev tools that install it, not from people choosing it. Its growth ratio is 2.2, well below the 4.1 median, so it is losing ground, while c12 grew 5.7x. About 3,400 packages choose it directly, which is still a lot for a library aimed at tool authors.

  • npm downloadsLast4Weeks / downloadsSame4WeeksYearAgo: 692M vs 316M, ratio 2.19, below the 4.1 median
  • dependents.repos: 3.5M repos, mostly through other tools
  • peers c12 downloads: c12 grew from 28M to 158M, gaining share in the same niche
  • bluesky posts: Only 1 post in 24 months: little direct attention

GPT-6.2 Sol: 6.8, likely 5.1 to 8.4

About 692 million four-week downloads and 3.5 million reported dependent repositories show a large installed footprint. The 3,392 reported dependent packages and 4,172 stars also point to substantial use, but installs through tools such as Stylelint and commitlint make direct choices hard to estimate. Downloads rose 2.19 times year over year, below both the catalog median of 4.1 and c12's 5.66, so cosmiconfig lost ground on the catalog measure. One Bluesky post and zero matched Hacker News stories provide little evidence about new adoption.

  • evidence.npm.downloadsLast4Weeks, evidence.npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 692.4 million versus 316.4 million, for a 2.19 ratio against the 4.1 median.
  • evidence.dependents: 3,498,872 reported repositories and 3,392 reported packages.
  • evidence.github.stars, evidence.bluesky.posts, evidence.hackerNews.stories: 4,172 stars, one Bluesky post, and zero matched Hacker News stories.
  • peers: c12 grew 5.66 times, and dotenv had more downloads and stars.
  • github.com/stylelint/stylelint/blob/18.1.0/package.json: Stylelint installs cosmiconfig as a dependency.
  • commitlint.js.org/reference/configuration.html: Commitlint uses cosmiconfig for discovery.
Vouched for7.1

Who stands behind it being good?

Claude Opus 5.5: 6.0, likely 4.5 to 7.0

Widely used tools such as commitlint, stylelint, svgo and ts-jest have used it in production for years, which counts as real validation. It has no recent independent write-ups or survey data, and some well-known tools have moved to lilconfig. The evidence is mostly the list of who depends on it.

  • dependent tools: Used by commitlint, stylelint, svgo, ts-jest and similar tools
  • npmjs.com/package/cosmiconfig-typescript-loader: Separate TS loader package with millions of weekly downloads shows its ecosystem
  • hackerNews stories: No HN stories, so no independent discussion

GPT-6.2 Sol: 8.1, likely 6.9 to 8.9

Stylelint 18.1 ships with cosmiconfig v10, and commitlint and GraphQL Code Generator document relying on it for configuration discovery. These integrations show that the API works for real tools with different users and config conventions. Version-specific evidence beyond Stylelint is thinner, and the State of JavaScript survey offers no cosmiconfig satisfaction measure.

Safe7.5

How safe is it to depend on?

Claude Opus 5.5: 7.5, likely 6.5 to 8.5

It has no advisories ever, an MIT licence and only 2 runtime dependencies after v10. The OpenSSF Scorecard is 5, with weak code review, unpinned dependencies and no security policy. Its very wide install base makes it a target for supply-chain attacks, but it has had no incident.

GPT-6.2 Sol: 7.4, likely 6.1 to 8.4

The MIT package has two direct dependencies and zero listed OSV advisories of its own. v10.0.1 adopted a js-yaml security fix four days after the upstream patch, and the maintainer enabled private vulnerability reporting on the day it was requested. The OpenSSF Scorecard is 5 out of 10, with weak code review, unpinned workflow dependencies, and no public security policy. Two npm maintainers are listed, recent releases came from one of them, and the signed GitHub tag leaves npm build provenance uncertain.

Good

  • It searches the usual places (a package.json key, .toolrc, the .config/ folder, *.config.js/ts/mjs/cjs) with one call.
  • v10 loads TypeScript config through Node's type stripping and has only 2 runtime dependencies.
  • It has no known advisories in its 11-year history and uses the MIT licence.
  • The API is stable and widely known, and many tools use it, so AI agents write correct code for it easily.

Bad

  • It does not load env vars or secrets and does not validate the config against a schema.
  • v10 requires Node ^22.18 or >=24, and its TypeScript loading rejects enums and namespaces.
  • v9 stopped searching parent directories by default, which broke setups that relied on the old search.
  • Several feature requests from 2018 to 2023 are still open, including slow searches in large repos and TOML support.

The numbers

npm downloads, 4 weeks
692M ×2.2 in a year
GitHub stars
4.2k
Commits, 12 months
35
npm version
10.0.1 Aug 2026
Versions, 12 months
4
Advisories, 24 months
0 of 0 ever
OpenSSF Scorecard
5.0 out of 10, Nov 2026
Licence
MIT

Read on 21 November 2026 from GitHub (cosmiconfig/cosmiconfig), npm (cosmiconfig), OSV and the OpenSSF Scorecard.

Config and environment variables

  1. 7.5Varlock
  2. 7.2T3 Env
  3. 7.0dotenvx
  4. 7.0c12
  5. 6.8dotenv
  6. 6.6envalid
  7. 6.5cosmiconfig
  8. 5.9node-config
  9. 4.6convict
Compare all 9 on six scores