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-core

v0.12.0

Published

B3nd Core — framework foundation: types, encoding, clients, rig, network

Readme

B3nd Core

Framework foundation for B3nd. Types, encoding, clients, Rig, Identity, network primitives -- everything needed to run a decentralized network without any protocol-specific logic.

GitHub

The Rig

The Rig wires storage, validation, and behavior into a single object that speaks the ProtocolInterfaceNode (PIN) interface.

import {
  connection,
  DataStoreClient,
  MemoryStore,
  Rig,
} from "@bandeira-tech/b3nd-core";

const client = new DataStoreClient(new MemoryStore());

const rig = new Rig({
  routes: {
    receive: [connection(client, ["*"])],
    read: [connection(client, ["*"])],
  },
});

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

Connections

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({
  routes: {
    receive: [
      connection(postgresClient, ["mutable://*", "hash://*"]),
    ],
    read: [
      connection(memoryClient, ["mutable://*", "hash://*"]), // fast cache first
      connection(postgresClient, ["mutable://*", "hash://*"]), // fallback
    ],
  },
});

Programs and Handlers

Programs are pure functions that classify messages by URI prefix. Handlers decide what each classification code means operationally.

const rig = new Rig({
  routes: { ... },
  programs: {
    "store://balance": balanceProgram,
  },
  handlers: {
    "balance:valid": async (msg) => { /* persist */ },
  },
});

Identity

Ed25519 signing + X25519 encryption, seed-deterministic or generated.

const id = await Identity.fromSeed("my-secret");
const auth = await id.sign({ action: "transfer", amount: 100 });
const valid = await id.verify(
  { action: "transfer", amount: 100 },
  auth.signature,
);

Hooks, Events, Reactions

const rig = new Rig({
  routes: { ... },
  hooks: {
    beforeReceive: (ctx) => { /* throw to reject */ },
    afterRead: (ctx, result) => { /* observe */ },
    onError: (ctx) => { /* handle errors */ },
  },
  on: {
    "receive:success": [(e) => notifyPeers(e)],
    "*:error": [(e) => alertOps(e)],
  },
  reactions: {
    "mutable://app/users/:id": async (output) => { /* triggered on write */ },
  },
});
  • Hooks -- synchronous gates (throw to reject, observe after, catch errors)
  • Events -- async fire-and-forget (never block the caller)
  • Reactions -- URI-pattern triggers on successful writes

HTTP API

import { httpApi } from "@bandeira-tech/b3nd-core";

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

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

Network

Peer-to-peer replication with pluggable policies.

import { flood, network, peer } from "@bandeira-tech/b3nd-core";

const net = network(localRig, [
  peer(remoteClient, { patterns: ["mutable://*"] }),
], [flood()]);

Libraries

| Library | Description | | --------------------- | ------------------------------------------------------------------------- | | b3nd-core | Types, encoding, binary, client base classes, ObserveEmitter | | b3nd-rig | Rig, Identity, connections, hooks, events, reactions, HTTP API, factories | | b3nd-network | network(), peer(), flood, path-vector, tell-and-read policies | | b3nd-client-memory | In-memory Store (no external dependencies) | | b3nd-client-http | HTTP transport client | | b3nd-client-ws | WebSocket transport client with reconnection | | b3nd-client-console | Console output (write-only, for debugging) | | b3nd-testing | Shared test suites and helpers | | b3nd-encrypt | Ed25519 signing, X25519 encryption, AES-GCM, PBKDF2 |

Server-side composition and transports live in @bandeira-tech/b3nd-servers. Subpaths: . (createServers, ServerResolver, withCors), ./http (httpServer), ./grpc/server (grpcServer), ./grpc/api (universal grpcApi), ./grpc/client (GrpcClient), ./grpc/proto (wire schema). The universal slice ships to JSR + NPM; the Deno.serve-using slice is JSR-only.

Core itself only ships the pure httpApi(rig) request handler — feed it to any HTTP runtime (Deno, Hono, Express, Cloudflare Workers, …).

Subpath Exports

import { ... } from "@bandeira-tech/b3nd-core";             // everything
import type { ... } from "@bandeira-tech/b3nd-core/types";   // types only
import { ... } from "@bandeira-tech/b3nd-core/encoding";     // hex encoding
import { ... } from "@bandeira-tech/b3nd-core/binary";       // binary encoding
import { ... } from "@bandeira-tech/b3nd-core/network";      // network primitives
import { ... } from "@bandeira-tech/b3nd-core/client-console"; // console client

Development

deno check src/mod.ts       # Type check
deno test libs/              # Run tests

Project Structure

src/           # Entry points and subpath re-exports
libs/          # 13 libraries (see table above)

Related

  • b3nd-canon -- protocol toolkit (msg, hash, auth, encrypt, wallet)
  • b3nd-sdk -- SDK umbrella that re-exports core + canon

License

MIT