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

@asterql/sync-server

v0.1.0

Published

Server side of the AsterQL sync protocol: scope ledgers, sequenced publishing, replay, and a transport-agnostic connection handler.

Readme

@asterql/sync-server

The server side of the AsterQL sync protocol: per-scope envelope ledgers, sequenced publishing, replay from client cursors, and a transport-agnostic connection handler. Pairs with @asterql/sync on the client.

Install

npm install @asterql/sync-server @asterql/view-protocol

Usage

import { SyncHub, InMemorySyncLedger } from "@asterql/sync-server";
import { WebSocketServer } from "ws";

const hub = new SyncHub({
  ledger: new InMemorySyncLedger({ retain: 10_000 }),
  authorize: (scope, user) => canRead(user, scope),
});

const wss = new WebSocketServer({ noServer: true });
server.on("upgrade", (request, socket, head) => {
  const user = authenticate(request); // your session check
  if (!user) return socket.destroy();
  wss.handleUpgrade(request, socket, head, (ws) => {
    const connection = hub.connect(ws, user);
    ws.on("message", (data) => connection.handleMessage(String(data)));
    ws.on("close", () => connection.close());
  });
});

// The one write path — mutations publish envelopes; the ledger assigns seq:
await hub.publish("run:r1", (seq) => ({
  eventId: crypto.randomUUID(),
  kind: "patch",
  scope: "run:r1",
  seq,
  entities: [
    {
      key: "message:m1",
      patches: [{ op: "appendText", path: "/text", delta: "…" }],
    },
  ],
}));

Semantics

  • Ledgers assign sequence numbers. publish(scope, makeEnvelope) appends atomically; the ledger passes the next contiguous seq to your factory. Clients replay any range gap-free because the ledger — not delivery order — is the source of truth.
  • Replay from cursors. A sub with since replays everything after the cursor before going live; since omitted means live-from-now. A cursor below the retention floor gets scopeError snapshot_required — the client re-bootstraps from a registered view and resubscribes.
  • Seed snapshots. Publish a kind: "snapshot" envelope as each scope's first entry so replay-from-zero is deterministic for any consumer.
  • Transport-agnostic. connect() takes anything with send(string); feed inbound frames to handleMessage. Works with ws, Durable Object sockets, or test fakes.
  • Multi-instance. Pass a shared SyncBus (Postgres LISTEN/NOTIFY, Redis pub/sub) and a shared persistent SyncScopeLedger; the in-memory implementations are correct for one process and for tests.