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

@ird.sh/node-client

v2.0.2

Published

Node.js client for ird.sh - encrypted log-driven database

Readme

@ird.sh/node-client

Node.js client for ird.sh - an encrypted log-driven database.

Overview

This library provides a client for the ird.sh API, implementing an encrypted log-driven database pattern where:

  1. All database operations are serialized as DBLog actions (schema, set, delete, migrate)
  2. Actions are encrypted and stored on the server as chain log entries
  3. Clients sync chain logs and replay them locally to construct a SQLite database

Installation

npm install @ird.sh/node-client

Quick Start

import { createIrdClient, generateKeyPair } from "@ird.sh/node-client";

// Generate or load your key pair
const keyPair = generateKeyPair();

// Create the client
const client = createIrdClient({
  apiBaseUrl: "https://api.ird.sh",
  databasePath: "./myapp.db",
  credentials: {
    publicKey: keyPair.publicKey,
    privateKey: keyPair.privateKey,
  },
});

// Initialize (syncs chain logs and opens database)
await client.initialize();

// Create a table
await client.db.createTable("todos", {
  id: "TEXT PRIMARY KEY",
  title: "TEXT NOT NULL",
  completed: "INTEGER DEFAULT 0",
  createdAt: "INTEGER NOT NULL",
});

// Insert data
await client.db.set("todos", "todo-1", {
  title: { type: "string", value: "Learn ird.sh" },
  completed: { type: "bool", value: false },
  createdAt: { type: "int", value: Date.now() },
});

// Query data
const todos = client.db.queryAll("todos");

// Cleanup when done
client.cleanup();

Components

Cryptograph

Ethereum-style cryptography using secp256k1 (viem + eciesjs compatible):

import {
  generateKeyPair,
  signMessage,
  encryptForPublicKey,
  decryptToString,
} from "@ird.sh/node-client";

const keyPair = generateKeyPair();
const signed = await signMessage("Hello", keyPair.privateKey);
const encrypted = encryptForPublicKey("Secret", keyPair.publicKey);
const decrypted = decryptToString(encrypted, keyPair.privateKey);

API Client

HTTP client for the ird.sh REST API with automatic encryption/decryption:

import { createAPIClient } from "@ird.sh/node-client";

const api = createAPIClient({ baseUrl: "https://api.ird.sh" });
api.setCredentials(publicKey, privateKey);

// KV Store
await api.setKvItem("mykey", "myvalue");
const item = await api.getKvItem("mykey");

// Lists
await api.pushListItem("mylist", "item value");
const items = await api.getListItems("mylist");

// Chain Logs
const { logs, hasMore } = await api.listChainLogs(0, 100);
await api.appendChainLog({ index, prevHash, content, nonce, hash, signature });

DBLog Service

High-level interface for the log-driven database:

// Use batch for multiple operations
await db.batch((batch) => {
  batch.createTable("users", {
    id: "TEXT PRIMARY KEY",
    name: "TEXT NOT NULL",
  });
  batch.set("users", "user-1", {
    name: { type: "string", value: "Alice" },
  });
});

// Query data
const users = db.queryAll("users");
const user = db.get("users", "user-1");
const active = db.query("users", "active = 1");

// Migrations
await db.migrate("users", 2, [
  { op: "add_column", column: "avatar", columnType: "TEXT" },
]);

DBLogValue Types

import {
  DBLogNull,
  DBLogBool,
  DBLogInt,
  DBLogDouble,
  DBLogString,
  DBLogArray,
  DBLogObject,
  toDBLogValue,
} from "@ird.sh/node-client";

const data = {
  name: DBLogString("test"),
  count: DBLogInt(5),
  active: DBLogBool(true),
  tags: DBLogArray([DBLogString("a"), DBLogString("b")]),
};

// Or convert from plain JS
const value = toDBLogValue({ name: "test", count: 5 });

License

MIT