{"id":15130115,"url":"https://github.com/mahendrahegde/peer-ring","last_synced_at":"2026-01-31T12:31:39.680Z","repository":{"id":245714706,"uuid":"814842237","full_name":"mahendraHegde/peer-ring","owner":"mahendraHegde","description":"Distributed, Decentralized, Sharding Framework for building Peer-to-Peer Systems, inspired by the designs of Cassandra and amazon Dynamo","archived":false,"fork":false,"pushed_at":"2024-07-01T00:16:03.000Z","size":230,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T21:46:12.381Z","etag":null,"topics":["application-sharding","cassandra","consistent-hashing","decentralized","decentralized-applications","distributed-cache","dynamo","k8s","kv-store","p2p","peer-to-peer","quorum","replication"],"latest_commit_sha":null,"homepage":"","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/mahendraHegde.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-13T20:26:30.000Z","updated_at":"2024-08-19T20:23:12.000Z","dependencies_parsed_at":"2024-10-09T16:41:21.608Z","dependency_job_id":"895da8ab-170e-4eed-9286-bfd70da810da","html_url":"https://github.com/mahendraHegde/peer-ring","commit_stats":null,"previous_names":["mahendrahegde/peer-ring"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahendraHegde%2Fpeer-ring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahendraHegde%2Fpeer-ring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahendraHegde%2Fpeer-ring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahendraHegde%2Fpeer-ring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahendraHegde","download_url":"https://codeload.github.com/mahendraHegde/peer-ring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239978184,"owners_count":19728290,"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":["application-sharding","cassandra","consistent-hashing","decentralized","decentralized-applications","distributed-cache","dynamo","k8s","kv-store","p2p","peer-to-peer","quorum","replication"],"created_at":"2024-09-26T02:30:39.378Z","updated_at":"2026-01-31T12:31:39.639Z","avatar_url":"https://github.com/mahendraHegde.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### peer-ring\n\n\u003e Distributed, Decentralized Sharding Framework for building distributed storage or similar solutions, inspired by [Amazon Dynamo](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf)\n\nPeer-ring is designed to be storage or use case agnostic. It acts as a base framework for building distributed solutions. Some sample applications that can be built on top of peer-ring include:\n\n- [x] [Distributed KV store](https://www.npmjs.com/package/@peer-ring/kv-store): Distributed In-memory key-value store that can be embedded into your application.\n- [ ] Distributed Rate Limiter: Rate limiter that can be deployed close to your application for greater performance.\n- [ ] Distributed Pub-Sub: In-memory pub-sub/queue system for application synchronization.\n      ... and many more.\n\n---\n\n#### How It Works\n\n`@peer-ring` uses `consistent hashing` to distribute data efficiently. Writes are spread across replicas, ensuring resilience without compromising speed.\n\n`@peer-ring/kv-store` is one such application built on top of peer-ring, currently only supports only k8s based peer discovery, which means you can only use it if you are running your apps on kubernetes.\n\n![No Image](https://raw.githubusercontent.com/mahendraHegde/peer-ring/main/packages/kv-store/docs/kv-store.png)\n\n---\n\n#### Modules\n\nPeer-ring is divided into three major modules:\n\n1. **Peer Discovery:** Responsible for membership management. Supported peer discovery strategies include:\n   - [x] [K8s based](https://www.npmjs.com/package/@peer-ring/discovery-k8s)\n   - [ ] Registry based (etcd/ZooKeeper)\n   - [ ] SWIM or gossip based\n2. **Core:** The core module is responsible for distributed sharding, key ownership identification, P2P communication, quorum, and replication management. It uses a custom request/response model built on top of gRPC bidirectional stream for efficient P2P communication.\n3. **Applications:** This is the end-user layer built on top of peer-ring/core and utilizes one of the peer discovery strategies. Examples include:\n   - [x] [Distributed KV store](https://www.npmjs.com/package/@peer-ring/kv-store): In-memory key-value store.\n   - [ ] Distributed Rate Limiter: Rate limiter that can be deployed close to your application for greater performance.\n   - [ ] Distributed Pub-Sub: In-memory pub-sub/queue system for application synchronization.\n\n---\n\n#### Replication\n\nPeer-ring provides `replication` and `sloppy quorum` for high availability. You can tweak the behavior using [`replicationFactor`](https://github.com/mahendraHegde/peer-ring/blob/main/packages/core/docs/interfaces/ExecuteOpts.md#replicationfactor) and [`quorumCount`](https://github.com/mahendraHegde/peer-ring/blob/main/packages/core/docs/interfaces/ExecuteOpts.md#quorumcount). You can choose among these characteristics:\n\n1. **Consistency (default)**: Choose `replicationFactor=1` and `quorumCount=1` for better consistency and low latency, but you will sacrifice availability and durability (i.e., your data is lost if the owner replica dies).\n2. **Availability**: Choose `replicationFactor\u003e=3` and `quorumCount=1` for high availability. You can tweak `quorumCount` according to your consistency needs, higher `replicationFactor` and `quorumCount` means more latency.\n3. **Durability**: The current implementation does not offer strong durability. If all replicas holding a particular `key` die, you will lose the `key`. A better durability solution (maintaining the replication factor when a node goes down, redistributing when a new node comes up) is [WIP](https://github.com/mahendraHegde/peer-ring?tab=readme-ov-file#project-roadmap).\n\n---\n\n#### Project Roadmap\n\nThis roadmap outlines the planned development and milestones for the project. Contributions and suggestions are welcome.\n\n##### Milestone 1: Initial Release\n\n**Status:** In Progress\n\n- [x] Design system architecture\n- [x] Develop basic peer discovery module with k8s\n- [x] Implement core sharding functionality\n- [x] Implement replication and quorum\n- [x] Implement in-memory KV store\n- [ ] Handle failures by token transfer when a peer goes down or comes back up [*in Alpha*]\n  - [x] steal data/tokens from peer when new node is added\n  - [x] when data owner node goes down, the previous node will own the tokens of the node went down, it should copy data/tokens from replicas.\n  - [ ] when replica goes down, the previous node will own the tokens of the node went down, it should copy the data/tokens from other replicas/owner\n- [ ] Write comprehensive documentation\n- [ ] Create a contribution guide and code of conduct\n- [ ] Set up continuous integration (CI) pipeline\n\n##### Milestone 2: Stability and Scalability\n\n**Status:** Planned\n\n- [ ] deployment as sidecar\n- [ ] Conduct thorough testing and validation\n\n##### Milestone 3: Enhanced Features\n\n**Status:** Planned\n\n- [ ] Develop distributed rate limiter\n- [ ] Support custom reconciliation/read repair by the client\n- [ ] Implement advanced peer discovery strategies\n  - [ ] Registry based (etcd/ZooKeeper)\n  - [ ] SWIM or gossip based\n- [ ] Create distributed pub-sub system\n- [ ] Optimize performance and resource usage\n\n##### Milestone 4: Community and Ecosystem\n\n**Status:** Planned\n\n- [ ] Develop monitoring/metrics layer\n- [ ] Create a guide for building custom applications on top of peer-ring\n- [ ] Provide detailed usage examples and tutorials\n- [ ] improve data sync with Anti-entropy\n\n---\n\n#### Contributing\n\nContributions are more than welcome. Reading [Amazon Dynamo](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf) before contributing can make your life easier but is not a strict requirement. Read more about contributing [here](https://github.com/mahendraHegde/peer-ring/CONTRIBUTING.md).\n\n---\n\n#### Release\n\n1. pnpm changeset\n2. commit changes\n3. pnpm prepare:publish\n4. pnpm publish -r --filter=\\!**e2e** --filter=\\!peer-ring --dry-run\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahendrahegde%2Fpeer-ring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahendrahegde%2Fpeer-ring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahendrahegde%2Fpeer-ring/lists"}