jonnify·bcs /bcs/codemojex/branded-systems/the-four-layers

B7.1.2 · dive 2 of 3 · module B7.1

The four layers.

Codemojex stands on four layers: a Postgres record of truth for money, the secret, and state; an EchoStore cache of what is immutable for a game; an EchoMQ real-time tier; and a Phoenix surface.

Four layers, the floor at the base. Money and the secret live on the floor. Select a layer.
Phoenix — surfaceAPI, channel, admin: privacy-safe EchoMQ — real-time, queueslanes, leaderboard, locks: derived EchoStore — read-hot cacheimmutable for a game Postgres — record of truthmoney, secret, commitment, state
readout · Select a layer. Postgres is the record of truth; EchoStore caches what is immutable for a game; EchoMQ carries the real-time work; Phoenix is the surface. Nothing above the floor is a second source of truth.
§1

The idea

codemojex · the layering

Codemojex stands on four layers, and each keeps the job the course gave it. The floor is Postgres: the record of truth for money, for a game’s secret and its commitment, and for game state, durable and constrained. Money is real and a game hides a secret, so both must survive a restart and stay auditable, which is why they live here and nowhere else as a source.

Above the floor sits EchoStore, a read-hot cache: a game’s secret and its emoji set do not change for the game’s life, so they are held in memory under the game’s version and read without touching Postgres on the hot path, falling back to the floor on a miss. Above that, EchoMQ on Valkey carries the real-time work — the per-player guess lanes, the leaderboard, the locks, the tier claims — all of it derived from the floor and the guesses, and all of it reconstructable.

At the top, Phoenix is the surface: a JSON and channel API behind privacy-safe views, and an operator console. Nothing above the floor is a second source of truth; the cache can be dropped and refilled, and the real-time tier can be rebuilt from the record. The reference implementation places money and the secret on the floor and treats everything above it as a fast, disposable view.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related