Skip to content

five-on-it / apps/nakama/src

apps/nakama/src ​

Nakama's runtime module (TECHNICAL_SPECS §9.6, §9.9): what the platform adds to the Nakama server of the Compose stack. Nakama runs it in its JavaScript runtime, built by build.mjs (the types stripped, the exports dropped: Nakama wants one plain script whose InitModule it calls at start), so this file imports nothing and keeps to what Nakama's JavaScript engine reads (no optional chaining); the parts of Nakama's runtime it uses are declared below.

  • The moderation hook: every message a client sends on a chat channel of a game's room (a room channel named after the room, room-…) goes through the platform's moderation before delivery: the module asks the API (POST /moderation/chat with the room secret), which lets a room it opened as private through unchecked and runs the moderator on the rest. A message it hides, or one it could not check, is dropped: it never reaches the others.
  • foi_chat_keep: an RPC the API calls (with the runtime's HTTP key) to keep a party's message in the party's room channel (party-…) and a direct message in the two players' direct channel, sent as the player who wrote it: their history is Nakama's. Private conversations: not moderated (GAME_DESIGN §10.4).

The runtime's environment (--runtime.env) names the API (foi_api_url) and the room secret (foi_room_secret).

Interfaces ​

Variables ​

Functions ​