Deploy Nakama (self-hosted via Docker or managed via Heroic Cloud) and note your server address, HTTP key (for server-to-server calls), and configure a server key for client connections.
Write a server-side runtime module in Go, Lua, or TypeScript; register hooks (e.g., nk.RegisterRpc, nk.RegisterAfterAuthenticateEmail) in the initializer function so Nakama loads them at startup.
From a game client using a Nakama SDK (Unity, Unreal, JS, etc.), authenticate with one of the built-in providers: client.AuthenticateDevice(deviceId), client.AuthenticateEmail(email, password), or a social provider.
On successful authentication, the client receives a Session object containing an auth token and refresh token; pass this session to subsequent API calls.
Invoke server-side RPC functions from the client with client.RpcFunc(session, rpcId, payload) — the payload is a JSON string; the server function returns a JSON string response.
Use the Nakama console (default port 7351) or REST API with the HTTP key to inspect accounts, storage, and leaderboard data during development.
Known gotchas
Session tokens expire (default 60 seconds for access tokens, configurable); clients must use the refresh token to obtain a new session before expiry or handle re-authentication — failing to do so causes silent request failures.
Runtime modules in TypeScript must be transpiled to JavaScript before deployment; the built-in bundler handles this, but TypeScript type errors that don't prevent compilation can produce runtime panics — test modules in a local Nakama instance before deploying.
Storage objects have a permission model (owner read/write, public read); attempting to read another player's private storage object from the client returns a not-found error rather than a permission error, which can mislead debugging.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp