{"id":20604223,"url":"https://github.com/y-crdt/ydotnet","last_synced_at":"2025-04-15T02:19:54.346Z","repository":{"id":157776655,"uuid":"629753369","full_name":"y-crdt/ydotnet","owner":"y-crdt","description":".NET bindings for yrs.","archived":false,"fork":false,"pushed_at":"2025-02-03T11:42:10.000Z","size":1252,"stargazers_count":43,"open_issues_count":11,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-15T02:19:46.912Z","etag":null,"topics":["crdt","csharp","dotnet","yjs","yrs"],"latest_commit_sha":null,"homepage":"","language":"C#","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/y-crdt.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}},"created_at":"2023-04-19T00:46:39.000Z","updated_at":"2025-03-25T15:37:30.000Z","dependencies_parsed_at":"2024-04-14T21:46:26.545Z","dependency_job_id":null,"html_url":"https://github.com/y-crdt/ydotnet","commit_stats":null,"previous_names":["y-crdt/ydotnet","lsviana/ydotnet"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fydotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fydotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fydotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-crdt%2Fydotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/y-crdt","download_url":"https://codeload.github.com/y-crdt/ydotnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991600,"owners_count":21194903,"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","csharp","dotnet","yjs","yrs"],"created_at":"2024-11-16T09:21:36.681Z","updated_at":"2025-04-15T02:19:54.322Z","avatar_url":"https://github.com/y-crdt.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"128\" height=\"128\" src=\"https://github.com/LSViana/ydotnet/assets/21217790/51be1008-7bac-4bb0-b5bb-d4c9f5ab6d7d\" /\u003e\n\u003c/p\u003e\n\n# YDotNet\n\nYDotNet is a .NET binding for [`y-crdt`](https://github.com/y-crdt/ypy). It provides distributed data types that enable\nreal-time collaboration between devices. The library is a thin wrapper around Yrs, taking advantage of the safety and performance of Rust.\n\n\u003e 💡 Disclaimer: this project is still early, so it may contain bugs and the API is subject to change. Feel free to\n\u003e [open an issue](https://github.com/LSViana/ydotnet/issues/new) if you'd like to report problems or suggest new features.\n\n# Demo\n\nCheck the following video:\n\nhttps://github.com/LSViana/ydotnet/assets/21217790/cdb6023d-25d1-4951-82ae-b079ddbd8d26\n\n# Installation\n\nFor every scenario, you must start by installing the core of the library.\n\nTo do so, in the project directory (where you `.csproj` lives), execute:\n\n```shell\ndotnet add package YDotNet\n```\n\nThen, install the platform-specific package in order to get the binaries.\n\n| Package                                                                     | Platform |\n|-----------------------------------------------------------------------------|----------|\n| [YDotNet.Native.Win32](https://www.nuget.org/packages/YDotNet.Native.Win32) | Windows  |\n| [YDotNet.Native.Linux](https://www.nuget.org/packages/YDotNet.Native.Linux) | Linux    |\n| [YDotNet.Native.MacOS](https://www.nuget.org/packages/YDotNet.Native.MacOS) | macOS    |\n\nAnd you may also install the following packages to get extra features.\n\n| Package                                                                               | Description                                                                         |\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|\n| [YDotNet.Extensions](https://www.nuget.org/packages/YDotNet.Extensions)               | Extension methods to make some operations easier.                                   |\n| [YDotNet.Server](https://www.nuget.org/packages/YDotNet.Server)                       | Provides the hosting infrastructure for all communication channels, like WebSocket. |\n| [YDotNet.Server.WebSockets](https://www.nuget.org/packages/YDotNet.Server.WebSockets) | Use WebSockets as the communication channel between clients.                        |\n| [YDotNet.Server.MongoDB](https://www.nuget.org/packages/YDotNet.Server.MongoDB)       | Use MongoDB as a persistence layer.                                                 |\n| [YDotNet.Server.Redis](https://www.nuget.org/packages/YDotNet.Server.Redis)           | Use Redis as a persistence layer.                                                   |\n\n# Getting Started\n\nYDotNet provides the same shared data types as [Yjs](https://docs.yjs.dev/). All objects are shared within a\n[`Doc`](https://github.com/LSViana/ydotnet/blob/5c51f761f608d03fc88edaaf31aee4608afe0d3e/YDotNet/Document/Doc.cs) and always get modified within\nthe scope of a [`Transaction`](https://github.com/LSViana/ydotnet/blob/5c51f761f608d03fc88edaaf31aee4608afe0d3e/YDotNet/Document/Transactions/Transaction.cs).\n\n```csharp\n// Set up the local document with some sample data.\nvar localDoc = new Doc();\nvar localText = localDoc.Text(\"name\");\n\nvar localTransaction = localDoc.WriteTransaction();\nlocalText.Insert(localTransaction, 0, \"Y-CRDT\");\nlocalTransaction.Commit();\n\n// Set up the remote document.\nvar remoteDoc = new Doc();\nvar remoteText = remoteDoc.Text(\"name\");\n\n// Get the remote document state vector.\nvar remoteTransaction = remoteDoc.WriteTransaction();\nvar remoteState = remoteTransaction.StateVectorV1();\n\n// Calculate the state diff between the local and the remote document.\nlocalTransaction = localDoc.ReadTransaction();\nvar stateDiff = localTransaction.StateDiffV1(remoteState);\nlocalTransaction.Commit();\n\n// Apply the state diff to synchronize the remote document with the local changes.\nvar result = remoteTransaction.ApplyV1(stateDiff);\n\n// Read the text from the remote document.\nvar text = remoteText.String(remoteTransaction);\n\n// At this point, the `text` variable is \"Y-CRDT\" and this demonstrates how the two\n// documents synchronized their state.\n//\n// This example does it locally but the same could be done over the Internet, for example.\n```\n\n# Development Setup\n\nTo contribute with this library, you'll need to install the following tools:\n\n- [.NET SDK](https://dotnet.microsoft.com/download/dotnet/)\n- [Rust](https://www.rust-lang.org/tools/install)\n\nThen you should clone the [`y-crdt`](https://github.com/y-crdt/y-crdt) repository. With the repository\ncloned and the tools installed, you'll be able to:\n\n1. Make changes to the Rust or C# library;\n2. Re-build the Rust and C# binaries;\n    - Be aware that you'll need to use\n      [`crate-type=cdylib`](https://github.com/y-crdt/y-crdt/blob/main/yffi/Cargo.toml#L19)\n      on the `Cargo.toml` file to get a dynamic library that's callable by C#.\n3. Test your changes and repeat.\n\nThen you're ready to go! Feel free to contribute, open issues, and ask questions.\n\n# Tests\n\nAll tests are located in the [`YDotNet.Tests.Unit`](https://github.com/LSViana/ydotnet/tree/main/Tests/YDotNet.Tests.Unit)\nproject and should be easily runnable using the command:\n\n```sh\ndotnet test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-crdt%2Fydotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fy-crdt%2Fydotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-crdt%2Fydotnet/lists"}