floodgate@localhost:/architecture

pstree floodgate

Floodgate doesn't implement the Fluid protocol itself. It composes a handful of sibling Gleam libraries — each one a supervised part of the same process tree — and adds the transports, storage wiring, and admin surface around them.

composed fromhow a document survives a crash

Each document session is its own BEAM process, supervised with a one_for_one restart strategy. If a session process crashes, it restarts and reloads its state from storage — the rest of the node, including every other document's session, is unaffected. This is the same isolation model the BEAM has run telecom switches on for decades; Floodgate's sequencing and validation logic on top of it is written in Gleam, so a whole class of protocol bugs is caught by the compiler before the process ever starts.

dual-mode, one process

socketio_transport and phx_transport are two wire-format adapters in front of the same beryl coordinator, session state, and storage. A Fluid client on /socket.io/ and a Phoenix Channels client on /socket/websocket can collaborate on the same document at the same time; neither transport knows the other exists.

http surface (excerpt)