A Go implementation of the Raft consensus algorithm from scratch.
I wanted to understand how distributed consensus works by implementing it. Raft is a more understandable alternative to Paxos, with clear semantics for leader election, log replication, and safety guarantees.
- Leader election - Nodes elect a leader through voting
- Log replication - Safe log synchronization across nodes
- Persistence - Term and vote storage, snapshotting support
- RPC communication - gRPC-based inter-node communication
- Configurable logging - Debug-friendly logging with levels
make build
make testThe implementation includes comprehensive tests covering leader election, log replication, and failure scenarios.
make testI've written blog posts about the implementation process. Check them out on my blog.
This is a learning project to understand Raft consensus. It implements the core algorithm but isn't production-ready.
Copyright © 2026 Navgeet Agarwal Distributed under the MIT License.