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

@zenuinebit/einvoice-irn

v0.1.0

Published

E-invoice (IRP) JSON builder and IRN hash for GST invoices. SHA-256 included, no dependencies.

Readme

@zenuinebit/einvoice-irn

Builds the e-invoice JSON (IRP "INV-01" layout) for a GST invoice and computes its IRN. Includes a small SHA-256, so it runs in Node and the browser with no extra dependency. Builds on @zenuinebit/gst-report, @zenuinebit/address-india and @zenuinebit/invoice-number.

Check before you rely on it. Field names, codes and limits follow the e-invoice schema as commonly documented. The schema, the IRN rule and who must use e-invoicing change over time. Validate the JSON with the official tools or the IRP sandbox first. Only B2B supplies are built.

import { buildEinvoice, toEinvoiceJson, irnFor, computeIrn, cancelPayload } from "@zenuinebit/einvoice-irn";

const input = {
  invoice: {                                       // the same SaleInvoice used by gst-report (tax-exclusive prices)
    number: "INV/2025-26/0042",
    date: "2025-04-10",
    placeOfSupply: "Karnataka",
    buyer: { gstin: "29ABCPD1234E1ZA", name: "Bengaluru Traders" },
    lines: [{ description: "Tea 250g", hsn: "0902", quantity: 10, unitPrice: 10_000, taxRate: 5 }],
  },
  seller: { gstin: "27AAPFU0939F1ZV", name: "ZenuineBit Foods Pvt Ltd", address1: "1 Main Rd", place: "Pune", pincode: "411001" },
  buyer:  { gstin: "29ABCPD1234E1ZA", name: "Bengaluru Traders", address1: "5 MG Rd", place: "Bengaluru", pincode: "560001" },
  unitByHsn: { "0902": "KGS" },
};

const json = buildEinvoice(input);        // plain object: TranDtls, DocDtls, SellerDtls, BuyerDtls, ItemList, ValDtls
await fs.writeFile("einv.json", toEinvoiceJson(input));

irnFor(input);                            // 64-hex IRN of this invoice
computeIrn(sellerGstin, "INV", "INV/2025-26/0042", "2025-04-10");

cancelPayload(irn, "data-entry-mistake", "Wrong buyer");   // { Irn, CnlRsn: "2", CnlRem }

How it works

  • IRN = SHA-256 of supplier GSTIN + financial year (2025-26) + document type (INV, CRN, DBN) + document number, as 64 lowercase hex characters. The portal computes it again when you register, so this lets you show or check it up front. It is tested against node:crypto.
  • Amounts are in rupees, the date is dd/MM/yyyy, tax is CGST+SGST within a state and IGST between states (same maths as gst-report). An HSN starting with 99 is treated as a service.
  • Credit notes keep positive amounts and use document type CRN.
  • Throws a clear message for a bad GSTIN, PIN, HSN or SAC (4 to 8 digits), a document number the portal would refuse (1-16 characters, letters, digits, / and -, not starting with 0), tax-inclusive prices, or a missing buyer GSTIN.

Not included: calling the IRP (authentication, registration, QR code and signed invoice), B2C, exports and SEZ, dispatch and ship-to details, payment and reference details, cess, round-off, and the rules about who must issue e-invoices and by when.