0xDocs 0x.limo

Docs / JavaScript SDK

@0xlimo/host

x1-host runs developers' Node.js game servers in a sandbox behind play.0x.limo. This page covers what your server gets, its limits, and the API that 0x deploy-server uses.

0x deploy-server uploads your game server to x1-host, the 0x service that runs it. Players reach it at https://play.0x.limo/x1/game/<app>/, over HTTP and WebSocket. <app> is your hosted site's name (the id in 0x.config.json). The package is the runner itself. You do not need to install it to deploy; the CLI talks to the service. Running your own instance is out of the scope of these docs.

Registry version: 0.1.1. 0x hosting runs 0.1.2.

#Your server's environment

VariableValue
PORT8080; listen on it
ZEROX_APPyour app (site) name
ZEROX_PUBLIC_URLwhere players reach you (https://play.0x.limo/x1/game/<app>/)
ZEROX_BCAST_URL, ZEROX_BCAST_SERVER_URLthe broadcast service, through a loopback forwarder (ws://127.0.0.1:7801/…)
ZEROX_BCAST_PLAYER_URLthe broadcast service's player endpoint, for your clients
ZEROX_BCAST_TOKENyour app's broadcast token
ZEROX_API_URLthe platform API, through a loopback forwarder (http://127.0.0.1:7802)

The host also sets each of these under its old name, X1_* (for example X1_BCAST_TOKEN), so servers written before the rename to 0x keep working; read ZEROX_* first and fall back to X1_*.

@0xlimo/net's connectServiceServer() and @0xlimo/iap/server's IapServer.fromEnv() pick these up with no arguments. Requests reach your server with the /x1/game/<app> prefix removed, and with X-Forwarded-Prefix: /x1/game/<app>.

#The sandbox

LimitValue on 0x hosting
CPU1
Memory512 MiB, including /tmp
Processes128
/tmp64 MiB tmpfs; everything else is read-only
Open files4096
Logs5 MB per file, 2 files
Bundle (upload, .tar.gz)50 MB
Installed size (after npm ci)400 MB
Running servers2 per developer, 20 in total
Networkloopback only: the broadcast service and the platform API are forwarded in; nothing else (no LAN, no internet)
  • Your code runs as an unprivileged user (node:24-bookworm-slim), with no capabilities and no-new-privileges. It sees only its own app directory, read-only.
  • Dependencies install with npm ci --ignore-scripts in a throwaway container. No package scripts run, and @0xlimo/* packages are bundled for you by the CLI.
  • Any exit restarts the server, with a backoff that doubles from 100 ms and resets after 10 s of running.
  • Paid games' servers are meant to take owners only, through @0xlimo/paygate, which is not deployed on 0x.limo.

#The developer API

0x deploy-server and 0x server … call these endpoints with your 0x developer token (0x login). They are on https://api.0x.limo/x1/host:

Method and pathPurposeCLI
PUT /x1/host/v1/servers/<app>?entry=server.mjs (body: the bundle .tar.gz)deploy and (re)start0x deploy-server
GET /x1/host/v1/serversyour servers
GET /x1/host/v1/servers/<app>status: {app, release, entry, deployedAt, url, state, container, usage, limits}0x server status
GET /x1/host/v1/servers/<app>/logs?tail=200plain text: the host's notes (install, start, restarts), then your console output; tail 1–5000 lines0x server logs
POST /x1/host/v1/servers/<app>/stop, …/startstop or start0x server stop, 0x server start
GET /x1/host/v1/public/servers/<app> (no auth){app, url, state, release, since}, for the catalog and launchers

Errors are JSON {"error": "…"}:

StatusWhen
400bad app name: lowercase letters, digits and -, 2–41 characters
401no or bad token (sign in with 0x login)
403the app belongs to another developer, or is not one of your hosted sites (0x publish --site <app> first)
404no hosted server
413bundle over 50 MB, or installed size over 400 MB
422the build failed (see 0x server logs), or the entry file is not in the bundle
429you already run 2 servers (0x server stop <app>)
503the hosting pool is full

A player request for a stopped or unknown app gets 404 no such game server.

The runner's internals are described in the reference.