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

mereb-netcode

v1.0.0

Published

Zero-cost, serverless WebRTC P2P multiplayer netcode & matchmaking SDK for web & indie games (Three.js, Godot, React, Poki, CrazyGames).

Readme

⚔️ Mereb — Multiplayer Netcode & Matchmaking SDK

npm version License: MIT Bundle Size WebRTC P2P Godot 4

Zero-cost, serverless WebRTC P2P multiplayer netcode & matchmaking SDK for web & indie games (Three.js, Godot 4, React, Phaser, Poki, CrazyGames).

Eliminate expensive dedicated game servers ($100s/mo). Mereb routes gameplay directly peer-to-peer over low-latency WebRTC DataChannels while offloading matchmaking to serverless edge workers ($0/mo on Cloudflare / PartyKit).


⚡ Features

  • 🌐 Serverless P2P Architecture — 60Hz gameplay streams directly between players over WebRTC UDP data channels. Zero server computing costs.
  • 📦 Binary Packing & Compression — Built-in BinaryWriter / BinaryReader packs full game state into tiny ~35–50 byte ArrayBuffer packets (85% bandwidth reduction vs JSON).
  • 🎯 Hermite Snapshot Interpolation — SnapshotInterpolator eliminates jitter and delivers buttery 60/120fps remote entity movement.
  • 🤖 Smart Bot Fallback — Automatic 8-second matchmaking timeout pairs waiting players with local bots so queues never feel empty.
  • 🛡️ Poki & CrazyGames Portal Hooks — PortalManager prevents WebRTC socket drops during rewarded breaks and commercial ads.
  • 🕹️ Godot 4 Addon — Includes a ready-to-use GDScript wrapper (addons/mereb/) for exporting HTML5 games from Godot.
  • 🎨 Drop-in Arcade Lobby — Optional 3D tactile UI with 4-letter room codes, shareable invite links, and Quick Play buttons.
  • 📶 Live Network Quality Probe — Real-time ping (RTT), jitter, and packet loss monitoring with automatic TURN fallback.

📦 Installation

NPM

npm install mereb

CDN / Direct Script Tag

<script src="https://unpkg.com/mereb/dist-sdk/mereb.umd.js"></script>

🚀 30-Second Quick Start

import { MerebClient, MerebLobby } from 'mereb';

// 1. Initialize SDK
const net = new MerebClient({
  host: 'localhost:1999', // or your-project.partykit.dev in production
  botTimeoutMs: 8000,     // start bot if no player joins in 8s
  autoJoinFromUrl: true   // auto-connects if ?room=XXXX is in URL
});

// 2. (Optional) Mount Drop-in Arcade Lobby
const lobby = new MerebLobby(net, { title: '⚔️ ARENA BATTLE' });

// 3. Handle Match Lifecycle
net.on('match-start', ({ role, isHost, localId, peerId, isBot }) => {
  console.log(`Match started! Role: ${role}, Opponent: ${peerId}`);

  if (isHost) {
    // Host: broadcast authoritative 60Hz game state
    game.onTick = (state) => net.sendState(state);
  } else {
    // Client: stream inputs to host
    input.onInput = (keys) => net.sendInput(keys);
  }
});

// 4. Receive State & Events
net.on('state', (state) => game.applyState(state));
net.on('input', (input) => game.applyInput(input));
net.on('event', ({ name, data }) => {
  if (name === 'player-scored') sound.playGoal();
});
net.on('peer-disconnect', () => {
  ui.showToast('Opponent forfeited — You Win! 🏆');
});

💎 Binary Packing (85% Bandwidth Savings)

Pack your game state into a tiny 40-byte binary packet:

import { BinaryWriter, BinaryReader } from 'mereb';

// Host: Encode
const writer = new BinaryWriter();
writer
  .writeUint8(1)               // packet type
  .writeFixed16(player.x, 100) // 2 decimals
  .writeFixed16(player.z, 100)
  .writeUint8(player.health)
  .writeBoolean(player.isShielded);

net.sendBinary(writer.getView());

// Client: Decode
net.on('binary', (arrayBuffer) => {
  const reader = new BinaryReader(arrayBuffer);
  const type = reader.readUint8();
  const x = reader.readFixed16(100);
  const z = reader.readFixed16(100);
  const health = reader.readUint8();
  const isShielded = reader.readBoolean();
});

🎮 Godot 4 Web Export

Copy the addons/mereb/ directory to your Godot 4 project:

extends Node

@onready var net = MerebMultiplayer.new()

func _ready():
    add_child(net)
    net.match_started.connect(_on_match_started)
    net.state_received.connect(_on_state_received)
    net.connect_to_server("your-project.partykit.dev")
    net.quick_play()

func _on_match_started(role, peer_id, is_bot):
    print("Match started! Role: ", role)

func _on_state_received(data):
    # Update remote player position
    $RemotePlayer.position = Vector2(data.x, data.y)

🌍 Zero-Cost Cloudflare Signaling Deployment

Deploy your own worldwide serverless signaling & matchmaking server in 60 seconds:

# 1. Login to PartyKit (powered by Cloudflare Workers)
npx partykit login

# 2. Deploy your signaling server ($0/month on free tier)
npx partykit deploy

Then point MerebClient to your deployed URL:

const net = new MerebClient({
  host: 'mereb-arena.your-name.partykit.dev'
});

📖 Detailed Guides


📄 License

MIT © Dawit Baslyos