jonnify·bcs /bcs/codemojex/the-live-surface/the-json-api

B7.6.1 · dive 1 of 3 · module B7.6

The JSON API.

Phoenix exposes a thin JSON facade that turns a request into a command — a guess returns an accepted status while scoring runs behind the boundary — and a read into a privacy-safe view, owning no per-room state of its own.

A command that returns 202, a privacy-safe view, and a facade that owns no state. Select a part.
a commanda guess returns 202scoring behind the line a privacy-safe viewown attempts, best, boardnever a guess or secret a thin facadeowns no stateno per-room process
readout · Select a part. A guess is a command that returns an accepted status with scoring behind the boundary; reads are privacy-safe views of own attempts, best, and the board; the surface is a thin facade owning no per-room state.
§1

The idea

codemojex · the json api

The surface is a thin facade, not the game. Phoenix exposes a JSON API that turns a request into a command on the systems and a read into a view, and it owns no game state of its own: there is no process per room, no in-memory copy of a game on the web tier. State lives where it belongs — on the Postgres floor, in the cache, in the Valkey tier — and the surface reaches for it.

A guess is a command that returns at once. The endpoint validates, charges, and enqueues, then answers with an accepted status while the scoring runs behind the boundary; the player’s request does not wait for a score. Reads go the other way, into privacy-safe views: a player can ask for their own attempts, their best total, and the leaderboard ranked by best total, and for nothing else.

The view is shaped at the boundary, not by trusting the caller. A response never carries another player’s guesses or the secret, because the query that builds it cannot reach them, so a curious client gains nothing by asking a different way. The same surface carries the idempotent webhook that confirms a star purchase, an endpoint among endpoints, while the game keeps moving only its own currencies.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related