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

@moneypot/hub

v1.20.6

Published

Official MoneyPot hub server

Readme

@moneypot/hub

@moneypot/hub is our official GraphQL game server for building games for MoneyPot.com.

  • Extend it with custom tables and game logic.
  • Give it an api key for each controller you've registered on each casino.
  • It will automatically sync users, their balances, deposits, and withdrawals.

Example implementations:

  1. https://github.com/moneypot/controller-template/: An template hub server that comes with an example of a custom game implementation.

Manual

View our docs: https://docs.moneypot.com

Install

$ pnpm install @moneypot/hub

Usage

import {
  type ServerOptions,
  defaultPlugins,
  startAndListen,
  MakeOutcomeBetPlugin,
} from "@moneypot/hub";
import path from "path";

const options: ServerOptions = {
  // PostgreSQL schemas to expose to the GraphQL API
  // This allows your application-specific tables to be accessible through GraphQL
  extraPgSchemas: ["app"],

  plugins: [
    // These are required for the hub server to function
    ...defaultPlugins,
    // Add your custom plugins here to extend server functionality
    MakeOutcomeBetPlugin({
      houseEdge: 0.01,
    }),
  ],

  // File path where the generated GraphQL schema definition will be saved
  exportSchemaSDLPath: path.join(import.meta.dirname, "../schema.graphql"),

  // Optional: Directory containing migration files for your database
  // When enabled, the server will automatically apply pending migrations on startup
  userDatabaseMigrationsPath: path.join(
    import.meta.dirname,
    "../automigrations",
  ),
};

startAndListen(options)
  .then(({ port }) => {
    console.log(`Listening on ${port}`);
  })
  .catch(console.error);

Dashboard

When the server is running, visit its admin dashboard at the /dashboard route.

You'll need an api key from your hub database:

insert into hub.api_key default values returning key;

Changelog

You should always keep your hub server up to date as soon as possible. Never install an old, intermediate version: it may leave you without an automatic upgrade path.

1.20.x

Adds liability tracking for multistage games (mines, crash, etc.) that lock up bankroll before resolution.

  • (DB migration) New hub.bankroll.liability column
  • (DB migration) New hub.liability table (each row ties to a game row like app.mines_game)
  • dbCreateLiability() to reserve bankroll when a game starts, dbResolveLiability() to release it when it ends
  • Available bankroll = amount - liability
  • Type renames: DbBalanceDbPlayerBalance, DbBankrollDbHouseBankroll
  • dbLockedHouseBankroll() now returns DbLockedHouseBankrollWithAvailable (has available field)

1.19.x

  • All of hub's internal graphql-schema-modifying plugins have been moved to hub's set of required plugins.
  • Added FAILED take request auto-handling.
  • Exposed a @moneypot/hub/test module for end-user server testing.

1.18.x

  • MakeOutcomeBetPlugin replaced by HubGameConfigPlugin({ outcomeBetConfigs, customGameConfigs })
  • Added graphql query hubRiskLimits(gameKinds: [DICE]) to get risk limits for the game kinds configured in HubGameConfigPlugin.
    • This lets experiences display the max payout for each kind of bet.

1.17.x

  • Postgres transactions now default to read committed (postgres default)
  • Added cli script npx db-migrate <userMigrationDirectory> to run hub and user db migrations on SUPERUSER_DATABASE_URL.
    • Note: hub still runs any non-run migrations on server start

1.16.x

  • Added a simple built-in chat system.
  • You can opt-out of the chat system by passing startAndListen({ ..., enableChat: false }).

1.15.x

  • Added a "playground" casino (hub.casino.is_playground = true) that lets skin devs create ephemeral sessions for testing.
  • Added hubCreatePlaygroundSession mutation to create a playground session.
    • It's a drop-in replacement for hubAuthenticate({ userToken, baseCasinoUrl }) when you're testing your experience outside of the MoneyPot.com iframe (thus you don't have a userToken).
  • You can opt-out of allowing playground sessions by passing startAndListen({ ..., enablePlayground: false }), but remember that the objective of this system is to make it easier for developers to build experience frontends that bet against your server.

1.14.x

  • Added preimageHash field to HubHashChain to expose the preimage hash for a hash chain if it's revealed.

1.13.x

  • Added hubRevealHashChain mutation to generate a preimage hash for the chain and mark it as inactive.

1.12.x

1.11.x

  • Migrated database-related "globals" into a ServerContext object.
    • Changed configureApp(app: ExpressServer) to configureApp(args: { app: ExpressServer, superuserPool: pg.Pool })
    • In a postgraphile plugin, you can access the superuser database pool via const $superuserPool = context().get("superuserPool");

1.9.x

  • Added a required risk policy to makeOutcomeBet and a reusable validateRisk function that can be used in custom bet plugins / endpoints to decide how much bankroll you want to risk on a bet.

1.8.x

  • Added pino for logging.
  • Added LOG_LEVEL environment variable to set the logging level. (default: info)
  • Added LOG_PRETTY environment variable to force enable/disable pretty logging (requires npm install pino-pretty).
  • Exposed @moneypot/hub/logger. Example: import { logger } from "@moneypot/hub/logger";

1.7.x

Updated Hub to handle breaking changes in moneypot-server GraphQL transfer API.

1.6.x

Hub now maintains a websocket connection to the casino API so that it can respond immediately to puts and takes.

1.5.x

Migrated to Postgraphile beta.42 which has new plugin and polymorphism systems:

Read more:

  • https://www.graphile.org/news/20250607-last-epic-solved/
  • https://grafast.org/grafast/polymorphism