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

@mboxlabs/mailbox

v0.2.0

Published

A lightweight, pluggable mailbox kernel inspired by the Erlang Actor Model. It treats all communication as delivering a message to an address, enabling fault-tolerant, distributed, and human-computer collaborative systems.

Downloads

16

Readme

📮 Mailbox — Rethinking Asynchronous Programming

A lightweight, pluggable "mailbox/queue" kernel that treats all communication as "delivering a letter to an address." An address represents a unique mailbox, which can be accessed through various transport protocols (e.g., mem:, mailto:, slack:) handled by different Providers. Use Mailbox for asynchronous communication to build fault-tolerant, distributed, human-computer collaborative systems.

npm License

🌟 Why Mailbox?

| Traditional Way | Mailbox Way | |---|---| | ❌ Shared State + Locks | ✅ Isolated Mailboxes + Messages | | ❌ Callback Hell | ✅ Seamless async/await Integration | | ❌ Complex Human-Machine Collaboration | ✅ Human = A Mailbox Address | | ❌ Difficult Offline Scenarios | ✅ Automatic Message Buffering & Retry |

Erlang Inspiration

🙏 A tribute to Erlang's Actor Model "When computers were the size of rooms, the creators of Erlang proposed a revolutionary idea: Each process has its own mailbox, communicates via messages, and crashing is not a failure but part of the design." — Joe Armstrong, Robert Virding, Mike Williams

Mailbox is deeply inspired by the Erlang Actor Model, but we've made key evolutions:

| Erlang (1986) | Mailbox (Today) | Why It Matters | |---|---|---| | Pid ! Message | send({ to: 'protocol://address' }) | Address as Identity, Protocol as Route: The address part is the mailbox's unique ID. The protocol (e.g., mem, mailto) is for routing. The same address can be reached via different protocols. | | In-process FIFO Mailbox | Pluggable Providers | Transport Agnostic: Seamlessly switch between memory/email/telegram/Mastodon | | Intra-node Communication | Cross-network, Cross-organization | Truly Distributed: Humans and machines participate as equals |

💡 Our Position: Not a JavaScript clone of Erlang, but a modern expression of the Actor philosophy — Using TypeScript's type safety + JavaScript's ecosystem vitality to make "address as the destination" a reality.

🚀 Why is Mailbox Exciting?

📮 What Problems Do We Solve?

| Traditional World | Mailbox World | |---|---| | ❌ "Service must be online to be called" | ✅ Delivery is Success — Don't care about the recipient's state | | ❌ "Humans must respond in real-time" | ✅ Human = An Address — Process at your own pace | | ❌ "Cross-org collaboration requires API integration" | ✅ Email is the API — Zero integration cost | | ❌ "Offline mobile app = Paralyzed functionality" | ✅ Offline is the Norm — Messages are automatically buffered |

💡 Fusing Inspirations: Erlang's Wisdom + The Real World

"Erlang taught us: Message passing is the cornerstone of robust systems. The real world reminds us: The postal system has worked for 500 years because it doesn't assume the recipient is waiting at the door!"

Mailbox combines the two:

  • Actor's Rigor: Each destination has an independent mailbox; messages are the only way to communicate.
  • Postal System's Inclusivity: Unified addresses, pluggable transport protocols.
flowchart LR
  subgraph Erlang[1986: Erlang]
    A[Lightweight Process] --> B[Message Passing]
    B --> C[Mailbox Buffer]
  end

  subgraph RealWorld[Real World]
    D[Postal Address] --> E[Letter Delivery]
    E --> F[Post Office Buffer]
  end

  Erlang -->|Inspired| Mailbox
  RealWorld -->|Inspired| Mailbox

  subgraph Mailbox[Today: Mailbox]
    G[Address as Destination\nmem://, mailto://] --> H[Message as Interaction]
    H --> I[Provider Buffer]
  end

📪 The Mailbox Address

A Mailbox address, or MailAddress, is the cornerstone of the system, acting as a unique, universal identifier for any destination. It follows the RFC 3986 URI specification.

  • Format: protocol:user@physical_address[/logical_address]
  • Example: mailto:[email protected]/utils/greeter

A MailAddress is composed of three parts:

  • protocol: Specifies the transport method (e.g., mailto for email, mem for in-memory bus). It tells the Mailbox which provider should handle the message.
  • user@physical_address: The Physical Mailbox Address. This is the globally unique, protocol-independent ID for a logical mailbox or service. The same physical address can be accessed via different protocols (e.g., mem:[email protected] and mailto:[email protected] point to the same logical entity).
  • /logical_address (Optional): An optional path that can be used for internal routing. For example, when used with tool-rpc, this can route a message to a specific tool within a larger service, allowing one physical address to serve as a unified gateway for multiple logical functions.

🚀 Quick Start

Get a taste of Mailbox's core power in just three steps:

  1. Installation

    npm install @mboxlabs/mailbox
  2. Write Code

    import { Mailbox, MemoryProvider } from '@mboxlabs/mailbox';
    
    // 1. Create a Mailbox instance and register a memory provider
    const mailbox = new Mailbox();
    mailbox.registerProvider(new MemoryProvider());
    
    // 2. Subscribe to an address and define how to handle messages
    const subscription = mailbox.subscribe('mem:[email protected]/inbox', message => {
      console.log(`Message received! From: ${message.from}`);
      console.log(`Body:`, message.body);
    });
    
    console.log("Mailbox is set up, listening on 'mem:[email protected]/inbox'...");
    
    // 3. Post a mail to that address
    await mailbox.post({
      from: 'mem:[email protected]/user-1',
      to: 'mem:[email protected]/inbox',
      body: { text: 'Hello, Mailbox!' },
    });
    
    // Clean up
    await subscription.unsubscribe();
  3. Run It

If you run the code above using ts-node or a similar tool, you'll see:

Mailbox is set up, listening on 'mem:[email protected]/inbox'...
Message received! From: mem:[email protected]/user-1
Body: { text: 'Hello, Mailbox!' }

This example demonstrates the basic loop of Mailbox: Subscribe to an address -> Post a message -> Receive and process. The address mem:[email protected]/inbox tells the Mailbox to use the mem (in-memory) protocol to deliver the message to the physical address [email protected] at the logical path /inbox. This format allows for clear and flexible routing.

📦 Ecosystem

| Package | Description | |---|---| | @mboxlabs/mailbox | The core mailbox system | | @mboxlabs/mailbox-input | Input Provider: An abstract class for human-computer interaction | | @mboxlabs/mailbox-email | Mailbox Provider: Email (SMTP, IMAP/POP3) |

📚 Learn More

🤝 Contributing

See CONTRIBUTING.md — we welcome all contributors!

Remember: In the world of Mailbox, every mailbox is an independent universe, and messages are the couriers that travel through spacetime 🌌