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

l402-kit

v1.8.1

Published

Add Bitcoin Lightning pay-per-call to any API in 3 lines. L402 protocol, zero config, 0.3% fee. npm install l402-kit

Readme

l402-kit

Add Bitcoin Lightning pay-per-call to any API. 3 lines of code.

License: MIT Live Demo Tests

▶ Watch end-to-end demo — install → 402 → pay → 200 OK


Live traction

| SDK | Version | Downloads | |:----|:-------:|----------:| | 📦 TypeScript · npmjs.com/package/l402-kit | npm | npm total | | 🐍 Python · pypi.org/project/l402kit | pypi | pypi total | | 🦀 Rust · crates.io/crates/l402kit | crates | crates dls | | 🔌 VS Code Extension · marketplace | vscode ver | marketplace | | 🦫 Go · pkg.go.dev | go | go report |



🇺🇸 Charge for your API in Bitcoin Lightning. 3 lines of code. 🇧🇷 Monetize sua API com Bitcoin Lightning. 3 linhas de código. 🇪🇸 Monetiza tu API con Bitcoin Lightning. 3 líneas de código. 🇨🇳 用 3 行代码,通过比特币闪电网络收费。 🇮🇳 अपने API को Bitcoin Lightning से 3 लाइनों में मोनेटाइज़ करें। 🇸🇦 اكسب من API الخاص بك عبر Bitcoin Lightning. 3 أسطر فقط. 🇫🇷 Monétisez votre API en Bitcoin Lightning. 3 lignes de code. 🇩🇪 Monetarisiere deine API mit Bitcoin Lightning. 3 Zeilen Code. 🇷🇺 Монетизируй свой API через Bitcoin Lightning. 3 строки кода. 🇯🇵 Bitcoin LightningでAPIを3行で収益化。 🇮🇹 Monetizza la tua API con Bitcoin Lightning. 3 righe di codice.

📖 Official docs: 🇺🇸 · 🇧🇷 · 🇪🇸 · 🇨🇳 · 🇮🇳 · 🇸🇦 · 🇫🇷 · 🇩🇪 · 🇷🇺 · 🇯🇵 · 🇮🇹


Install

npm install l402-kit        # TypeScript / Node.js / Express
pip install l402kit         # Python / FastAPI / Flask
go get github.com/shinydapps/l402-kit/[email protected]   # Go / net/http / Chi / Gin
cargo add l402kit           # Rust / axum

AI Agents / LLMs: See llms.txt for machine-readable instructions.


How it works

1. Client calls your API
       ↓
2. API returns  HTTP 402 + BOLT11 invoice + macaroon
       ↓
3. Client pays  (any Lightning wallet, < 1 second, any country)
       ↓
4. Client sends Authorization: L402 <macaroon>:<preimage>
       ↓
5. API verifies SHA256(preimage) == paymentHash  ✓
       ↓
6. HTTP 200 OK + your data

── Fee flow (managed mode) ─────────────────────────────────
   Payment → 99.7% → your Lightning Address  (instant)
           →  0.3% → ShinyDapps

Quickstart

TypeScript

import express from "express";
import { l402, AlbyProvider } from "l402-kit";

const app = express();

const lightning = new AlbyProvider(process.env.ALBY_TOKEN!);

app.get("/premium", l402({ priceSats: 100, lightning }), (_req, res) => {
  res.json({ data: "Payment confirmed." });
});

app.listen(3000);

Python

from fastapi import FastAPI, Request
from l402kit import l402_required

app = FastAPI()

@app.get("/premium")
@l402_required(price_sats=100, owner_lightning_address="[email protected]")
async def premium(request: Request):
    return {"data": "Payment confirmed."}

Go

package main

import (
    "fmt"
    "net/http"
    l402kit "github.com/shinydapps/l402-kit/go"
)

func main() {
    http.Handle("/premium", l402kit.Middleware(l402kit.Options{
        PriceSats:             100,
        OwnerLightningAddress: "[email protected]",
    }, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintln(w, `{"data": "Payment confirmed."}`)
    })))
    http.ListenAndServe(":8080", nil)
}

Rust

use axum::{middleware, routing::get, Router};
use l402kit::{l402_middleware, Options};
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let opts = Arc::new(Options::new(100).with_address("[email protected]"));

    let app = Router::new()
        .route("/premium", get(|| async { "Payment confirmed." }))
        .route_layer(middleware::from_fn_with_state(opts, l402_middleware));

    let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
    axum::serve(listener, app).await.unwrap();
}

Test it live

# Step 1 — triggers 402 + returns invoice
curl http://localhost:3000/premium
# ← { "error": "Payment Required", "invoice": "lnbc1u...", "macaroon": "eyJ..." }

# Step 2 — pay the invoice with any Lightning wallet, then:
curl http://localhost:3000/premium \
  -H "Authorization: L402 <macaroon>:<preimage>"
# ← { "data": "Payment confirmed." }

▶ Try the interactive demo


Why not Stripe?

| | Stripe | l402-kit | |--|--------|----------| | Minimum fee | $0.30 | < 1 sat (~$0.001) | | Settlement time | 2–7 days | < 1 second | | Chargebacks | Yes | Impossible — cryptographic proof | | Requires account | Yes | No — any Lightning wallet | | AI agent support | No | Yes — 4 SDKs, native | | Countries blocked | ~50 | 0 — global by default | | Reversible | Yes | No — final on receipt | | Open source | No | Yes — MIT |


Providers

import { BlinkProvider, OpenNodeProvider, LNbitsProvider } from "l402-kit";

// Blink (recommended — free, instant setup)
const provider = new BlinkProvider(process.env.BLINK_API_KEY!, process.env.BLINK_WALLET_ID!);

// OpenNode (production, custodial)
const provider = new OpenNodeProvider(process.env.OPENNODE_KEY!);

// LNbits (self-hosted)
const provider = new LNbitsProvider(process.env.LNBITS_KEY!, "https://your.lnbits.host");

Bring your own node — implement the LightningProvider interface in 5 lines:

import type { LightningProvider } from "l402-kit";

class MyNode implements LightningProvider {
  async createInvoice(amountSats: number) { /* return Invoice */ }
  async checkPayment(paymentHash: string) { /* return boolean */ }
}

Security model

Invoice creation:  paymentHash = SHA256(preimage)
Client payment:    Lightning Network releases preimage to payer
API verification:  SHA256(preimage) == paymentHash  ✓
Replay protection: each preimage is marked used — works exactly once
Token expiry:      macaroons expire after 1 hour
  • Unforgeable — SHA256 is a one-way function; you cannot fake a preimage
  • No chargebacks — cryptographic settlement, not reversible card auth
  • Replay-safe — MemoryReplayAdapter (dev) or RedisReplayAdapter (production, multi-instance)
  • 392 automated tests across 5 runtimes (TS, Python, Go, Rust, Cloudflare Workers) — production-grade reliability for autonomous agent workflows
  • Fully auditable — MIT, every line open source

VS Code Extension

Monitor every sat in real-time without leaving your editor.

VS Code Marketplace

  • ⚡ Live payment feed per endpoint
  • 📊 Bar chart — 1D / 7D (free) · 30D / 1Y / ALL (Pro)
  • 🌍 11 languages built-in
  • 🎨 Light / dark / auto theme
  • 🔧 Zero config — just set your Lightning Address

Get a Lightning Address (free)

Sign up at dashboard.blink.sv — free, no credit card, instant. Your address: [email protected]

Other wallets: Wallet of Satoshi · Phoenix · Zeus · Alby


Links

| Resource | URL | |----------|-----| | 📖 Docs (11 languages) | l402kit.com/docs | | 📦 npm | npmjs.com/package/l402-kit | | 🐍 PyPI | pypi.org/project/l402kit | | 🦫 Go | pkg.go.dev/github.com/shinydapps/l402-kit/go | | 🦀 Rust | crates.io/crates/l402kit | | 🔌 VS Code | marketplace.visualstudio.com | | ⚡ Lightning | [email protected] | | 🐙 GitHub | github.com/ShinyDapps/l402-kit |


MIT — use freely, build freely.

Bitcoin has no borders.

Built with ⚡ by ShinyDapps

Docs · Demo · VS Code · npm