MIT licensed

JS-modules

Small, dependency-free pieces for single-file browser games and apps. Copy one file, get one fix.

<script src="save-kit.js"></script>orconst SaveKit = require('./save-kit.js')
49 modules and tools0 dependenciesWebAssembly first, JS fallbackMIT

What it is and how it works

JS-modules is a shelf of small browser libraries cut out of two shipped games. Each module is one file with no dependencies. Add it with a script tag or require, call it, and read its folder README for limits. Every folder also has a demo page that opens straight from disk.

The pieces are for more seasoned users and developers. The apps and games built from them need no install, no administrative privileges and no special computing knowledge.

Why it exists

Only parts not already covered by open source were kept. These are the small fixes learned by shipping real games to phones and desktops: a hold that dies on pointercancel, a save overwritten by a NaN, a curtain stuck out of place on Android. Each module README names the closest existing project and says how this one differs.

Highlights

One file each

Copy only what you need. No build step, no package tree.

Fast by default

Hot paths run in WebAssembly with SIMD, with plain JavaScript when wasm is missing.

Tested in three browsers

Firefox, Chromium and WebKitGTK. Every release names the versions it ran in.

Works with AI helpers

AGENTS.md, llms.txt and modules.json describe every piece for people and assistants.

Quick start

Save a game safely in three lines.

<!-- copy modules/save-kit/save-kit.js next to your page -->
<script src="save-kit.js"></script>
<script>
  var kit = SaveKit.create({ key: 'mygame', schema: { score: 'num' } });
</script>

Compared with the usual choice

lfc-pack against Parquet on 260 MB of real FHIR records, Firefox and Chromium.

MeasureParquetlfc-pack
Pack time6.1 s2.05 s
File size17.14 MB7.03 MB

Smaller and faster than the usual choice

Measured in the test browsers against the common alternative. Both charts come from the module READMEs.

memory-compression: size of 300,000 network links (MB, lower is better)

JSON text
57.3 MB
cbor-x
20.9 MB
msgpackr
20.0 MB
memory-compression
7.85 MB

Fast mode, restored exactly. About 2.5 times smaller than msgpackr, and it unpacks as fast or faster in all four browsers. Chromium, Firefox, WebKitGTK and GNOME Web. It loses on download size: 84.6 KB gzipped against 11 KB for msgpackr.

text-columns: read CSV (relative time, lower is better)

Papa Parse
8x to 11x
text-columns
1x

Pick a piece

A small selection. The full list of 49 is in the repository README.