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-nodejs-sdk

v2.0.0

Published

Official Node.js SDK for ZeroCarbon.codes API

Readme

ZeroCarbon Node.js SDK

Official Node.js/TypeScript client for ZeroCarbon.codes - India's leading Carbon Accounting & Offsetting API.

Installation

npm install @zerocarbon/sdk
# or
yarn add @zerocarbon/sdk

Quick Start

const { ZeroCarbon } = require('@zerocarbon/sdk');

// Initialize client
const client = new ZeroCarbon({ apiKey: 'YOUR_API_KEY' });

// Calculate flight emissions
const emissions = await client.calculate.flight({
  origin: 'DEL',
  destination: 'BOM',
  cabinClass: 'economy'
});
console.log(`Emissions: ${emissions.emissions_kg_co2e} kg CO2e`);

// Get offset recommendations
const offsets = await client.offsets.getRecommendations({
  emissionsKgCo2e: emissions.emissions_kg_co2e,
  preferredRegion: 'India'
});
console.log(`Top project: ${offsets.recommendations[0].name}`);

// Purchase and retire credits
const transaction = await client.offsets.purchase({
  projectId: offsets.recommendations[0].project_id,
  quantityKgCo2e: emissions.emissions_kg_co2e,
  retirementReason: 'Business flight offsetting'
});
console.log(`Certificate: ${transaction.certificate_url}`);

TypeScript Support

Full TypeScript support with type definitions included:

import { ZeroCarbon, FlightEmissions } from '@zerocarbon/sdk';

const client = new ZeroCarbon({ apiKey: 'YOUR_API_KEY' });

const emissions: FlightEmissions = await client.calculate.flight({
  origin: 'DEL',
  destination: 'BOM'
});

Features

  • ✅ Calculate emissions from flights, electricity, fuel, and more
  • ✅ AI-powered spend-based emission matching
  • ✅ Carbon offset recommendations
  • ✅ Purchase and retire carbon credits
  • ✅ Generate BRSR-compliant reports
  • ✅ Webhook support
  • ✅ Test mode for development
  • ✅ Full TypeScript support

Examples

Calculate Electricity Emissions

const emissions = await client.calculate.electricity({
  amountKwh: 1000,
  country: 'IN',
  state: 'Maharashtra'
});
// Returns: 820 kg CO2e

Smart Spend Matching

const emissions = await client.calculate.spend({
  amount: 100000,
  currency: 'INR',
  category: 'electricity',
  description: 'Monthly office electricity bill'
});
// AI automatically matches to emission factors

Generate BRSR Report

const report = await client.brsr.generateReport({
  companyId: 'comp_123',
  financialYear: '2024-25',
  format: 'pdf'
});
console.log(report.download_url);

Register Webhook

const webhook = await client.webhooks.register({
  url: 'https://your-app.com/webhooks/carbon',
  events: ['offset.completed', 'offset.failed']
});
console.log(`Webhook secret: ${webhook.secret}`);

Test Mode

Enable test mode to avoid real charges:

const client = new ZeroCarbon({
  apiKey: 'test_YOUR_API_KEY',
  testMode: true
});

Error Handling

try {
  const emissions = await client.calculate.flight({
    origin: 'DEL',
    destination: 'BOM'
  });
} catch (error) {
  console.error('API Error:', error.message);
}

License

MIT License - see LICENSE file for details.

Support

  • Email: [email protected]
  • Docs: https://docs.zerocarbon.codes
  • GitHub: https://github.com/zerocarbon/nodejs-sdk