{"id":28512381,"url":"https://github.com/ali-master/raft","last_synced_at":"2026-04-29T13:34:43.989Z","repository":{"id":296013717,"uuid":"992047081","full_name":"ali-master/raft","owner":"ali-master","description":"Raft consensus for Node.js. Build distributed systems with leader election, fault tolerance, and data replication.","archived":false,"fork":false,"pushed_at":"2026-03-03T13:33:29.000Z","size":2933,"stargazers_count":9,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-03T13:38:55.589Z","etag":null,"topics":["consensus","distributed-systems","fault-tolerance","leader-election","nodejs","raft","raft-consensus-algorithm","typescript"],"latest_commit_sha":null,"homepage":"https://raft.usestrict.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ali-master.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-28T14:35:09.000Z","updated_at":"2026-03-03T13:33:32.000Z","dependencies_parsed_at":"2025-07-04T01:32:07.491Z","dependency_job_id":null,"html_url":"https://github.com/ali-master/raft","commit_stats":null,"previous_names":["ali-master/raft"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ali-master/raft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali-master%2Fraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali-master%2Fraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali-master%2Fraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali-master%2Fraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ali-master","download_url":"https://codeload.github.com/ali-master/raft/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali-master%2Fraft/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32427715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consensus","distributed-systems","fault-tolerance","leader-election","nodejs","raft","raft-consensus-algorithm","typescript"],"created_at":"2025-06-09T00:37:49.700Z","updated_at":"2026-04-29T13:34:43.981Z","avatar_url":"https://github.com/ali-master.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./assets/logo-alt.svg\" alt=\"RAFT Logo\" /\u003e\n\n  \u003ch1\u003eRAFT\u003c/h1\u003e\n  \u003cp\u003e\u003cstrong\u003eProduction-ready Raft consensus implementation for Node.js\u003c/strong\u003e\u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@usex/raft\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@usex/raft?style=flat-square\" alt=\"npm version\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/ali-master/raft/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/@usex/raft?style=flat-square\" alt=\"license\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@usex/raft\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/@usex/raft?style=flat-square\" alt=\"downloads\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/ali-master/raft\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/ali-master/raft?style=flat-square\" alt=\"stars\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"#-quick-start\"\u003eQuick Start\u003c/a\u003e •\n    \u003ca href=\"./docs/getting-started.md\"\u003eDocumentation\u003c/a\u003e •\n    \u003ca href=\"./docs/examples.md\"\u003eExamples\u003c/a\u003e •\n    \u003ca href=\"#-why-raft\"\u003eWhy RAFT?\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n\u003e ⚠️ **Note**: This library is under active development and therefore full backward compatibility is not guaranteed before reaching v1.0.0. **Star the repo to get notified!**\n\n## 🎯 What is RAFT?\n\nRAFT is a battle-tested implementation of the [Raft consensus algorithm](https://raft.github.io/) for Node.js, designed to help you build bulletproof distributed systems. Whether you're building a distributed database, configuration service, or any system requiring strong consistency across multiple nodes, RAFT has you covered.\n\n## ✨ Key Features\n\n### 🏗️ Core Capabilities\n- **🔄 Consensus Algorithm** - Implements the Raft consensus algorithm for distributed systems\n- **🎯 Complete Raft Implementation** - Leader election, log replication, and membership changes\n- **🛡️ Production-Ready** - Built for reliability, performance, and observability\n- **💾 Redis-Backed Storage** - Persistent state management and peer discovery\n- **🎲 Weighted Voting** - Advanced leader election with configurable weights\n- **🔄 Dynamic Membership** - Add or remove nodes without downtime\n\n### 🔧 Reliability \u0026 Performance\n- **⚡ High Availability** - Automatic failover and leader election\n- **🔄 Log Replication** - Efficient log replication with strong consistency\n- **🔄 Membership Changes** - Dynamic cluster membership management\n- **🔄 Snapshotting** - Periodic snapshots for efficient state management\n- **🔄 Append-Only Log** - Durable, append-only log for all operations\n- **🔌 Circuit Breakers** - Fault tolerance for network operations\n- **📊 Comprehensive Monitoring** - Prometheus metrics and detailed logging\n- **📝 Write-Ahead Logging** - Durable log storage with automatic recovery\n- **🔍 Peer Discovery** - Automatic peer discovery and health checking\n- **📈 High Throughput** - Optimized for low-latency operations and high throughput\n- **🔄 Automatic Failover** - Seamless leader election and failover handling\n- **🛡️ Split-Brain Prevention** - Mechanisms to prevent data inconsistency during network partitions\n- **🔒 Security Features** - TLS support, authentication, and access control\n- **📦 Modular Design** - Easily extendable with custom plugins and middleware\n- **🔄 Event-Driven** - Rich event system for state monitoring and custom actions\n- **📦 TypeScript Support** - Full type safety and IntelliSense for a better developer experience\n- **🔗 Easy Integration** - Simple API for Node.js and NestJS applications\n- **📚 Extensive Documentation** - Comprehensive guides, examples, and API references\n- **🌐 Cross-Platform** - Works seamlessly on Linux, macOS, and Windows\n- **🔄 Multi-Node Clusters** - Supports clusters of any size with automatic scaling\n- **🔄 Real-Time Updates** - Push updates to clients in real-time using WebSockets or HTTP/2\n- **🔄 Customizable** - Easily configure timeouts, retry policies, and other parameters\n\n### 🚀 Developer Experience\n- **📡 Event-Driven Architecture** - Rich event system for state monitoring\n- **📘 TypeScript First** - Full type safety and IntelliSense support\n- **🔧 Easy Integration** - Simple API for Node.js and NestJS\n- **📚 Extensive Documentation** - Comprehensive guides and examples\n\n## 🚦 Quick Start\n\n### Installation\n\n```bash\n# npm\nnpm install @usex/raft\n\n# yarn\nyarn add @usex/raft\n\n# pnpm\npnpm add @usex/raft\n```\n\n### Basic Usage\n\n```typescript\nimport { RaftEngine } from '@usex/raft';\n\n// 1. Initialize the engine\nconst engine = new RaftEngine();\n\n// 2. Create a node\nconst config = RaftEngine.createDefaultConfiguration('node1', 'my-cluster');\nconst node = await engine.createNode(config);\n\n// 3. Start the node\nawait engine.startNode('node1');\n\n// 4. Listen for events\nnode.on('stateChange', ({ state, term }) =\u003e {\n  console.log(`Node is now ${state} for term ${term}`);\n});\n\n// 5. Write data (if leader)\nif (node.isLeader()) {\n  await node.appendLog({\n    command: 'SET',\n    key: 'user:123',\n    value: { name: 'Alice', role: 'admin' }\n  });\n}\n```\n\n## 💡 Why RAFT?\n\n### 🎯 Perfect For\n- **Distributed Databases** - Build consistent, replicated data stores\n- **Configuration Services** - Manage distributed configuration with strong consistency\n- **Service Discovery** - Implement reliable service registries\n- **Distributed Locks** - Create distributed locking mechanisms\n- **Leader Election** - Coordinate distributed services\n- **State Machines** - Implement replicated state machines\n- **Event Sourcing** - Build event-driven architectures with strong consistency\n- **Microservices** - Ensure reliable communication and state management across services\n- **Real-Time Applications** - Maintain consistent state in real-time systems\n- **IoT Systems** - Manage distributed IoT devices with strong consistency\n- **Gaming Servers** - Implement leaderboards and game state management\n- **Blockchain Applications** - Build consensus mechanisms for blockchain networks\n- **Financial Systems** - Ensure transaction consistency in distributed financial applications\n- **Data Replication** - Replicate data across multiple nodes for high availability\n- **Analytics Platforms** - Maintain consistent state in distributed analytics systems\n- **Content Delivery Networks (CDNs)** - Ensure consistent content across distributed nodes\n- **Search Engines** - Implement distributed search with strong consistency\n- **Machine Learning Systems** - Manage distributed model training and inference\n- **Cloud Services** - Build reliable cloud-native applications with strong consistency\n- **Edge Computing** - Ensure consistent state across edge devices\n- **API Gateways** - Implement consistent routing and state management\n- **Message Brokers** - Build reliable message delivery systems\n- **Data Warehousing** - Ensure consistent data across distributed data warehouses\n- **Backup and Recovery** - Implement reliable backup and recovery mechanisms\n\n### 🛡️ Battle-Tested Features\n- **Automatic Failover** - Seamless leader election when nodes fail\n- **Split-Brain Prevention** - Built-in mechanisms to prevent data inconsistency\n- **Network Partition Handling** - Graceful handling of network splits\n- **Data Consistency** - Strong consistency guarantees across all nodes\n\n## 📖 Documentation\n\n### 🏃 Getting Started\n- [**Installation Guide**](./docs/installation.md) - Setup instructions and requirements\n- [**Quick Start Tutorial**](./docs/getting-started.md) - Build your first RAFT cluster\n- [**Configuration**](./docs/configuration.md) - Customize RAFT for your needs\n\n### 📚 Core Concepts\n- [**Architecture**](./docs/architecture.md) - How RAFT works under the hood\n- [**API Reference**](./docs/api-reference.md) - Complete API documentation\n- [**Examples**](./docs/examples.md) - Real-world use cases and patterns\n\n### 🔬 Advanced Topics\n- [**Advanced Usage**](./docs/advanced-usage.md) - Complex scenarios and optimizations\n- [**Monitoring**](./docs/monitoring.md) - Metrics, observability, and debugging\n- [**Deployment**](./docs/deployment.md) - Production deployment best practices\n- [**Security**](./docs/security.md) - Securing your RAFT cluster\n\n### 🛠️ Troubleshooting\n- [**Common Issues**](./docs/troubleshooting.md) - Solutions to frequent problems\n- [**Migration Guide**](./docs/migration-guide.md) - Upgrading between versions\n\n## 💻 System Requirements\n\n- **Node.js** \u003e= 18.12.0\n- **Redis** \u003e= 6.0\n- **TypeScript** \u003e= 5.0 (for TypeScript projects)\n\n## 🎮 Interactive Example\n\nWant to see RAFT in action? Check out our interactive examples:\n\n### Three-Node Cluster Example\n```typescript\n// Node 1 - Initial Leader\nconst node1 = await createNode('node1', { weight: 3 });\n\n// Node 2 \u0026 3 - Followers\nconst node2 = await createNode('node2', { weight: 2 });\nconst node3 = await createNode('node3', { weight: 1 });\n\n// Simulate leader failure\nawait node1.stop();\n// Node 2 becomes leader due to higher weight!\n```\n\n[**See More Examples →**](./docs/examples.md)\n\n## 🤝 Contributing\n\nWe love contributions! Whether it's:\n- 🐛 Bug fixes\n- ✨ New features\n- 📚 Documentation improvements\n- 💡 Ideas and suggestions\n\nCheck out our [Contributing Guide](./CODE_OF_CONDUCT.md) to get started.\n\n## 📊 Performance\n\nRAFT is designed for high performance:\n- **\u003c 50ms** leader election in typical scenarios\n- **10,000+ ops/sec** throughput on commodity hardware\n- **Minimal memory footprint** with efficient state management\n\n## 🛡️ Security\n\n- **TLS Support** - Encrypted communication between nodes\n- **Authentication** - Built-in node authentication\n- **Access Control** - Fine-grained permissions for operations\n\n[**Learn more about security →**](./docs/security.md)\n\n## 📱 Community \u0026 Support\n\n- 💬 **GitHub Discussions** - [Ask questions and share ideas](https://github.com/ali-master/raft/discussions)\n- 🐛 **GitHub Issues** - [Report bugs or request features](https://github.com/ali-master/raft/issues)\n- 📖 **Documentation** - [Comprehensive guides and API docs](./docs/)\n- 🌟 **Star us on GitHub** - Show your support!\n\n## 📜 License\n\nThis project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003cp\u003e\n    \u003cstrong\u003eReady to build distributed systems that just work?\u003c/strong\u003e\n  \u003c/p\u003e\n  \u003cp\u003e\n    \u003ca href=\"./docs/installation.md\"\u003e🚀 Get Started\u003c/a\u003e •\n    \u003ca href=\"./docs/examples.md\"\u003e📚 View Examples\u003c/a\u003e •\n    \u003ca href=\"https://github.com/ali-master/raft\"\u003e⭐ Star on GitHub\u003c/a\u003e\n  \u003c/p\u003e\n  \u003cp\u003e\n    Made with ❤️ by \u003ca href=\"https://github.com/ali-master\"\u003eAli Master\u003c/a\u003e and the open source community.\n  \u003c/p\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali-master%2Fraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fali-master%2Fraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali-master%2Fraft/lists"}