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

@playhub/cloudflare

v0.1.1

Published

Run a playhub hub on Cloudflare: a Durable Object hosting the registry, speaking the playhub protocol over WebSocket.

Readme

@playhub/cloudflare

Run a playhub hub on Cloudflare instead of a server: a Worker routes lobby connections to a Durable Object that runs the same registry and gateway as the Node hub. Clients don't change; point HubClient at the Worker's URL.

new HubClient({ url: 'wss://playhub.<you>.workers.dev/v1/lobby', game: 'my-game', player });

Deploy

  1. Edit wrangler.toml: your games under [vars] GAMES (same format as games.json, see ADDING-A-GAME) and TURN_PROVIDER.
  2. Secrets with wrangler secret put, e.g. CLOUDFLARE_TURN_KEY_ID and CLOUDFLARE_TURN_API_TOKEN for TURN_PROVIDER=cloudflare.
  3. pnpm --filter @playhub/cloudflare deploy (or npx wrangler deploy in this folder).

Durable Objects with SQLite storage are available on the Workers Free plan; check Cloudflare's current limits and pricing for your traffic.

Or use it inside a Worker of your own:

import { handleLobbyRequest, PlayhubHub, type Env } from '@playhub/cloudflare';
export { PlayhubHub };
export default {
  async fetch(req: Request, env: Env) {
    return (await handleLobbyRequest(req, env)) ?? myOtherRoutes(req, env);
  },
};

How it maps to the Node hub

| Node hub | Here | | ------------------------------------- | --------------------------------------------------------------------- | | one server, one Registry | one Durable Object (hub); ?game=<id> gives a game its own | | Fastify WebSocket route /v1/lobby | the Worker routes /v1/lobby to the object, which accepts the socket | | Gateway: caps, message budget, line | the same Gateway | | X-Forwarded-For behind Caddy | CF-Connecting-IP | | .env, games.json | wrangler.toml [vars] and secrets | | /healthz (counts from localhost) | /healthz is {ok:true}; counts via PlayhubHub.health() (RPC) |

Differences to know

  • No round-trip measurement. Workers can't send WebSocket pings, so the synchronized start doesn't subtract half of each player's round trip; countdowns can end a few tens of ms apart.
  • Rooms live in memory. The object uses ordinary WebSockets (not hibernation), so it stays in memory while anyone is connected, and Cloudflare bills its duration for that time. Once the last connection closes it may be evicted, along with any seat still held for a player who dropped. Hibernation would need the registry's state persisted; that is future work.
  • Needs nodejs_compat, for the node:crypto HMAC used by coturn credentials.
  • @playhub/hub is a dependency (for @playhub/hub/core), so Fastify gets installed even though nothing here imports it.

Develop

pnpm --filter @playhub/cloudflare dev runs it locally (wrangler dev). The tests start wrangler dev with test/wrangler.toml and drive it with real HubClients.

MIT licensed.