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

@gameflow.gg/gameserver-sdk

v0.1.2

Published

Official GameFlow game server SDK for Node.js. Lifecycle, health and player tracking for dedicated game servers.

Readme

@gameflow.gg/gameserver-sdk

Official GameFlow SDK for Node.js game servers: server lifecycle, automatic health reporting and player tracking. Zero runtime dependencies, Node 18.17+.

npm install @gameflow.gg/gameserver-sdk

Quickstart

import { GameFlow, ServerFullError } from '@gameflow.gg/gameserver-sdk';

const gf = await GameFlow.connect();

// Start your server on the assigned port, then signal readiness.
// Health reporting starts automatically; you never ping anything yourself.
myServer.listen(gf.ports.default ?? 7777);
await gf.ready();

// Track players as they join and leave
try {
  await gf.players.connect(client.sessionId);
} catch (error) {
  if (error instanceof ServerFullError) client.reject('server full');
}
await gf.players.disconnect(client.sessionId);

gf.players.count(); // current player count (synchronous)
gf.players.list(); // connected session ids
gf.players.capacity(); // max players configured for your game

// Shut down cleanly when the match ends (or on SIGTERM)
process.on('SIGTERM', async () => {
  await gf.shutdown();
  process.exit(0);
});

Local development

Run your server on your machine with no extra setup: when it is not running on GameFlow the SDK switches to local mode automatically. Lifecycle calls are simulated and player tracking works against an in-memory list, so the same code runs unchanged in both places. See env vars below to simulate payloads and capacity.

API

| Member | Description | | ----------------------------------------- | ---------------------------------------------------------------------- | | GameFlow.connect(options?) | Connects to the GameFlow runtime (with retries) or enters local mode | | gf.ready() | Marks the server ready for players and starts the health heartbeat | | gf.shutdown() | Cleanly shuts the server down (idempotent) | | gf.players.connect(id) | Registers a player session | | gf.players.disconnect(id) | Unregisters a player session, resolves false if it was not connected | | gf.players.count/list/capacity | Synchronous reads of the player list | | gf.payload() | The launch payload (opaque string) set when the server was requested | | gf.onPayloadChange(cb) | Fires when the payload changes (e.g. on match assignment) | | gf.watch(cb) | Streams server updates (state, address, ports) | | gf.info() | Current server details | | gf.ports.default / gf.ports.get(name) | Ports assigned by the platform | | gf.region, gf.buildId, gf.mode | Server environment details |

Connect options

GameFlow.connect({
  mode: 'auto', // 'auto' | 'sidecar' | 'local'
  healthIntervalMs: 5000,
  connectTimeoutMs: 30000,
  requestTimeoutMs: 3000,
  logger: null, // silence the SDK, or pass your own Logger
  onHealthDegraded: () => {}, // sustained health reporting failures
});

Errors

All SDK errors extend GameFlowError and carry a stable code:

| Error | Code | When | | ----------------------------- | -------------------------- | ------------------------------------- | | PlayerAlreadyConnectedError | PLAYER_ALREADY_CONNECTED | Session id already in the player list | | ServerFullError | SERVER_FULL | Player list at capacity | | PlayerTrackingDisabledError | PLAYER_TRACKING_DISABLED | Game configured with max players = 0 | | SidecarUnavailableError | SIDECAR_UNAVAILABLE | GameFlow runtime unreachable | | NotConnectedError | NOT_CONNECTED | SDK used after shutdown() | | RequestFailedError | REQUEST_FAILED | Unexpected runtime response |

Environment variables

Set by the platform on every server:

| Variable | Meaning | | ----------------------- | ----------------------------- | | GAMEFLOW_DEFAULT_PORT | Primary port to listen on | | GAMEFLOW_<NAME>_PORT | Additional named ports | | GAMEFLOW_REGION | Region the server runs in | | GAMEFLOW_BUILD_ID | Build id of the running image |

Read by the SDK for local development:

| Variable | Meaning | | ---------------------- | ---------------------------------------------------- | | GAMEFLOW_SDK_MODE | Force local or sidecar mode | | GAMEFLOW_MAX_PLAYERS | Simulated player capacity in local mode (0 disables) | | GAMEFLOW_PAYLOAD | Simulated launch payload in local mode |

Important: player tracking keeps your server alive

GameFlow shuts down servers that report zero connected players past your organization's idle timeout. Call gf.players.connect() as soon as a real player joins. If your game has "Max Players per Server" set to 0, player tracking is disabled entirely and the SDK logs a warning at startup.

License

Apache-2.0