{"id":21217233,"url":"https://github.com/cachapa/crdt_sync","last_synced_at":"2025-04-13T22:26:00.928Z","repository":{"id":186924480,"uuid":"675949264","full_name":"cachapa/crdt_sync","owner":"cachapa","description":"A dart-native turnkey solution for painless network synchronization","archived":false,"fork":false,"pushed_at":"2024-11-02T09:17:32.000Z","size":63,"stargazers_count":24,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T12:47:01.892Z","etag":null,"topics":["crdt","sql","websocket"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/crdt_sync","language":"Dart","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/cachapa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-08-08T05:13:16.000Z","updated_at":"2025-03-19T02:51:25.000Z","dependencies_parsed_at":"2025-01-21T16:44:05.196Z","dependency_job_id":"e9a8a4c6-23fd-4d43-940c-2e844f010e1e","html_url":"https://github.com/cachapa/crdt_sync","commit_stats":null,"previous_names":["cachapa/crdt_sync"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fcrdt_sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fcrdt_sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fcrdt_sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fcrdt_sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cachapa","download_url":"https://codeload.github.com/cachapa/crdt_sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790152,"owners_count":21161950,"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","sql","websocket"],"created_at":"2024-11-20T21:57:33.894Z","updated_at":"2025-04-13T22:26:00.405Z","avatar_url":"https://github.com/cachapa.png","language":"Dart","readme":"# crdt_sync\n\nA Dart-native turnkey solution for painless network synchronization.\n\n`crdt_sync` takes care of the network plumbing between your app and backend to build products that are:\n\n* Offline-first: Apps primarily work with a local store independent of network connectivity.\n* Real-time: When online, the local store immediately and continuously synchronizes with the backend.\n* Efficient: Synchronization relies on delta changesets to optimize the amount of data sent over the wire.\n* Portable: All communication happens over a single standard WebSocket making it compatible with most network configurations.\n\nThis library is compatible with the `crdt` package and all of its implementations. It uses a standard communication protocol which abstracts the underlying storage method. This results in the dubious ability to synchronize SQL nodes with No-SQL ones. I don't judge.\n\nSee [crdt](https://github.com/cachapa/crdt) for more details and a list of existing implementations.\n\n## Usage\n\nYou'll most likely want to use a persistent `crdt` store, however the following sample code uses an ephemeral `MapCrdt` for the sake of simplicity:\n\n```dart\nfinal crdt = MapCrdt(['chat']);\n```\n\n### Server\n\nStart listening for connections:\n\n```dart\nlisten(crdt, 8080);\n```\n\nAlternatively, you can use `upgrade()` to adopt an `HttpRequest`, or `CrdtSync.server()` to manage a `WebSocket` directly making it easy to integrate with [Shelf](https://pub.dev/packages/shelf) and other server frameworks.\n\nSee [tudo_server](https://github.com/cachapa/tudo_server) for a real world example.\n\n### Client\n\nInstantiate a `CrdtSyncClient` and order it to start connecting:\n\n```dart\nfinal client = CrdtSyncClient(crdt, Uri.parse('ws://localhost:8080'));\nclient.connect();\n```\n\nOnce `connect()` is called, the client will continuously attempt to establish or resume a connection until it succeeds, or until `disconnect()` is called.\n\nSee the included [example](https://github.com/cachapa/crdt_sync/blob/master/example/example.dart) for a more complete solution, or [tudo](https://github.com/cachapa/tudo) for a real-world application.\n\n## Features and bugs\n\nPlease file feature requests and bugs in the [issue tracker](https://github.com/cachapa/crdt_sync/issues).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachapa%2Fcrdt_sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcachapa%2Fcrdt_sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachapa%2Fcrdt_sync/lists"}