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

confactura

v0.1.0

Published

Client JS officiel de l'API Confactura — génération & validation de factures Factur-X (EN 16931).

Readme

confactura — client JS / Node

Client officiel de l'API Confactura : générer et valider des factures Factur-X (PDF/A-3 + XML CII, profil EN 16931) en un appel HTTP, conformes à la réforme française de la facturation électronique 2026-2027.

Le service recalcule les totaux côté serveur et refuse de livrer une facture qui ne passe pas la validation XSD et Schematron (règles CTC FR incluses) : un 200 est une garantie de conformité, pas une supposition.

npm install confactura

Zéro dépendance : fetch / FormData / Blob natifs (Node ≥ 18, ou navigateur). ESM.

Clé API

curl -X POST https://confactura.fr/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]"}'

La clé n'est renvoyée qu'une seule fois (dans la réponse et par email). Le plan gratuit couvre 20 factures/mois ; la validation est illimitée et sans clé.

Usage

import { ConfacturaClient, ConfacturaValidationError } from "confactura";
import { readFileSync, writeFileSync } from "node:fs";

const df = new ConfacturaClient({ apiKey: "df_live_…" });

// Générer un Factur-X
try {
  const pdf = await df.generateFacturx({
    number: "2026-0042",
    issue_date: "2026-09-01",
    due_date: "2026-09-30",
    seller: { name: "Ma Société", address_line: "1 rue X", postcode: "75001", city: "Paris", siren: "123456789", vat_id: "FR32123456789", electronic_address: "[email protected]" },
    buyer:  { name: "Client SARL", address_line: "2 av. Y", postcode: "69001", city: "Lyon", electronic_address: "[email protected]" },
    lines:  [{ description: "Presta dev", quantity: 5, unit_price: "450.00" }],
  });
  writeFileSync("facture-2026-0042.pdf", pdf);
} catch (e) {
  if (e instanceof ConfacturaValidationError) console.error("Non conforme :", e.errors);
}

// Valider un Factur-X — anonyme, aucune clé requise, aucun quota consommé
const report = await df.validate(readFileSync("facture.pdf"));
console.log(report.valid, report.errors);

// Consommation du mois
console.log(await df.usage()); // { plan: "free", used: 3, quota: 20 }

validate fonctionne sans clé : new ConfacturaClient().validate(bytes). Autre environnement : new ConfacturaClient({ baseUrl: "http://localhost:8000" }).

Champs requis côté CTC FR

Sans eux la facture part en 422 avec le rapport détaillé — jamais en 500 :

  • electronic_address sur le vendeur et l'acheteur (BR-FR-12 / BR-FR-13) ;
  • vat_id côté vendeur dès qu'une ligne est en TVA standard (BR-S-02) ;
  • un siren vendeur valide.

Les autres mentions de la réforme 2026 (frais de recouvrement, pénalités de retard, escompte, catégorie d'opération) sont ajoutées automatiquement côté serveur.

API

| Méthode | Endpoint | Retour | |---|---|---| | generateFacturx(invoice) | POST /v1/invoices/facturx | Uint8Array — PDF/A-3 | | generateXml(invoice) | POST /v1/invoices/xml | Uint8Array — XML CII EN 16931 | | validate(pdf) | POST /v1/validate | { valid, profile, flavor, errors } | | usage() | GET /v1/usage | { plan, used, quota } |

Un 422 en génération lève ConfacturaValidationError (.errors, .report) ; tout autre statut ≥ 400 lève ConfacturaError (.status, .detail).

Liens

Tests

npm test   # node --test, serveur http local jetable, zéro réseau externe

MIT.