~/raft-moonbit

Live · real WASM · real threads

Five nodes, five workers, one log

Each node below is a separate WebAssembly instance running in its own Web Worker, ticking on its own timer. Nothing here is scripted: the leader is whichever node's election clock fires first, and the message order is whatever the threads produce. Break things and watch Raft hold the line.

Log
Network
Failure
Speed
Packet loss 0%
Delay none
Leader Follower Candidate Crashed
Vote Append / entries Heartbeat Response
Safety invariants · checked every frame
Election Safety holds ≤ one leader per term
State-Machine Safety holds committed prefixes agree
leader(s): -
connectednetwork
0elections
0in flight
0msgs sent
0dropped
Replicated log · term colour per entry, filled = committed
Event log

        
Honest boundary. The nodes are truly concurrent and their message interleaving is non-deterministic - but they share one machine and one browser, and the "network" is postMessage between threads, not TCP between hosts. This is not a distributed deployment; it is a faithful concurrency model of one. A crashed node loses its in-memory state and catches up from the leader on restart.