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

@invoicenavigator/einvoice-validator

v0.1.0

Published

Free, open-source EU e-invoice validator. Detect formats and validate against EN 16931 core rules.

Downloads

62

Readme

@invoicenavigator/einvoice-validator

Free, open-source EU e-invoice validator. Detect formats and validate against EN 16931 core rules.

Supports UBL 2.1, CII D16B, Peppol BIS 3.0, XRechnung, and ZUGFeRD/Factur-X.

Install

npm install @invoicenavigator/einvoice-validator

Quick Start

import { validate, detectFormat } from '@invoicenavigator/einvoice-validator'
import { readFileSync } from 'fs'

const xml = readFileSync('invoice.xml', 'utf-8')

// Detect the invoice format
const format = detectFormat(xml)
console.log(format)
// { format: 'peppol-bis-3.0', syntax: 'ubl', version: '2.1' }

// Validate against EN 16931 core rules
const result = validate(xml)

if (result.valid) {
  console.log('Basic validation passed')
} else {
  for (const error of result.errors) {
    console.log(`${error.rule}: ${error.message}`)
  }
}

What This Validates

This library checks EN 16931 core structural rules (BR-01 through BR-10):

| Rule | Check | |------|-------| | BR-01 | Specification identifier is present (BT-24) | | BR-02 | Invoice number is present (BT-1) | | BR-03 | Invoice issue date is present and valid (BT-2) | | BR-04 | Invoice type code is a valid UNTDID 1001 code (BT-3) | | BR-05 | Invoice currency code is a valid ISO 4217 code (BT-5) | | BR-06 | Seller name is present (BT-27) | | BR-07 | Buyer name is present (BT-44) | | BR-08 | Seller postal address is present (BG-5) | | BR-09 | Seller country code is present and valid (BT-40) | | BR-10 | Buyer postal address is present (BG-8) |

Plus structural checks: valid root element, correct namespace prefixes.

Need More?

This library covers basic structural validation. For production e-invoicing pipelines, you likely also need:

  • Full EN 16931 business rules (200+ rules including calculation checks)
  • Country-specific CIUS (XRechnung, Peppol, Italian FatturaPA, etc.)
  • KoSIT/Schematron validation (authoritative German validator)
  • Auto-remediation (fix structural issues without changing commercial data)
  • Compliance evidence packs (signed PDF/JSON audit trail)

Invoice Navigator provides all of the above as an API. Free trial available — no credit card required.

import { InvoiceNavigator } from '@invoicenavigator/sdk'

const client = new InvoiceNavigator({ apiKey: 'sk_test_...' })

// Full validation: 200+ rules, KoSIT, country CIUS
const result = await client.validate({ xml })

// Auto-fix compliance issues
const fixed = await client.validateAndFix({ xml })

Supported Formats

| Format | Detection | Validation | |--------|-----------|------------| | UBL 2.1 Invoice | Yes | Yes | | UBL 2.1 CreditNote | Yes | Yes | | UN/CEFACT CII D16B | Yes | Yes | | Peppol BIS Billing 3.0 | Yes | Yes | | XRechnung 3.0 | Yes | Yes | | ZUGFeRD 2.3 | Yes | Yes | | Factur-X 1.0 | Yes | Yes |

API

detectFormat(xml: string): FormatDetectionResult

Detect the format and syntax of an e-invoice XML string.

interface FormatDetectionResult {
  format: InvoiceFormat  // e.g. 'peppol-bis-3.0', 'xrechnung-ubl', 'cii'
  syntax: 'ubl' | 'cii' | 'unknown'
  version: string | null // e.g. '2.1', 'D16B'
}

validate(xml: string): ValidationResult

Validate an e-invoice against EN 16931 core rules.

interface ValidationResult {
  valid: boolean
  format: FormatDetectionResult
  errors: ValidationIssue[]
  summary: { errors: number; warnings: number }
}

interface ValidationIssue {
  rule: string      // e.g. 'BR-01', 'STRUCT-02'
  message: string
  severity: 'error' | 'warning'
}

Contributing

See CONTRIBUTING.md. Issues and PRs welcome.

License

MIT — use it however you want.