all projects

// RESEARCH

Rafty

A Chaos-Monkey-style Raft consensus visualizer

GoReactRaftDistributed SystemsConsensusChaos Engineering

Overview

Rafty is a hands-on way to understand Raft. Instead of reading the paper and squinting at pseudocode, you watch a real cluster elect a leader, replicate logs, and recover from chaos — and you cause the chaos yourself.

What you see

The UI is three panels:

  • Cluster (the Pentagon) — five nodes arranged in a pentagon. Colour-coded by state:
    • 🔵 Blue — Follower
    • 🟡 Yellow — Candidate (requesting votes)
    • 🟢 Green + crown — Leader
    • 💀 Red skull — dead / stopped
  • Replicated Log — per-node commit log. If consensus is healthy, every alive node's log looks the same.
  • Chaos Control — kill / start any node, send client work requests, trigger network partitions.

Scenarios you can run

  1. Leader Election — watch a fresh cluster nominate and elect a leader from scratch
  2. Log Replication — send a client request, watch green log entries propagate to all followers
  3. Kill the Leader — followers stop receiving heartbeats → new term → new leader emerges
  4. Partition Recovery — restart the old leader, watch it rejoin as a Follower and catch up missing log entries

Stack

  • Go backend — runs the actual Raft state machine and virtual networking layer
  • React frontend — visualises cluster state via the backend's API
  • Make-based runnermake run boots backend (port 8080) and frontend (port 5173)

Why build it

Reading the Raft paper gives you the algorithm. Watching a leader die in real time and seeing the new election unfold — election timeouts firing, candidates collecting votes, the new leader sending append-entries — makes the invariants visceral. It's also a useful tool for explaining consensus to people who haven't internalised it yet.