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

gameplate

v2.2.0

Published

Tiny, zero-dependency, fully-typed TypeScript framework for browser & headless games — state, loop, input, scenes. Bring any renderer.

Readme

gameplate

The 3 KB TypeScript game framework. Zero deps. Any renderer.

State. Loop. Input. Scenes. Selectors. Ship a game today.

npm CI gzip types license

👉 Docs · Live demo · API

npm install gameplate
import { createGame, defineActions } from 'gameplate';

const actions = defineActions<{ x: number }>()({
  moveBy: (s, dx: number) => ({ x: s.x + dx }),
});

const game = createGame({
  state: { x: 0 },
  actions,
  update: (state, dt, actions) => {
    if (game.keyboard.isDown('ArrowRight')) actions.moveBy(200 * dt);
  },
  render: (state) => draw(state), // 👈 your renderer, any tech
});

game.start();

That's the whole API surface. Read it, write it, ship it.


Why you'll like it

  • 🪶 3 KB gzipped. Smaller than a single sprite sheet. Zero runtime deps. Forever.
  • 🦺 TypeScript-first. strict: true + every noUnchecked* flag. Inference does the work — no as any, ever.
  • 🎯 Renderer-agnostic. Canvas · WebGL · WebGPU · PIXI · Three.js · DOM · terminal. Pick one. Switch tomorrow.
  • ⏱️ Deterministic loop. Variable timestep by default; opt into fixed-step + interpolation when physics need to be reproducible.
  • 🎮 Input, normalized. Keyboard + pointer + gamepad (with radial-deadzoned sticks and edge detection). Headless no-ops cleanly — same API on Node.
  • 🎬 Typed scene FSM. menu → start → playing with compile-time checks. Send a wrong event? TypeScript stops you.
  • 🧠 Memoized selectors. Reselect-style derived state, ~30 LOC, exact same shape.
  • 🎞️ Record & replay. Capture every dispatched action; replay it deterministically. Bug repro, regression tests, server-authoritative validation — all in JSON.
  • 🖥️ Browser & Node. Headless simulation, server-authoritative play, CI snapshot tests — same code, two runtimes.
  • 📦 Dual ESM + CJS. publint clean. Provenance signed. Tree-shakeable.

In 30 seconds

type State = { player: { x: number; y: number }; score: number };

const actions = defineActions<State>()({
  move: (s, dx: number, dy: number) => ({
    ...s,
    player: { x: s.player.x + dx, y: s.player.y + dy },
  }),
  score: (s, pts: number) => ({ ...s, score: s.score + pts }),
});

const game = createGame({ state: { player: { x: 0, y: 0 }, score: 0 }, actions });

game.actions.move(10, 0); // ✅ typed
game.actions.move('lol', 0); // ❌ TS error — caught at compile time

That's state + actions. Add update for input handling, render for drawing, and you have a game.


What's in the box

| | | | :--------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- | | createGame | One-call setup — state + loop + input wired together. | | createStore | The underlying typed store (subscribe, getState, setState). | | defineActions | Curried generic that gives perfect IntelliSense without retyping S. | | createLoop | Bare loop — variable or fixed-step with interpolation alpha. | | createKeyboard / createPointer / createGamepad | Normalized input — keys, pointer, and Standard Gamepad with edge detection. No-op stubs on the server. | | createMachine | Compile-time-checked finite state machine for scenes/menus. | | createSelector | Reselect-style memoization, ~30 LOC. | | createRecorder / replay | Deterministic record + replay of every action. JSON-serialisable. |

→ Full API reference


Built for every stack

gameplate doesn't ship a renderer — it ships the glue. Drop into:

three.js PIXI v8 regl WebGPU Canvas 2D

Switch renderers without changing one line of game logic. Patterns for each →


How it fits together

   ⌨ keyboard ─┐
   🖱 pointer ─┼──▶ actions ──▶ store ──▶ selectors ──▶ render ──▶ 🎨 your renderer
   🛰 network ─┘                  │                       ▲
                                  ▼                       │
                              scene FSM ──────────────────┘

         loop (dt, alpha) ──▶ update ──▶ actions

A handful of composable functions. Pick the ones you need. Ignore the rest.


Quality bar

  • ✅ 141/141 tests, ≥ 90 % line coverage
  • ✅ CI matrix: Node 20 / 22 / 24 × Ubuntu / macOS / Windows
  • publint + @arethetypeswrong/cli clean on every PR
  • ✅ Size limit: < 4 KB gzipped ESM, enforced in CI
  • ✅ CodeQL security analysis on every PR
  • ✅ npm provenance on every release (OIDC trusted publishing)

Contributing

PRs welcome. See CONTRIBUTING.md. Architecture decisions are recorded in DECISIONS.md.

git clone https://github.com/yankouskia/gameplate
cd gameplate
pnpm install
pnpm test:watch

License

MIT © Alex Yankouski · Sponsor →

If gameplate saved you a weekend, ⭐ star it — it's the easiest way to say thanks.