Mahjong System / API Docs

API Reference and Plugin Notes

This page contains the full API descriptions that were removed from the main dashboard. The dashboard now keeps only the core call flow, while this page acts as the single reference for request shapes, response shapes, plugin teaching, and the temporary runner flow.

Reference guide

Plugin definition teaching

Plugin definition

  1. Register the plugin definition first so the system knows the name, version, and defaultStore shape.
  2. Upload the plugin resource separately when you need the executable source or module payload.
  3. Keep the exported entry function small and explicit. For the temp runner endpoint, export an entry function.
  4. Use the docs page for the complete API reference and the dashboard only for the basic call flow.

Temp runner

  1. The temp runner endpoint expects a function name and version.
  2. If you provide code, the server stores it first through function-storage, then calls function-runner.
  3. The simplest sample is a module that exports an entry function and returns JSON-safe data.

Runtime notes

How the current system runs

  1. api-server runs migrations at startup, so the image must contain the generated migration files.
  2. For local validation, rebuild the api-server image, load it into kind, and restart only the api-server deployment.
  3. The dashboard is a demo surface and will be removed once the product UI is ready.
  1. The docs page intentionally owns the complete API list, so the dashboard can stay compact.
  2. The temp runner endpoint stores code only when code is provided, then forwards the call to function-runner.
  3. Plugin resource upload remains available for the full runtime path, even though it is not on the main dashboard.

API catalog

All current API descriptions

Core GET
/
Render the dashboard demo page.
Request: Browser navigation
Response: HTML page
Note: Primary demo surface for the backend-first UI.
Core GET
/docs
Render the API documentation page.
Request: Browser navigation
Response: HTML page
Note: Contains the full API reference and plugin teaching notes.
Core GET
/health
Return a basic health status.
Request: None
Response: { status: "ok" }
Note: Used for basic service health checks.
Game POST
/api/game/management
Create a room and return a new gameId.
Request: { status?: "waiting" | "playing" | "finished" }
Response: { gameId, status, createdAt, updatedAt }
Note: Main room creation endpoint.
Game GET
/api/game/management?gameId=...
Read the current room summary by gameId.
Request: gameId query parameter
Response: { gameId, status, createdAt, updatedAt }
Note: Useful for room summary lookups.
Player POST
/api/player/management
Create a player profile.
Request: { playerName }
Response: { id, name }
Note: Basic player registration route.
Player GET
/api/player/management?playerId=...
Read a player profile by playerId.
Request: playerId query parameter
Response: player object or null
Note: Supports player lookup for the demo flow.
Room POST
/api/room/management
Bind a player to a room.
Request: { playerId, roomId }
Response: { message } or { error }
Note: Used to attach a player to a game room.
Room GET
/api/room/management?gameId=...
Read room status and bound players.
Request: gameId query parameter
Response: { status, playerInfo }
Note: Shows the current room binding state.
Plugin POST
/api/plugin/management
Register plugin metadata and default store.
Request: { methodInfo, defaultStore? }
Response: { message }
Note: Plugin definition registration.
Plugin GET
/api/plugin/management?name=...&version=...
Read plugin metadata and default store.
Request: name/version query parameters
Response: { methodInfo, defaultStore, dependencies }
Note: Browser-friendly lookup route.
Plugin POST
/api/plugin/resource
Upload plugin code and dependency list.
Request: { methodInfo, data, resourceType, dependencies }
Response: { message }
Note: Executable resource upload.
Plugin GET
/api/plugin/resource?name=...&version=...&resourceType=...
Read the stored plugin code.
Request: name/version/resourceType query parameters
Response: { code, hash }
Note: Gets the source payload from storage.
Runner GET
/api/runner/execute
Describe the temporary function-runner call shape.
Request: None
Response: Usage and sample request
Note: Documentation helper for the temp runner endpoint.
Runner POST
/api/runner/execute
Store optional code and execute a function through function-runner.
Request: { methodInfo, code?, payload?, dependencies? }
Response: { result, rawResult, storedCode }
Note: Temporary smoke-test endpoint.