Skip to content
PEERLESSDocs

Dedicated and managed servers

Connect your own servers, or let PEERLESS run your Node backend with managed credentials.

Your own servers

Keep your existing servers and connect them with short-lived PEERLESS credentials. For regional endpoints, pick one in the browser:

const connection = await Peerless.sessions.connection({ region: "us-east" });
await connectExistingClient(connection.endpoint, connection.token);

On the server, verify the token with the provider helper from the managed Node kit:

server.mjs
import { verifyPeerlessProvider } from "./peerless/peerless-node.mjs";

const verified = await verifyPeerlessProvider(token, {
  gameId: process.env.PEERLESS_GAME_ID,
  buildId: process.env.PEERLESS_BUILD_ID,
  verificationUrl: "https://playpeerless.com/api/play/provider/verify",
});
// verified.playerId is the game-scoped player; verified.intent is the trusted launch intent.

Verify at lobby and match admission, on reconnect and on credential refresh. Browser names, rosters and IDs are presentation data, never proof of authorization.

Refresh managed credentials

Peerless.managed() keeps a short-lived credential current for managed and dedicated backends:

const credentials = Peerless.managed({
  onRuntime: (runtime) => networking.configure(runtime), // also runs on renewal
  onError: (error) => showConnectionError(error.message),
});
const runtime = await credentials.ready;
await connectExistingClient(runtime.endpoint, runtime.token);
// credentials.current(), credentials.refresh(), credentials.dispose()

Refreshing never creates a second client or replaces an active match. Never store the credential in saves, logs or local storage.

Managed Node

PEERLESS can run your compiled Node backend next to the browser client. Download the managed Node kit and extract it into a peerless/ folder.

  1. Build your browser client (Vite: base: "./") into dist/ and compile the server into server-dist/, listening on process.env.PORT and 0.0.0.0.
  2. Create server/package.json with exact production dependency versions and a lockfile.
  3. Copy peerless.example.json to peerless.json and set entrypoints, port, health routes and match capacity.
  4. Check and package:
npm install --prefix peerless
node peerless/doctor.mjs --manifest=peerless.json --client=dist --server=server-dist --hooks=peerless.adapter.json
npm test --prefix peerless
node peerless/package.mjs --client=dist --server=server-dist --server-package=server/package.json --manifest=peerless.json --out=.peerless/game.zip

Upload the ZIP and select Peerless-managed Node server. Health must report real matchClients and lobbyClients, readiness must reflect your data services, and /peerless/drain must stop new admissions while matches finish. Managed servers receive game-scoped PostgreSQL and Redis credentials for durable state.

Managed games wait for the player to press Play on their store page, so page views never start servers.

Forge Host

Forge Host gives a game one dedicated production container (normally 1 vCPU and 2 GB RAM, soft cap of 50 players) for $10 a month per game, separate from the Forge membership. Use manifest version 2 with multiplayer.hosting: { "mode": "forge", "persistentWorld": false } and enable it in the game editor. Peerless.managed() works unchanged.

Moving away

Your simulation, schemas and backend IDs remain yours. To move a managed backend, export its game database, verify a restore and keep identity aliases before draining the old release. Stop calling the SDK and the standalone path keeps working.