0xDocs 0x.limo

Docs / JavaScript SDK

JavaScript SDK

Partly live

The @0xlimo/* npm packages for web games on 0x, with their versions, status and purpose, and how to install them from the 0x registry.

The @0xlimo/* packages are published to the 0x npm registry at https://0x.limo/npm/. That registry serves @0xlimo/* itself and proxies every other package to npmjs, so a game can mix @0xlimo/* with ordinary dependencies.

#Install

The CLI installer (curl -fsSL https://0x.limo/sdk/install.sh | sh) adds @0xlimo:registry (and @x1:registry, for @x1/script and @x1/meshtorrent, which keep the old scope) to your ~/.npmrc (unless you set ZEROX_NO_NPMRC=1). After that a plain install works:

bash
npm install @0xlimo/platform

Without the installer, name the registry for the @0xlimo scope on the command line, or put it in the project's .npmrc:

bash
npm install @0xlimo/platform --@0xlimo:registry=https://0x.limo/npm/

All packages are ES modules ("type": "module"). The Node packages need Node.js 18 or later; the CLI, @0xlimo/byo-assets and @x1/meshtorrent need Node.js 20 or later.

#Packages

PackageRegistry versionStatusWhat it is for
@0xlimo/cli0.1.4live0x: init, dev, publish, submit, deploy-server.
@0xlimo/platform0.1.1live (subscriptions off)A typed client for the 0x API: sign-in, lobbies, leaderboards, stats and achievements, cloud saves, plays. Also the launcher bridge and server-side entitlement checks.
@0xlimo/net0.1.2livesocket.io and Colyseus adapters that send broadcasts through the 0x broadcast service and its player trees.
@0xlimo/swarm-sw0.1.1 (hosting runs 0.1.3)liveThe service worker and boot script that serve a hosted game's files from the player swarm, falling back to the origin.
@x1/meshtorrent0.2.0liveThe swarm toolkit: asset manifest builder, tracker, seeder and browser client. The CLI and hosting use it.
@0xlimo/iap0.1.0offIn-game purchases: ask the launcher to sell an item, then verify and consume receipts on your server.
@0xlimo/byo-assets0.1.1live (v0)"Bring your own assets": recipes that convert a player's own game files into web formats, deterministically.
@0xlimo/host0.1.1 (hosting runs 0.1.2)liveThe runner behind 0x deploy-server, which runs Node.js game servers in a sandbox.
@0xlimo/paygatenot publishednot deployedLets only owners into paid games' hosted sites and servers.

Switched off on 0x.limo

In-game purchases (@0xlimo/iap, SG_IAP) and subscriptions (@0xlimo/platform/launcher subscription calls and @0xlimo/platform/server, SG_SUBSCRIPTIONS) are deployed but switched off. While they are off, their API routes answer 404 (purchases) or {"error": "subscriptions are off"} (subscriptions). Their client code works unchanged once they are switched on.

#What a hosted site gets without npm

0x publish and the hosting builder copy the browser parts of the SDK next to your game, so a page can import them by relative URL without a bundler:

Site pathFrom
x1-sw.js, x1/boot.js, x1/host.js, x1/privacy.js@0xlimo/swarm-sw
x1/meshtorrent.mjs@x1/meshtorrent (browser bundle)
x1/net/index.js, x1/net/service.js, x1/net/wire.js, x1/net/mesh.js, x1/net/socketio.js, x1/net/colyseus.js, x1/net/wasm/*@0xlimo/net
x1/iap.js@0xlimo/iap (browser client)
x1.jsonwritten by the builder: manifest, timeoutMs, tracker, api (or {"swarm": false} for an origin-only site)

@0xlimo/platform is not copied. Install it with npm, or bundle it with your game.