{"id":15471095,"url":"https://github.com/gpestana/rdoc","last_synced_at":"2025-04-23T03:34:45.787Z","repository":{"id":54878477,"uuid":"121846875","full_name":"gpestana/rdoc","owner":"gpestana","description":"Conflict-free replicated JSON implementation in native Go","archived":false,"fork":false,"pushed_at":"2021-01-25T09:39:35.000Z","size":1091,"stargazers_count":94,"open_issues_count":5,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T21:41:27.497Z","etag":null,"topics":["crdt","crdts","distributed-systems","json","p2p"],"latest_commit_sha":null,"homepage":"","language":"Go","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/gpestana.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}},"created_at":"2018-02-17T10:42:16.000Z","updated_at":"2024-08-25T13:08:05.000Z","dependencies_parsed_at":"2022-08-14T05:30:58.410Z","dependency_job_id":null,"html_url":"https://github.com/gpestana/rdoc","commit_stats":null,"previous_names":["gpestana/crdt-json"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpestana%2Frdoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpestana%2Frdoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpestana%2Frdoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpestana%2Frdoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gpestana","download_url":"https://codeload.github.com/gpestana/rdoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250366282,"owners_count":21418766,"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":["crdt","crdts","distributed-systems","json","p2p"],"created_at":"2024-10-02T02:09:18.759Z","updated_at":"2025-04-23T03:34:45.769Z","avatar_url":"https://github.com/gpestana.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rdoc\n\n### rdoc (Replicated DOCument): Build better decentralized and offline-first applications in Go\n\n[![Build Status](https://travis-ci.org/gpestana/rdoc.svg?branch=master)](https://travis-ci.org/gpestana/rdoc) [![Package Version](https://img.shields.io/github/v/tag/gpestana/rdoc)](https://img.shields.io/github/v/tag/gpestana/rdoc)\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/gpestana/rdoc.svg)](https://pkg.go.dev/github.com/gpestana/rdoc)\n\nrdoc is a native go implementation of a conflict-free replicated JSON data\nstructure, as introduced by Martin Kleppmann and Alastair R. Beresford in their\nseminal work [[1]](https://arxiv.org/abs/1608.03960). A JSON CRDT is \"[...] an\nalgorithm and formal semantics for a JSON data structure that automatically\nresolves concurrent modifications such that no updates are lost, and such that\nall replicas converge towards the same state (a conflict-free replicated\ndatatype or CRDT).\"  [[1]](https://arxiv.org/abs/1608.03960).\n\nDo you want to learn more about the JSON CRDT data type? [This youtube video](https://www.youtube.com/watch?v=TRvQzwDyVro) is a good introduction to the original paper [1] by Martin Kleppmann and Alastair R. Beresford.\n\n## Features \n\n- Simple API; One API call allows the application logic to update and manage coverging JSON replicas in decentralized settings;  \n- Supports JSON Patch notation as defined in [RFC6902](https://tools.ietf.org/html/rfc6902);\n- Supports [cbor serialization](https://tools.ietf.org/html/rfc7049) [WIP; v1.1.0 milestone];\n\n## Examples\n\n```go\n\n// starts a new replicated JSON document with an unique ID (in the context of the replicas sample)\ndoc := Init(\"doc_replica_1\")\n\n// updates the document state with a JSON patch operation:\npatch := []byte(`{\"op\": \"add\", \"path\": \"/\", \"value\": \"user\"`)\nerr := doc.Apply(patch)\nif err != nil {\n    panic(err)\n}\n\n// update the document state with remote operations (i.e. operations executed by a remote replica); \n// remote operations will update the state of the document iif all its dependencies have been applied.  \nremotePath := []byte(`[\n {\"op\": \"add\", \"path\": \"/\", \"value\": \"user\", \"id\":\"1.380503024\", \"deps\": [] },\n {\"op\": \"add\", \"path\": \"/name\", \"value\": \"Jane\", \"id\":\"2.1\", \"deps\": [\"1.1\"] },\n {\"op\": \"add\", \"path\": \"/name\", \"value\": \"Jane\", \"id\":\"2.380503024\", \"deps\": [\"1.380503024\"] }\n]`)\n\nerr := doc.Apply(remotePath)\nif err != nil {\n    panic(err)\n}\n\n// Get Doc operations to send over the wire; these operations can be used by\n// remote replicas to converge state with `doc1`\ndoc1Operations := doc.Operations()\n\n// ... apply state from doc1 into doc2, in order for replicas `doc1` and `doc2` to converge\n\ndoc2.Apply(doc1Operations)\n\n// ...\n\n// Native Go marshaling/unmarshaling supported \nbuffer, err := json.Marshal(*doc)\nif err != nil {\n    panic(err)\n}\n```\n\n## References\n\n1. [A Conflict-Free Replicated JSON Datatype](https://arxiv.org/abs/1608.03960) (Martin Kleppmann, Alastair R. Beresford)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpestana%2Frdoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgpestana%2Frdoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpestana%2Frdoc/lists"}