JavaScript SDK
Partly liveThe @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:
npm install @0xlimo/platformWithout the installer, name the registry for the @0xlimo scope on the command line, or put it in
the project's .npmrc:
npm install @0xlimo/platform --@0xlimo:registry=https://0x.limo/npm/@0xlimo:registry=https://0x.limo/npm/
@x1: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
| Package | Registry version | Status | What it is for |
|---|---|---|---|
| @0xlimo/cli | 0.1.4 | live | 0x: init, dev, publish, submit, deploy-server. |
| @0xlimo/platform | 0.1.1 | live (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/net | 0.1.2 | live | socket.io and Colyseus adapters that send broadcasts through the 0x broadcast service and its player trees. |
| @0xlimo/swarm-sw | 0.1.1 (hosting runs 0.1.3) | live | The service worker and boot script that serve a hosted game's files from the player swarm, falling back to the origin. |
| @x1/meshtorrent | 0.2.0 | live | The swarm toolkit: asset manifest builder, tracker, seeder and browser client. The CLI and hosting use it. |
| @0xlimo/iap | 0.1.0 | off | In-game purchases: ask the launcher to sell an item, then verify and consume receipts on your server. |
| @0xlimo/byo-assets | 0.1.1 | live (v0) | "Bring your own assets": recipes that convert a player's own game files into web formats, deterministically. |
| @0xlimo/host | 0.1.1 (hosting runs 0.1.2) | live | The runner behind 0x deploy-server, which runs Node.js game servers in a sandbox. |
| @0xlimo/paygate | not published | not deployed | Lets 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 path | From |
|---|---|
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.json | written 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.
