Quickstart

Add multiplayer to a web game with one room file.

1. Scaffold

npx irtio init

init writes three files into irtio/ and a passing test:

irtio/
  schema.ts   # the shape of your shared state
  rpc.ts      # typed calls between client and server
  room.ts     # ownership, validation, server behavior
irtio.test.ts # a simulated-player test that already passes

2. Run the room locally

npx irtio dev

This boots the room on localhost, watches your files, and prints the join URL. Leave it running while you build.

3. Join from your game

import { joinRoom } from '@irtio/client';
import { schema } from './irtio/schema';

const room = await joinRoom(schema);

// react to state — this callback runs whenever anything you can see changes
room.subscribe((state) => render(state));

// write what you own
function onInput(dx: number) {
  room.state.players[room.me].x += dx;
}

Open two tabs on the same URL and move in one — the other updates. That’s the whole loop.

4. Prove it works

npx irtio test

The scaffolded test spins up simulated players, drives inputs, and asserts the resulting state. It runs in CI in milliseconds — no browsers, no flakiness.

Next steps

Placeholder content. The real quickstart lands with the M1/M3 docs work.