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

buncord-cross-hosting

v1.0.5

Published

Native Bun implementation for cross-hosting Discord bots with buncord-hybrid-sharding.

Readme

buncord-cross-hosting

The ultimate cross-hosting library for Bun, optimized for ultra-low latency (<2ms) and native performance. Built to work seamlessly with buncord-hybrid-sharding.

Features:

  • Native Bun Networking: Uses Bun.listen and Bun.connect for maximum performance and minimum overhead.
  • Ultra Low Latency: Designed for inter-VPS communication with <2ms latency targets.
  • broadcastEval(): Execute code across all machines and clusters with ease.
  • Dependency-Free: Zero Node.js networking dependencies (net-ipc, etc. removed).
  • Rolling Restarts: Seamlessly update shard counts and machine configurations without downtime.
  • Hybrid-Sharding Integration: Specifically tailored for buncord-hybrid-sharding.

📦 Bundle Size Comparison: Cross-Hosting

| Package | Size (Unpacked) | Total Files | Dependencies | Install Weight (est.) | | :--- | :--- | :--- | :--- | :--- | | discord-cross-hosting | 153 kB | 48 | net-ipc, lodash, etc. | ~500 kB | | buncord-cross-hosting | 52.8 kB | 14 | NONE (Native Bun) | ~53 kB |

🚀 Result: ~89% savings on total installation weight and zero external networking dependencies!

Installation

bun add buncord-cross-hosting
bun add buncord-hybrid-sharding

Quick Start Guide:

1. Bridge (Coordinator)

The Bridge handles the coordination of shards across all machines.

import { Bridge } from 'buncord-cross-hosting';

const bridge = new Bridge({
    port: 4444,
    authToken: 'YOUR_SECURE_TOKEN',
    totalShards: 'auto',
    totalMachines: 2,
    shardsPerCluster: 10,
    token: 'YOUR_BOT_TOKEN',
});

bridge.on('debug', console.log);
bridge.listen();

bridge.on('ready', (addr) => {
    console.log(`Bridge listening on ${addr}`);
});

2. Client (Machine)

The Client runs on each VPS/Machine and connects to the Bridge.

import { Client } from 'buncord-cross-hosting';
import { Manager } from 'buncord-hybrid-sharding';

const client = new Client({
    agent: 'bot',
    host: 'bridge-vps-ip',
    port: 4444,
    authToken: 'YOUR_SECURE_TOKEN',
    rollingRestarts: true,
});

const manager = new Manager('./bot.ts', { totalShards: 'auto' });

client.on('debug', console.log);
client.connect();

client.listen(manager);

client.requestShardData().then(data => {
    manager.totalShards = data.totalShards;
    manager.spawn();
});

3. Shard (Bot)

Access cross-hosting features directly from your bot instance.

import { Shard } from 'buncord-cross-hosting';
import { Client } from 'buncord-hybrid-sharding';
import { Client as DiscordClient } from 'discord.js';

const client = new DiscordClient({ intents: [1] });
client.cluster = new Client(client);
client.crosshost = new Shard(client.cluster);

client.on('ready', async () => {
    const totalGuilds = await client.crosshost.broadcastEval('this.guilds.cache.size');
    console.log(`Total Guilds across all machines: ${totalGuilds.reduce((a, b) => a + b, 0)}`);
});

client.login('TOKEN');

API References

Refer to the source code for detailed type definitions. The library is written in pure TypeScript and leverages Bun's native types for networking.


Maintained by Luigi Colantuono