{"id":16813426,"url":"https://github.com/maxenglander/raftjs","last_synced_at":"2025-06-14T04:39:55.685Z","repository":{"id":42210185,"uuid":"181366093","full_name":"maxenglander/raftjs","owner":"maxenglander","description":"Educational implementation of Raft protocol in TypeScript","archived":false,"fork":false,"pushed_at":"2023-01-07T04:08:29.000Z","size":989,"stargazers_count":6,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T01:53:04.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxenglander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-14T20:37:23.000Z","updated_at":"2024-11-22T21:06:55.000Z","dependencies_parsed_at":"2023-02-06T11:15:41.149Z","dependency_job_id":null,"html_url":"https://github.com/maxenglander/raftjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxenglander%2Fraftjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxenglander%2Fraftjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxenglander%2Fraftjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxenglander%2Fraftjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxenglander","download_url":"https://codeload.github.com/maxenglander/raftjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328108,"owners_count":21085258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-13T10:26:42.357Z","updated_at":"2025-04-11T01:53:14.337Z","avatar_url":"https://github.com/maxenglander.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raftjs\n\nThis is a (partial) implementation of the [Raft](https://raft.github.io/raft.pdf)\nprotocol in JavaScript (by way of TypeScript). The purpose of this\nimplementation is to educate the author, and any interested readers,\nin what an implementation might look like.\n\nThe implementation aims to be understandable, well-organized and extensible.\nIt attempts to follow the Raft protocol to the letter. However, there\nare likely places where the language is misinterpreted or followed too\nliterally. There are likely to be many bugs and mistakes in this\nimplementation.\n\nAt the present time, the implementation includes only leader election,\nThe implementation does not presently include:\n\n * the leader accepting new entries from clients\n * the leader replicating log entries to followers\n * changes in cluster membership\n * snapshotting or log compaction\n\n## Build\n\n```\n$\u003e npm install\n$\u003e npm run build\n```\n\n## Docs\n\nView the [annotated source](https://raftjs.maxenglander.com/annotated-source.html).\n\n## Example usage\n\n**Start Raftjs servers**\n```\n$\u003e ./bin/rafjs start --config-file examples/configuration/server-a.json \u003e /tmp/raftjs-server-a.log\n$\u003e RAFTJS_SERVER_A_PID=$!\n$\u003e ./bin/rafjs start --config-file examples/configuration/server-b.json \u003e /tmp/raftjs-server-b.log\n$\u003e RAFTJS_SERVER_B_PID=$!\n$\u003e ./bin/rafjs start --config-file examples/configuration/server-c.json \u003e /tmp/raftjs-server-c.log\n$\u003e RAFTJS_SERVER_C_PID=$!\n```\n\n**Check current leader**\n```\n$\u003e grep leader /tmp/raftjs-server\\*.log\n/tmp/raftjs-server-a.log:[1555273638878] DEBUG (84785 on local): Votes obtained from cluster majority; transitioning to leader\n```\n\n**Kill the initial leader**\n```\n$\u003e kill $RAFTJS_SERVER_A_PID\n```\n\n**Check the new leader**\n```\n$\u003e grep leader /tmp/raftjs-server-\\*log\n/tmp/raftjs-server-a.log:[1555273638878] DEBUG (84785 on local): Votes obtained from cluster majority; transitioning to leader\n/tmp/raftjs-server-b.log:[1555273762740] DEBUG (84787 on local): Votes obtained from cluster majority; transitioning to leader\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxenglander%2Fraftjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxenglander%2Fraftjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxenglander%2Fraftjs/lists"}