{"id":37190869,"url":"https://github.com/amoghyermalkar123/ygo","last_synced_at":"2026-01-14T22:03:34.049Z","repository":{"id":288131584,"uuid":"965109029","full_name":"amoghyermalkar123/ygo","owner":"amoghyermalkar123","description":"A Text based CRDT library in Go","archived":false,"fork":false,"pushed_at":"2025-06-16T12:02:15.000Z","size":126,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T19:00:04.105Z","etag":null,"topics":["crdt","distributed-systems","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amoghyermalkar123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null}},"created_at":"2025-04-12T12:37:03.000Z","updated_at":"2025-05-18T14:39:07.000Z","dependencies_parsed_at":"2025-05-01T17:39:15.341Z","dependency_job_id":"e90b3fdb-78b1-4ef5-ba91-d8c1a2fbc9a7","html_url":"https://github.com/amoghyermalkar123/ygo","commit_stats":null,"previous_names":["amoghyermalkar123/ygo"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/amoghyermalkar123/ygo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghyermalkar123%2Fygo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghyermalkar123%2Fygo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghyermalkar123%2Fygo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghyermalkar123%2Fygo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amoghyermalkar123","download_url":"https://codeload.github.com/amoghyermalkar123/ygo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghyermalkar123%2Fygo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T21:32:52.117Z","status":"ssl_error","status_checked_at":"2026-01-14T21:32:33.442Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["crdt","distributed-systems","go"],"created_at":"2026-01-14T22:03:33.411Z","updated_at":"2026-01-14T22:03:34.033Z","avatar_url":"https://github.com/amoghyermalkar123.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YGo: A Text-based CRDT in Go\n\nYGo is a lightweight, efficient implementation of a text-based Conflict-Free Replicated Data Type (CRDT) in Go. Based on the Yata algorithm (\"Yet Another Transformation Approach\"), YGo enables real-time collaborative editing with strong eventual consistency guarantees without requiring a central coordinator.\n\n🚀 Features:\n- **Collaborative Text Editing:** Multiple users can edit the same document concurrently\n- **Conflict-Free Resolution:** Automatic handling of conflicting edits\n- **Offline-First Support:** Work offline and synchronize changes when reconnected\n- **Network Agnostic:** Use with any transport layer (WebSockets, HTTP, QUIC, etc.)\n- **Lightweight:** Minimal dependencies and efficient memory usage\n- **Fully Tested:** Comprehensive test suite ensuring reliability\n\n📚 What are CRDTs?\nCRDTs (Conflict-Free Replicated Data Types) are a family of data structures that enable multiple processes to independently update shared data without coordination, while ensuring that all replicas eventually converge to the same state.\nYGo implements a text CRDT with three key mathematical properties:\n\n- **Commutativity:** The order of operations doesn't affect the final result\n- **Associativity:** Grouping of operations doesn't affect the final result\n- **Idempotence:** Applying the same operation multiple times doesn't change the result\n\nThis makes YGo ideal for collaborative applications where:\n\n- Network connections may be unreliable\n- Users need to work offline\n- Real-time collaboration is required without strict coordination\n\n🔧 Installation:\nThis library is ***NOT*** production ready. However feel free to play around with it and/or report issues.\n\n```bash\ngo get github.com/amoghyermalkar123/ygo\n```\n\n📝 Usage\nBasic Example\n```go\n\n// Create a new collaborative document\ndoc := ygo.NewYDoc()\n\n// Insert text\nerr := doc.InsertText(0, \"Hello, World!\")\nif err != nil {\n    // Handle error\n}\n\n// Get current document content\nfmt.Println(doc.Content()) // Output: Hello, World!\n\n// Delete some text\nerr = doc.DeleteText(7, 5) // Delete \"World\"\nif err != nil {\n    // Handle error\n}\n\nfmt.Println(doc.Content()) // Output: Hello, !\n```\n\nSynchronizing Documents\n```go\n// Document 1\ndocA := ygo.NewYDoc()\ndocA.InsertText(0, \"Hello, collaborative world!\")\n\n// Encode state as update\nupdate, err := docA.EncodeStateAsUpdate()\nif err != nil {\n    // Handle error\n}\n\n// Document 2 (could be on a different machine)\ndocB := ygo.NewYDoc()\n\n// Apply update from Document 1\nerr = docB.ApplyUpdate(update)\nif err != nil {\n    // Handle error\n}\n\n// Both documents now have the same content\nfmt.Println(docB.Content()) // Output: Hello, collaborative world!\n```\n\nHandling Concurrent Edits\n```go\n// Initial document\nsource := ygo.NewYDoc()\nsource.InsertText(0, \"Hello World\")\n\n// Create update to share\nupdate1, _ := source.EncodeStateAsUpdate()\n\n// Two clients receive the initial state\nclient1 := ygo.NewYDoc()\nclient2 := ygo.NewYDoc()\nclient1.ApplyUpdate(update1)\nclient2.ApplyUpdate(update1)\n\n// Client 1 makes an edit\nclient1.InsertText(6, \"beautiful \")\n\n// Client 2 makes a different edit at the same position\nclient2.InsertText(6, \"amazing \")\n\n// Generate updates from both clients\nupdate2, _ := client1.EncodeStateAsUpdate()\nupdate3, _ := client2.EncodeStateAsUpdate()\n\n// Apply both updates to both clients\nclient1.ApplyUpdate(update3)\nclient2.ApplyUpdate(update2)\n\n// Both clients now have identical content\n// The exact order depends on client IDs for conflict resolution\nfmt.Println(client1.Content()) // Both clients have the same content\nfmt.Println(client2.Content()) // with both edits integrated\n```\n\n🏗️ Architecture:\nYGo consists of several core components:\n\n- YDoc: The main document interface that users interact with\n- BlockStore: The underlying data structure that maintains blocks of text\n- Block: The basic unit of text storage with metadata for CRDT operations\n- MarkerSystem: Manages insertion positions throughout the document\n\n🛣️ Roadmap:\n- Performance optimizations for large documents\n- Additional CRDT data types (arrays, maps, counters)\n- Network integration examples (WIP)\n- Developer tools and visualizations (WIP)\n- Interoperability with other CRDT implementations\n\n📄 License:\nThis project is licensed under the Apache-2.0 license.\n\n📚 Learn More About CRDTs:\n- Paper this library is based on: https://www.researchgate.net/publication/310212186_Near_Real-Time_Peer-to-Peer_Shared_Editing_on_Extensible_Data_Types\n- [CRDT Website](https://crdt.tech/): to learn about CRDT's in depth\n- I recommend reading this entire [blog series](https://www.bartoszsypytkowski.com/the-state-of-a-state-based-crdts/) by Bartosz (maintainer of the y-crdt project) \n\n🙏 Acknowledgements:\nThis implementation draws inspiration from:\n- [Yjs](https://github.com/yjs/yjs)\n- [Y-crdt](https://github.com/y-crdt/y-crdt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famoghyermalkar123%2Fygo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famoghyermalkar123%2Fygo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famoghyermalkar123%2Fygo/lists"}