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-spec

v0.9.0

Published

Pure rules, round, scheduling, live-room and embed contracts for Flaunch Game Modes

Readme

@flayerlabs/gamemode-spec

Define deterministic game rules and share the contracts used by Game Mode servers and browsers.

Requirements

Install the package with Node.js 20 or later:

pnpm add @flayerlabs/gamemode-spec

Choose an entry point

The package exports these public entry points:

| Entry point | Use it to | |---|---| | @flayerlabs/gamemode-spec | define a game module, commands, decisions, awards and views | | @flayerlabs/gamemode-spec/round | run or resume a game round with the shared round driver | | @flayerlabs/gamemode-spec/schedule | turn phase durations into fixed timestamps inside a round window | | @flayerlabs/gamemode-spec/live | share launch, round terms, economy, market, identity, player-ticket and live-room message types | | @flayerlabs/gamemode-spec/embed | parse registry and iframe data, then build canonical spend typed data |

Import only the entry points you need:

import { defineGame } from '@flayerlabs/gamemode-spec'
import { Round } from '@flayerlabs/gamemode-spec/round'
import { scheduleWithin } from '@flayerlabs/gamemode-spec/schedule'

Validate trusted-platform responses

The trusted parent should parse HTTP data before it chooses a gate, deploy or room:

import { parseGameRegistration } from '@flayerlabs/gamemode-spec/embed'
import { isLaunchContext } from '@flayerlabs/gamemode-spec/live'

const registration = parseGameRegistration(await registryResponse.json())
if (!registration) throw new Error('invalid game registration')

const launch: unknown = await adoptionResponse.json()
if (!isLaunchContext(launch)) throw new Error('invalid launch context')

Compare the parsed chain, coin and round with the trusted page selection as well. A valid shape does not prove that the response belongs to the coin the player opened.

gateOrigin is the default network surface for a registered game. A registration needs gameServerOrigins only when a creator gameplay server uses a separate reviewed origin. The parser accepts exact HTTPS origins and rejects wildcards, paths and credentials.

Define game rules

A GameModule owns action parsing, initial state, decisions, state changes, public views, player-specific views, wake times and reward limits.

Your rules must:

  • return the same output for the same state and command
  • read time from command.at
  • derive any random values from the supplied seed
  • award points only from decide
  • keep secrets out of the publicView return type
  • reject malformed and oversized actions in parseAction
  • declare the maximum points one player can earn in rewardBounds

Use Round in tests and offline tools. The production gate uses the same driver, so ordering and wake behaviour remain the same.

Follow the authoring contract

Read the game-building guide before writing a rules module.

Use the reference implementations for different game shapes:

The /embed entry point also exports GateReadiness, parseGateReadiness, gateReadinessTypedData and READINESS_TTL_SECONDS for non-spend gate identity proofs.

See what changed

This package ships CHANGELOG.md and MIGRATING.md, shared by all four Game Mode packages. Read them on GitHub: changelog and migration guide.