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

@actor-web/runtime

v0.2.1

Published

Core actor model runtime for universal actor-based applications

Readme

@actor-web/runtime

Pure actor model runtime for JavaScript/TypeScript — location-transparent actors across local and directly connected runtime nodes, supervision trees, and message-only communication, inspired by Erlang/OTP. Dynamic membership and production multi-machine transport remain roadmap work; see the external transport status.

📚 Documentation: 0xjcf.github.io/actor-web

Install

npm install @actor-web/runtime

Quick start

import { createActorSystem, defineBehavior } from '@actor-web/runtime';

const counter = defineBehavior<{ type: 'INCREMENT' | 'GET_COUNT' }>()
  .withContext({ count: 0 })
  .onMessage(({ message, actor }) => {
    const { count } = actor.getSnapshot().context;

    switch (message.type) {
      case 'INCREMENT':
        return {
          context: { count: count + 1 },
          emit: [{ type: 'COUNT_CHANGED', newValue: count + 1 }],
        };
      case 'GET_COUNT':
        return { reply: { count } };
    }
  });
// .build() is optional — the framework builds the behavior when you spawn it

const system = await createActorSystem({ nodeAddress: 'localhost:0' });
await system.start();

const ref = await system.spawn(counter, { id: 'counter-1' });
await ref.send({ type: 'INCREMENT' });
const { count } = await ref.ask({ type: 'GET_COUNT' });

For multi-actor applications, declare a topology and let the runtime own placement, lifecycle, supervision, and event wiring — see Topology & local runtime.

Entry points

| Import | Use for | | --- | --- | | @actor-web/runtime | defineBehavior, createActorSystem, message-plan types, testing hooks | | @actor-web/runtime/topology | defineActorWebTopology, actor, node, supervisor, tool — declarative, import-safe topology definitions | | @actor-web/runtime/node | serveNode, serveActorWebHttp — host a topology node in Node.js with WebSocket transport and gateway | | @actor-web/runtime/browser | startActorWebNode, createActorWebClient, createActorWebReadModelClient — browser/worker nodes and gateway clients |

What you get

  • Unified behavior builder — one defineBehavior() API for stateless, context-based, and XState-machine actors, with full type inference from message unions through to UI sources.
  • OTP-style handler returns{ context, reply, emit }: update state, answer an ask, broadcast domain events to subscribers.
  • Topology-declared runtime — declare nodes, actors, supervisors, and inter-actor subscriptions once; the runtime wires them on every start.
  • Supervision treesone-for-one / one-for-all / rest-for-one / escalate strategies with bounded restart policies ("let it crash").
  • Bounded mailboxes — FIFO per-actor processing with configurable backpressure (drop, park, or fail on overflow).
  • Tool ports — actors declare the capabilities they need; concrete adapters are injected at the runtime boundary via a per-actor allow-list, keeping behavior logic free of direct I/O.
  • Transports & gateway — WebSocket transports for Node and browser nodes, plus a projection gateway for UI read models and commands.
  • Test utilitiessystem.enableTestMode(), system.flush(), and event-collector actors for deterministic tests without timing hacks.

Delivery semantics (read this)

Message delivery is at-most-once: a send enqueues to the target mailbox once and is never retried or acknowledged by the runtime. Per-actor ordering is FIFO. For request/response confirmation use ask with a timeout; for stronger guarantees build an application-level acknowledgement protocol. Actor restarts begin from the behavior's initial context — durable state belongs in external stores, re-derived in onStart.

Part of Actor-Web

This package is the runtime for the Actor-Web framework. Companion packages:

License

MIT