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

zerocarbon-quickstart

v1.0.0

Published

5-minute quickstart for ZeroCarbon API - Calculate carbon emissions instantly

Readme

ZeroCarbon API - 5 Minute Quickstart

Get your first carbon footprint calculation in under 5 minutes. No signup required for testing.

🚀 One-Line Demos

Option 1: Node.js (Fastest)

npx zerocarbon-quickstart

Option 2: Python

pip install zerocarbon && python -m zerocarbon.quickstart

Option 3: cURL (Zero Installation)

curl -X POST https://api.zerocarbon.codes/v1/emissions/calculate \
  -H "Content-Type: application/json" \
  -d '{"source":"electricity","value":1000,"unit":"kWh","country":"US"}'

🎮 Interactive Demos

Try on Replit

Run on Replit

Try on CodeSandbox

Open in CodeSandbox


📖 5-Minute Tutorial

Step 1: Calculate Emissions (No Auth Needed)

Node.js

const axios = require('axios');

const response = await axios.post('https://api.zerocarbon.codes/v1/emissions/calculate', {
  source: 'electricity',
  value: 1000,
  unit: 'kWh',
  country: 'US'
});

console.log(`Your emissions: ${response.data.emissions_kg_co2e} kg CO2e`);
// Output: Your emissions: 386.5 kg CO2e

Python

import requests

response = requests.post('https://api.zerocarbon.codes/v1/emissions/calculate', 
    json={
        'source': 'electricity',
        'value': 1000,
        'unit': 'kWh',
        'country': 'US'
    }
)

print(f"Your emissions: {response.json()['emissions_kg_co2e']} kg CO2e")
# Output: Your emissions: 386.5 kg CO2e

Step 2: Calculate Real-World Scenarios

Flight Emissions

curl -X POST https://api.zerocarbon.codes/v1/calculate/flight \
  -H "Content-Type: application/json" \
  -d '{
    "from": "SFO",
    "to": "JFK",
    "passengers": 1,
    "class": "economy"
  }'

Vehicle Emissions

const emissions = await fetch('https://api.zerocarbon.codes/v1/calculate/fuel', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    fuel_type: 'gasoline',
    distance: 100,
    unit: 'miles'
  })
});

Step 3: Get Free API Key (30 seconds)

For persistent tracking and dashboard access:

# Sign up via API (no email verification needed)
curl -X POST https://api.zerocarbon.codes/v1/demo-request \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Your Name",
    "email": "[email protected]",
    "company": "Your Company"
  }'

# Instant API key in response:
# { "api_key": "zc_xxxxx", "dashboard_url": "https://app.zerocarbon.codes" }

🏗️ Complete Example Apps

Express.js Server (3 minutes)

git clone https://github.com/zerocarbon/examples
cd examples/nodejs-express
npm install && npm start

Flask API (3 minutes)

git clone https://github.com/zerocarbon/examples
cd examples/python-flask
pip install -r requirements.txt && python app.py

Next.js Dashboard (5 minutes)

git clone https://github.com/zerocarbon/examples
cd examples/nextjs-dashboard
npm install && npm run dev

🎯 Common Use Cases

Scenario 1: E-commerce Carbon Labels

// Add carbon footprint to product pages
const getShippingEmissions = async (weight, distance) => {
  const res = await fetch('https://api.zerocarbon.codes/v1/calculate/shipping', {
    method: 'POST',
    body: JSON.stringify({ weight_kg: weight, distance_km: distance })
  });
  return res.json();
};

// Display: "This shipment produces 2.3 kg CO2e"

Scenario 2: SaaS Carbon Dashboard

// Track your infrastructure emissions
const trackCloudEmissions = async () => {
  const emissions = await zerocarbon.calculate({
    source: 'aws_compute',
    instance_hours: 730,
    region: 'us-east-1'
  });
  
  await zerocarbon.emissions.save({
    category: 'cloud_infrastructure',
    value: emissions.kg_co2e
  });
};

Scenario 3: Travel Booking Carbon Offset

// Offer carbon offsets at checkout
const flight = await zerocarbon.calculate.flight({
  from: 'LAX',
  to: 'LHR',
  passengers: 2
});

const offsetCost = flight.emissions_kg_co2e * 0.015; // $15 per tonne
// Show: "Add carbon offset for $22.50?"

📊 What You Get

  • Instant calculations - No rate limits for testing
  • 200+ emission factors - Electricity, fuel, flights, shipping, etc.
  • Global coverage - Country-specific emission factors
  • GHG Protocol compliant - Scope 1, 2, 3 classifications
  • Auto-generated reports - BRSR, SEC, TCFD, CDP formats

💡 Why Developers Love It

No authentication for quick testing
RESTful API with predictable endpoints
JSON in, JSON out - No XML, no SOAP
Native SDKs for Node.js, Python, Go, Ruby
Webhook support for async calculations
OpenAPI spec for auto-generating clients


🔗 Next Steps


💬 Questions?

Try it now: npx zerocarbon-quickstart