Skip to content

Navgeet/raft

Repository files navigation

Raft

A Go implementation of the Raft consensus algorithm from scratch.

Why?

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.

What's included

  • 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

Getting started

make build
make test

Testing

The implementation includes comprehensive tests covering leader election, log replication, and failure scenarios.

make test

Further reading

I've written blog posts about the implementation process. Check them out on my blog.

Notes

This is a learning project to understand Raft consensus. It implements the core algorithm but isn't production-ready.

License

Copyright © 2026 Navgeet Agarwal Distributed under the MIT License.

About

An implementation of the Raft consensus protocol.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors