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

@tikron/schema

v0.6.0

Published

Binary delta state-sync codec for Tikron — schema definitions with type inference, full/delta encoding, and wire-compatible serialization.

Readme

@tikron/schema

A tiny binary state codec for Tikron. Describe your game state once, then encode it to compact bytes — either a full snapshot or a delta carrying only what changed since the last frame. This is how @tikron/server's IoArenaRoom syncs high-frequency state cheaply. Zero dependencies; runs on the server, in the browser, and in Workers.

npm i @tikron/schema

Describe, encode, delta

import { schema, mapOf, encodeFull, encodeDelta, applyDelta } from "@tikron/schema";

// Fields are primitives ("u8".."u32", "i32", "f32", "f64", "bool", "str") or nested codecs.
const Player = schema({ x: "f32", y: "f32", hp: "u16" });
const World = schema({ tick: "u32", players: mapOf(Player) });

const prev = { tick: 1, players: { a: { x: 0, y: 0, hp: 100 } } };
const next = { tick: 2, players: { a: { x: 5, y: 0, hp: 100 } } };

const snapshot = encodeFull(World, next);        // full state — send to new joiners
const patch = encodeDelta(World, prev, next);    // only what changed — a few bytes
const restored = applyDelta(World, prev, patch); // deep-equals `next` on the client

Deltas diff structurally: unchanged fields, map entries, and list items cost nothing on the wire, so a 128-entity world where two things moved sends two things.

Quantize continuous fields

For positions, velocities, angles, and health, quant(min, max, step) snaps a number to a fixed grid and stores it in the smallest integer that spans the range — 1–4 bytes instead of an f32's 4 — and because it compares the quantized bucket, sub-step jitter no longer counts as a change and drops out of deltas entirely. It's the main bandwidth lever for a dense realtime world.

import { schema, mapOf, quant } from "@tikron/schema";

const Player = schema({
  x: quant(0, 2000, 0.1),          // 0.1-unit grid on a 2000-unit map → u16 (2 bytes)
  y: quant(0, 2000, 0.1),
  aim: quant(0, Math.PI * 2, 0.001), // heading in radians → u16
  hp: "u8",
});

Key API

Composers: schema(shape), prim(type), quant(min, max, step), mapOf(child), listOf(child), optionalOf(child), enumOf(...values), str(maxLen) — each returns a Codec<T> with a fully inferred T. Wire ops: encodeFull, encodeDelta, encodeDeltaOrNull (delta, or null when nothing changed), decodeFull, applyDelta. Low-level buffers: ByteWriter, ByteReader.

Links & license

tikron.dev · AGENTS.md. Licensed under the Tikron License 1.0 (adapted from FSL-1.1) — converts to Apache-2.0 one year after each release. See LICENSE.