0xDocs 0x.limo

Docs / JavaScript SDK

@0xlimo/host reference

How x1-host (@0xlimo/host 0.1.2) sandboxes a game server, with its containers, forwarders, limits, the endpoints it serves and how it handles paid games.

The package has no typings. It exports the binary x1-host <config.json>, whose module is src/runner.js (startRunner(cfg)). This page describes what a developer's server sees. Operating an instance is not covered.

#Containers per app

ContainerRole
x1s-<app> (sidecar)owns the network namespace (--network none, loopback only). It bridges three unix sockets to loopback: players to 127.0.0.1:8080, 127.0.0.1:7801 to the broadcast service, and 127.0.0.1:7802 to the platform API.
x1g-<app> (your game)joins the sidecar's namespace and runs node <entry> as uid 10001 under tini. It has a read-only root and app, --cap-drop ALL, no-new-privileges, CPU, memory and pids quotas, and a /tmp tmpfs.
build (throwaway)unpacks the bundle and runs npm ci --ignore-scripts. It has network access for the registry, but runs no package scripts.

The image is node:24-bookworm-slim.

#Constants (src/sandbox.js)

NameValue
PORT8080
BCAST_PORT7801
API_PORT7802
LIMITS.cpus1
LIMITS.memoryMb512
LIMITS.pids128
LIMITS.tmpMb64
LIMITS.logMb5 (2 files)
LIMITS.nofile4096
LIMITS.bundleMb50
LIMITS.installedMb400
LIMITS.servers2 per developer
LIMITS.total20

#Names

  • App names match ^[a-z0-9][a-z0-9-]{1,40}$.
  • Entry files match ^[A-Za-z0-9_][A-Za-z0-9_./-]{0,120}\.(m?js|cjs)$. The default is server.mjs.

#Endpoints served

PathWhoNotes
/x1/game/<app>/… (HTTP and WebSocket upgrades)playersforwarded to the sandbox as /… with X-Forwarded-Prefix; ?x1_play= is removed before the request reaches the game; the front drops any Set-Cookie with a Domain
/x1/host/v1/servers[/<app>[/logs|/stop|/start]]developers (Bearer: 0x developer token)see @0xlimo/host
/x1/host/v1/public/servers/<app>anyone{app, url, state, release, since}
/healthzthe runner{ok, apps}

When the runner is configured with a paygate ("paygate": {"url", "markerDir"}), every /x1/game/<app>/ request for a paid site is checked by x1-paygate. It passes with the x1_pass cookie, scoped to Path=/x1/game/<app>/, or with ?x1_play=<play ticket>. Free games' answers and owners' passes are cached for 30 s. The 0x.limo runner has no paygate configured.