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

nostr-git-client

v0.0.2

Published

Browser-based git sync via Nostr with optional Bitcoin anchoring

Readme

nostr-git-client

Browser-based git sync via Nostr with optional Bitcoin anchoring.

Subscribe to NIP-34 repo state events (kind 30618) and sync git repositories to browser IndexedDB using isomorphic-git.

Try the Demo

Installation

npm install nostr-git-client

Usage

Basic Git Sync

import { NostrGitClient } from 'nostr-git-client';

const client = new NostrGitClient({
  repo: 'https://solid.social/mel/public/myapp',
  repoId: 'myapp',
  branch: 'main',
  relays: ['wss://relay.damus.io', 'wss://nos.lol'],
  trusted: ['pubkey-hex...']  // Only sync from trusted publishers
});

client.on('sync', (event) => {
  if (event.status === 'complete') {
    console.log('Synced to:', event.commit);
  }
});

client.connect();
await client.sync();

// Read files from synced repo
const content = await client.readFile('index.html');
const files = await client.listFiles('src');

State Management with Bitcoin Anchoring

import { NostrGitClient, StateManager } from 'nostr-git-client';

const client = new NostrGitClient({
  repo: 'https://solid.social/mel/public/game',
  trusted: ['pubkey...']
});

const state = new StateManager({
  sync: client,
  file: 'state.json',
  anchor: {
    privkey: 'your-bitcoin-privkey-hex',
    network: 'testnet4'
  },
  onChange: (newState) => {
    console.log('State updated:', newState);
  }
});

await state.init();
client.connect();
await client.sync();

// Anchor current state to Bitcoin
const anchor = await state.anchor();
console.log('Anchored:', anchor.txid);

Self-Deploying Pages

import { SelfDeploy } from 'nostr-git-client';

// Auto-reload when repo is updated
SelfDeploy.init({
  repo: 'https://solid.social/mel/public/myapp',
  trusted: ['pubkey...'],
  autoReload: true,
  onUpdate: (event) => {
    console.log('Update detected:', event.commit);
  }
});

API

NostrGitClient

Main client for Nostr-based git sync.

Constructor options:

  • repo - Git repository URL
  • repoId - Repository identifier (default: derived from repo URL)
  • branch - Branch to track (default: 'main')
  • relays - Nostr relay URLs
  • trusted - Trusted publisher pubkeys
  • corsProxy - CORS proxy URL (optional)

Methods:

  • connect() - Connect to relays and start listening
  • disconnect() - Disconnect from relays
  • sync(commit?) - Sync to specified commit or latest
  • readFile(path) - Read file content as string
  • readFileBytes(path) - Read file as Uint8Array
  • listFiles(path?) - List directory contents
  • getAllFiles() - Get all files recursively
  • getCommit() - Get current commit info
  • clear() - Delete local repository

Events:

  • sync - Sync status changes
  • event - Nostr events received
  • connect - Connected to relay
  • disconnect - Disconnected from relay
  • error - Errors

StateManager

Manages JSON state with optional Bitcoin anchoring.

Constructor options:

  • sync - NostrGitClient instance
  • file - Path to JSON file (default: 'state.json')
  • anchor - Bitcoin config: { privkey, network }
  • onChange - Callback on state changes

Methods:

  • init() - Initialize (loads blocktrails if anchoring)
  • loadState() - Load state from file
  • get() - Get current state
  • anchor() - Anchor state to Bitcoin
  • getAnchors() - Get anchor history
  • verifyChain() - Verify anchor chain integrity

SelfDeploy

Auto-updating pages.

Static methods:

  • init(options) - Initialize self-deploy
  • loaderScript(options) - Generate embed script
  • serviceWorkerCode() - Generate SW code

Options:

  • repo - Repository URL (required)
  • trusted - Trusted pubkeys (required)
  • autoReload - Auto reload on update (default: true)
  • reloadDelay - Delay before reload in ms (default: 1000)
  • onUpdate - Callback on update
  • onSync - Callback after sync

Dependencies

Optional:

License

MIT