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

@flayerlabs/gamemode-gate

v0.2.0

Published

Server-authoritative rooms, economy, admission and registry for Flaunch Game Modes

Readme

@flayerlabs/gamemode-gate

Run authoritative Game Mode rooms, spending allowance, admission and game discovery. You can run SDK rules or accept point awards from an existing authoritative game server.

Requirements

You need:

  • Node.js 20 or later
  • PostgreSQL
  • @flayerlabs/gamemode-spec at the matching SDK version

Install the package and direct database dependency:

pnpm add @flayerlabs/gamemode-gate @flayerlabs/gamemode-spec pg

Start a local gate without a chain

createDemoGate starts the real gate flow with a stand-in wallet and no chain access. It expects PostgreSQL at postgres://postgres:[email protected]:55439/gamemode unless you set DATABASE_URL.

import { createDemoGate } from '@flayerlabs/gamemode-gate'
import { rules, type Config } from './game/rules.js'

const config: Config = {
  rounds: 3,
  ceiling: 10,
  points: 500,
  roundMs: 10_000,
}

const demo = await createDemoGate({
  game: rules,
  config,
  gateOrigin: 'http://127.0.0.1:4000',
})

await demo.app.listen({ host: '127.0.0.1', port: 4000 })

This path uses the real room, database, socket and signed spend authorisations. It records purchases instead of submitting them to a chain. Do not use createDemoGate in production.

Build a production gate

Run migrate(pool) before the gate accepts traffic.

If you already ran the pre-release schema, run migrate(pool) again. An empty setup upgrades in place. Delete any pre-release test rounds first because their game ID and point limit are unknown.

A createGate setup needs:

  • Sessions configured with the page domain and the gate's exact public origin
  • Claims, Ledger and PayloadSigner for spending authorisations
  • pointsPerDollar, usdPerEth and the allowed game origins

Add the chain services used by your deployment:

  • Discovery verifies each launch before the gate adopts it
  • Settlement updates recorded spending from the chain

Run one gate process for each game. The current room writer does not support multiple replicas.

Use createTurnstileAdmit if the trusted parent supplies Cloudflare Turnstile evidence. The policy checks session creation. Game action and claim policy remain the gate operator's responsibility.

Read the production gate guide before deploying a gate.

Connect an existing game server

Use createGameServerGate() when your server already owns gameplay and scoring:

import { createGameServerGate } from '@flayerlabs/gamemode-gate'

const awardToken = process.env.AWARD_TOKEN
if (!awardToken || awardToken.length < 32) {
  throw new Error('AWARD_TOKEN must contain at least 32 characters')
}

const app = createGameServerGate({
  pool,
  sessions,
  claims,
  discovery,
  settlement,
  gameId: 'my-game',
  maxPointsPerPlayer: 10_000,
  awardToken,
  pointsPerDollar: 500,
  usdPerEth: 3_000,
  allowedOrigins: ['https://game.example'],
})

The award token must contain at least 32 characters. Keep it on your game server. Never send it to the browser.

Use a stable, distinct gameId for each game. It scopes durable rounds and awards when games share a PostgreSQL database.

Your server adds points with POST /internal/rounds/:id/awards. The gate checks the token, event ID, wallet, round window and per-player limit before it changes the ledger. It also makes identical retries safe.

Use the external game-server steps for the request format, responses and deployment checks. Do not call the ledger or signer directly.

Run the central game registry

createGameRegistry provides:

  • public GET /games/:chainId/:coin lookups for trusted Flaunch pages
  • authenticated internal routes for the Flaunch launch backend to pin or disable a registration

The registry is a central Flaunch service. Do not run it inside a creator gate. Its writerToken must contain at least 32 characters and stay on the launch backend.

Read the current request and response behaviour in the game registry source.