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

mrpc-client

v1.0.1

Published

mRPC/1.0 — Matrix Remote Procedure Call. One endpoint, zero routing. Data-driven API protocol.

Readme

mrpc-client

Official JavaScript/Node.js SDK for mRPC/1.0 protocol.

One endpoint. Zero routing. Data-driven API.

Why mRPC?

| Problem with REST | mRPC Solution | |-------------------|---------------| | 50 URL routes | 1 endpoint | | GET/POST/PUT/DELETE | 1 field cmd | | Routing in code | Registry in data | | Separate documentation | Self-documenting API | | Add endpoint = code | Add command = JSON |

Install

npm install mrpc-client

HTTP Client

const mRPC = require('mrpc-client');

const api = new mRPC('http://localhost:8088');

// Call any command
const items = await api.call('get_items', { state: 'active' });
console.log(items.data);    // [{id: 1, name: "Widget"}, ...]
console.log(items.count);   // 3
console.log(items.ms);      // 0.42

// Don't know the API? Ask it
const help = await api.help();
console.log(help.data.commands);  // {ping: {type: "raw"}, get_items: {...}, ...}

// Describe a specific command
const info = await api.describe('add_item');
console.log(info.data.params);    // ["name", "price"]
console.log(info.data.validate);  // {name: "required|min:2", ...}

// Health check
const pong = await api.ping();    // {ok: true, data: {pong: true}}

Auth

const api = new mRPC('http://localhost:8088', 'your-bearer-token');

// Token is sent as Authorization: Bearer header
const secret = await api.call('admin_only');

WebSocket Client

Real-time events, subscriptions, and bidirectional communication.

const mRPCSocket = require('mrpc-client/ws');

const ws = new mRPCSocket('ws://localhost:8090/ws');

Subscribe to events

// Wildcard patterns
await ws.subscribe(['product.*']);
await ws.subscribe(['order.created', 'order.updated']);

// Listen
ws.on('product.created', (data) => {
    console.log('New product:', data.name);
});

ws.on('order.*', (data, event) => {
    console.log(`${event}:`, data);
});

Channels (multi-tenancy)

// Subscribe to events in a specific channel
await ws.subscribe(['*'], 'tenant:42');
await ws.subscribe(['chat.*'], 'room:general');

Call commands over WebSocket

// Same API as HTTP, but through persistent connection
const result = await ws.call('get_items', { state: 'active' });
console.log(result.data);

Built-in resilience

  • ✅ Auto-reconnect with exponential backoff
  • ✅ Heartbeat every 25 seconds
  • ✅ Request/response correlation via unique IDs
  • ✅ Automatic re-subscription after reconnect

Response Format

Every response follows the same structure:

// Success (query)
{ok: true, cmd: "get_items", data: [...], count: 3, ms: 0.42, v: "mRPC/1.0"}

// Success (exec)
{ok: true, cmd: "add_item", changes: 1, ms: 1.2, v: "mRPC/1.0"}

// Error
{ok: false, cmd: "bad", error: {code: "unknown_cmd", message: "..."}, v: "mRPC/1.0"}

Error Codes

| Code | Meaning | |------|---------| | unknown_cmd | Command not found | | missing_param | Required parameter missing | | validation_failed | Input validation failed | | access_denied | Insufficient permissions | | not_found | Resource not found | | internal | Server error |

Zero Dependencies

  • HTTP client uses native fetch (Node 18+) or XMLHttpRequest (browser)
  • WebSocket client uses native WebSocket (browser) or ws (Node)
  • No build step, no bundler, no transpiler

Links

License

MIT © Zephyr Muldash