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

@umari/js

v0.1.1

Published

TypeScript SDK for authoring Umari WASM modules (commands, projectors, effects).

Readme

@umari/js

TypeScript SDK for writing Umari modules. Build event-sourced commands, projectors, and effects in TS, compile them to WASM components via jco componentize, and run them on the Umari runtime.

Note: this is the JS/TS counterpart to the Rust SDK under crates/umari/. The two SDKs share the same WIT contract and produce interchangeable .wasm modules.

Install

npm install --save-dev @umari/js @bytecodealliance/jco esbuild

Write a command

// commands/register-user/src/index.ts
import {
  defineEvent,
  defineFold,
  defineCommand,
  exportCommand,
  EventFold,
} from "@umari/js";

type UserRegisteredData = {
  userId: bigint;
  email: string;
  name: string;
};

export const UserRegistered = defineEvent<UserRegisteredData>()("user.registered", {
  domainIds: ["userId"],
});

type Input = {
  userId: bigint;
  email: string;
  name: string;
};

const RegisterUser = defineCommand<Input, Record<string, never>>({
  domainIds: ["userId"] as const,
  folds: ({ userId }) => ({
    connected: EventFold(UserRegistered)({ userId }),
  }),
  execute: ({ input, folds, emit }) => {
    if (folds.connected.length > 0) return emit(); // idempotent no-op
    return emit(
      UserRegistered({
        userId: input.userId,
        email: input.email,
        name: input.name,
      }),
    );
  },
});

export const { schema, execute } = exportCommand(RegisterUser);

Write a projector

// projectors/users/src/index.ts
import { defineProjector, exportProjector, sqlite } from "@umari/js";
import { UserRegistered } from "../events.js";

const UsersProjector = defineProjector({
  events: [UserRegistered],
  init: () => {
    sqlite.executeBatch(`
      CREATE TABLE IF NOT EXISTS users (
        user_id TEXT PRIMARY KEY,
        email TEXT NOT NULL,
        name TEXT NOT NULL
      );
    `);
  },
  handle: (event) => {
    switch (event.type) {
      case "user.registered":
        sqlite.execute(
          "INSERT INTO users (user_id, email, name) VALUES (?, ?, ?)",
          [event.data.userId, event.data.email, event.data.name],
        );
        break;
    }
  },
});

export const { projector } = exportProjector(UsersProjector);

Write an effect

// effects/notify-owner/src/index.ts
import { defineEffect, exportEffect, env } from "@umari/js";
import { UserRegistered } from "../events.js";

const NotifyOwner = defineEffect({
  events: [UserRegistered],
  init: () => ({ endpoint: env("NOTIFY_ENDPOINT") }),
  partitionKey: (event) => event.data.userId.toString(),
  handle: async (event, state) => {
    const r = await fetch(state.endpoint, {
      method: "POST",
      body: JSON.stringify({ userId: event.data.userId.toString() }),
    });
    if (!r.ok) throw new Error(`status ${r.status}`);
  },
});

export const { effect } = exportEffect(NotifyOwner);

Build

npx umari-js build src/index.ts --out dist/module.wasm

The CLI detects the module kind from the entry file's exports (exportCommand / exportProjector / exportEffect) and targets the right WIT world automatically.

Concepts

  • Events carry a payload + a list of domain id fields. Domain ids tag the event in the store so it can be efficiently queried.
  • Folds reduce a stream of events keyed by domain ids into in-memory state. Commands declare which folds they need; the runtime fetches and replays only matching events before invoking your execute.
  • Commands are the only writers. They take a typed input, replay folds, validate invariants, and emit new events.
  • Projectors consume events and build SQLite read models.
  • Effects consume events and perform side effects (HTTP, calling other commands). Use partitionKey to serialise events that share a domain id.

See the Umari book for the full conceptual overview.

On bigint

Umari uses bigint everywhere a Rust i64 / u64 would appear: event store positions, timestamps in the WIT layer, and any payload field declared as bigint. Payload JSON serialises bigint as a decimal string by convention. Inside handle / execute, coerce explicitly with BigInt(...) when reading payload fields that round-trip through the wire.