npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ecocode

v1.4.2

Published

GreenCode CLI — measure the real energy & CO2 impact of your code (static analysis + real CPU profiling).

Readme

GreenCode CLI (ecocode)

Measure the real energy & CO₂ impact of your code — right from the terminal.

GreenCode gives your codebase an energy class (A–G), like a home appliance, and can actually run your code to measure real CPU energy (mWh) and estimated CO₂.

npx ecocode@latest analyze

No install needed — npx runs the latest version.


Commands

analyze — static estimate of the whole folder (no setup)

Scans the current folder (AST), rates it A–G, and generates an online report.

npx ecocode@latest analyze
npx ecocode@latest analyze --max-files 50

profile <file> — real measurement of ONE file (no setup)

Actually executes a file and measures real user/system CPU → energy (mWh) and CO₂.

npx ecocode@latest profile ./dist/index.js

profile-project — real measurement of the WHOLE project (needs a config)

Runs several real scenarios of your project, each with a weight, and returns a weighted energy KPI for the whole codebase.

npx ecocode@latest init            # creates a starter ecocode.profile.json
# edit the scenarios to point at your real entrypoints, then:
npx ecocode@latest profile-project

Why does profile-project need ecocode.profile.json?

Because it measures real energy by actually running code — and only you know which files represent your app and how much each matters. You declare that once:

{
  "repeat": 3,
  "scenarios": [
    { "name": "API startup", "file": "./dist/server.js", "weight": 3 },
    { "name": "Daily batch", "file": "./dist/jobs/daily.js", "weight": 1 }
  ]
}
  • file — a runnable entrypoint (.js / .mjs / .cjs).
  • weight — how much that flow matters in real usage (higher counts more in the average).
  • repeat — runs per scenario (more runs = less noise).

analyze and profile <file> need no config and work anywhere. Only the weighted whole-project measurement needs the JSON. Run ecocode init to scaffold it.


How energy is estimated

From the real measured CPU time:

Energy_mWh = (CPU_Time_ms × Standard_CPU_Wattage) / 3600

Defaults: Standard CPU power 65 W, grid carbon intensity 442 gCO₂e/kWh. These are transparent model constants (shown in the output), so the numbers are best used for relative comparisons (before/after an optimization) as well as absolute estimates.

Safety

profile and profile-project run code locally. Only profile files you trust.

Links

  • Web app & full docs: https://green-code-swart.vercel.app