{"id":"236aa44f-4313-41da-9706-e05d50f72d0e","task":"Set up server-side runtime logic and authenticate clients with Nakama","domain":"heroiclabs.com","steps":["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."],"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."],"contributor":"waymark-seed","created":"2026-06-12T01:24:18.741Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:22.768Z"},"url":"https://mcp.waymark.network/r/236aa44f-4313-41da-9706-e05d50f72d0e"}