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

@bandeira-tech/b3nd-web

v0.9.4

Published

Browser-focused B3nd SDK bundle

Downloads

261

Readme

B3nd

A framework for building DePIN protocols. Wire up storage, define validation rules, and get a running network — the Rig composes everything.

Website | GitHub | JSR | NPM

The Rig

The Rig is B3nd's top-level abstraction. It wires storage, validation, and behavior into a single object that speaks the universal protocol interface.

import { connection, Identity, Rig } from "@bandeira-tech/b3nd-sdk/rig";
import { MessageDataClient, MemoryStore } from "@bandeira-tech/b3nd-sdk";

const rig = new Rig({
  connections: [
    connection(new MessageDataClient(new MemoryStore()), {
      receive: ["*"],
      read: ["*"],
    }),
  ],
});

// Write
await rig.receive([["mutable://open/greeting", {}, { text: "Hello" }]]);

// Read
const data = await rig.readData("mutable://open/greeting");
// → { text: "Hello" }

That's a working node. No config files, no database — just a rig with a memory connection. Swap MemoryStore for PostgresStore and it's persistent. Add a second connection and writes broadcast to both.

Connections — Where Data Lives

Connections bind clients to URI patterns. The rig routes automatically: writes broadcast to all matching connections, reads try each in order.

const rig = new Rig({
  connections: [
    // Fast cache (tried first on reads)
    connection(memoryClient, {
      read: ["mutable://*", "hash://*"],
    }),

    // Persistent storage
    connection(postgresClient, {
      receive: ["mutable://*", "hash://*", "link://*"],
      read: ["mutable://*", "hash://*", "link://*"],
    }),

    // Local-only state (never leaves the device)
    connection(memoryClient, {
      receive: ["local://*"],
      read: ["local://*"],
    }),
  ],
});

Programs — The Rules

Programs are pure functions that classify messages. A protocol defines them; the rig dispatches to them by URI prefix.

const rig = new Rig({
  connections: [...],
  programs: {
    "store://balance": balanceProgram,
    "proto://msg":     msgProgram,
  },
  handlers: {
    "proto:valid":     async (msg, broadcast) => { /* store opaquely */ },
    "proto:confirmed": async (msg, broadcast, read) => { /* apply state */ },
  },
});

Programs return codes ("proto:valid", "proto:confirmed", "proto:invalid"). Handlers decide what each code means operationally. Same programs, different handlers — that's how you get full nodes, light nodes, indexers, and mirrors from one protocol definition.

Identity — Sign and Encrypt

const id = await Identity.fromSeed("my-secret");
const session = id.rig(rig);

// Signed envelope — content-addressed, authenticated
await session.send({
  inputs: [],
  outputs: [["mutable://accounts/" + id.pubkey + "/profile", {}, { name: "Alice" }]],
});

// Encrypted
await session.sendEncrypted({
  inputs: [],
  outputs: [["mutable://accounts/" + id.pubkey + "/private", {}, secret]],
});

Hooks, Events, Reactions

The rig has three behavior layers beyond connections and programs:

const rig = new Rig({
  connections: [...],
  hooks: {
    beforeReceive: (ctx) => { validateSchema(ctx); },  // throw to reject
    afterRead: (ctx, result) => { audit(ctx, result); },
  },
  on: {
    "send:success": [notifyPeers],
    "*:error": [alertOps],
  },
  reactions: {
    "mutable://app/users/:id": (uri, data, { id }) => {
      console.log(`User ${id} updated`);
    },
  },
});
  • Hooks are synchronous gates — throw to reject, observe after
  • Events are async fire-and-forget — never block the caller
  • Reactions are URI-pattern triggers on successful writes

HTTP API

The rig is pure orchestration. Transport is external:

import { httpApi } from "@bandeira-tech/b3nd-sdk/rig/http";

const api = httpApi(rig);
Deno.serve({ port: 9942 }, api);

One function — returns a standard (Request) => Promise<Response> handler. Works with Deno.serve, Hono, Express, Cloudflare Workers.


Framework Layers

┌─────────────────────────────────────────────┐
│  App          (UX, domain logic, display)    │
├─────────────────────────────────────────────┤
│  Protocol     (programs, handlers, URI       │
│                conventions, consensus)        │
├─────────────────────────────────────────────┤
│  B3nd         (rig, connections, storage,    │
│                transport, crypto primitives)  │
└─────────────────────────────────────────────┘

Protocol designers use B3nd to define programs and handlers — the rules for their network. This is B3nd's primary audience.

App developers use a protocol SDK built on B3nd. They call send(), read(), list() and don't need to know the framework internals.

Infrastructure operators run rigs loaded with a protocol's programs. They choose connections (backends), manage replication, handle uptime.

Packages

| Package | Registry | Use Case | | -------------------------------------------------------------------------------- | -------- | -------------- | | @bandeira-tech/b3nd-sdk | JSR | Deno, servers | | @bandeira-tech/b3nd-web | NPM | Browser, React |

// Deno/Server
import { Rig, connection, Identity } from "@bandeira-tech/b3nd-sdk/rig";
import { MessageDataClient, MemoryStore, PostgresStore, HttpClient } from "@bandeira-tech/b3nd-sdk";

// Browser/React
import { Rig, connection, Identity } from "@bandeira-tech/b3nd-web/rig";
import { HttpClient, IndexedDBStore } from "@bandeira-tech/b3nd-web";

Storage Backends

| Store | Environment | Backend | | -------------------- | ----------- | --------------------- | | MemoryStore | Any | In-memory | | PostgresStore | Deno/Node | PostgreSQL | | MongoStore | Deno/Node | MongoDB | | SqliteStore | Deno/Node | SQLite | | FsStore | Deno/Node | Local filesystem | | S3Store | Deno/Node | S3-compatible storage | | IpfsStore | Deno/Node | IPFS via Kubo | | ElasticsearchStore | Deno/Node | Elasticsearch | | LocalStorageStore | Browser | localStorage | | IndexedDBStore | Browser | IndexedDB |

Transport Clients

| Client | Environment | Backend | | ----------------- | ----------- | --------------------------- | | HttpClient | Any | Remote HTTP node | | WebSocketClient | Any | Remote WebSocket node | | ConsoleClient | Any | Console output (write-only) |

All clients implement NodeProtocolInterface. The rig itself also satisfies this interface — pass it anywhere a client is expected.

Running a Node

The prebuilt node binary (apps/b3nd-node/) configures a rig from environment variables:

| Variable | Description | Example | | --------------- | ------------------------ | ---------------------------------- | | BACKEND_URL | Comma-separated backends | memory://, postgresql://... | | SCHEMA_MODULE | Path to protocol schema | ./my-protocol-schema.ts | | PORT | Listen port | 9942 | | CORS_ORIGIN | Allowed origins | * |

# Memory (no dependencies)
PORT=9942 BACKEND_URL=memory:// deno run -A apps/b3nd-node/mod.ts

# PostgreSQL
PORT=9942 BACKEND_URL=postgresql://b3nd:b3nd@localhost:5432/b3nd deno run -A apps/b3nd-node/mod.ts

# Hybrid (memory cache + postgres persistence)
BACKEND_URL=memory://,postgresql://b3nd:b3nd@localhost:5432/b3nd

# Docker
docker run -p 9942:9942 -e BACKEND_URL=memory:// -e PORT=9942 -e CORS_ORIGIN=* \
  ghcr.io/bandeira-tech/b3nd/b3nd-node:latest

Multiple backends: writes broadcast to all, reads try each in order.

Development

make test-unit              # Run tests
deno check src/mod.ts       # Type check
npm run build               # Build npm package
make version v=X.Y.Z        # Version + publish

Project Structure

src/           # SDK entry points (mod.ts, mod.web.ts)
libs/          # Core libraries (rig, clients, compose, encrypt, etc.)
apps/          # Deployables (b3nd-node, vault-listener, web-rig)
skills/        # Framework documentation for AI agents

Learn More

  • skills/b3nd/ — Framework reference, protocol design, node operations, and architecture documents

License

MIT