Codemojex · chapter C1
The game as branded systems.
Every entity in Codemojex is a 14-character branded snowflake — a three-character uppercase
namespace and eleven Base62 characters over ts(41) | node(10) | seq(12) — and the id is the only
value that crosses a boundary. It keys the row in Postgres, the entry in Valkey, the job on the bus, and the
message that announces a result; because it carries its mint time, it doubles as a cache version and an
idempotency token. Fifteen namespaces carry the game today.
Pick a brand below. The tiers it occupies light up — the id is placed only where it is needed.
Codemojex.Tables · Codemojex.View.PLR — the player. Rests on the Postgres floor (the balances row) and races on Valkey (the per-player guess lane and the leaderboard). No near-cache: a balance is mutable, so it is read from the floor under a row lock, never a stale copy.
The chapter in three dives
C1.1 – C1.3One id contract keys every tier; four layers hold the whole game; one boundary keeps the secret unreadable. The three dives take those in turn — the brand as the type, the four layers that own the tiers, and the privacy boundary drawn in structure rather than at the edge.
Branded ids are the keys
The brand is the type — generate!/1 validates by shape, not a registry. The fifteen namespaces, the real mint sites, and the id as primary key in every schema.
The four layers
A Postgres floor, an EchoStore near-cache, an EchoMQ bus, a Phoenix surface — who owns what, and why the Valkey half is derived and reconstructable.
C1.3The privacy boundary
Structural, not an edge filter: the secret sits where no player-facing view selects it; the live events carry a name and a score, never the code or the guess.
Grounding — the chapter reads from lib/codemojex/wire.ex (the one adapter onto the
owned wire), the eleven schemas/*.ex (all keyed {:id, :string}), tables.ex
(the EchoStore tier), view.ex (the privacy-safe reads), the design’s §Identity and §Privacy
sections, and stories/privacy.stories.md.
References
sources · relatedSources
- King — Announcing Snowflake (2010)the time-ordered
ts|node|seqids that key every branded entity across every tier. - Helland — Life Beyond Distributed Transactions (CIDR 2007)entities behind boundaries, the privacy seam, idempotent activities.
Related
- BCS — the architecture lawthe branded-id contract in full.
- C0.3 — The architecture at a glancethe four layers, first sketched.
- C2 — Rooms, Modes, and the Secretthe template and the pin, next.