{"id":21217210,"url":"https://github.com/cachapa/sql_crdt","last_synced_at":"2025-04-09T07:08:57.345Z","repository":{"id":65142426,"uuid":"583110811","full_name":"cachapa/sql_crdt","owner":"cachapa","description":"Dart implementation of Conflict-free Replicated Data Types (CRDTs) using SQL databases","archived":false,"fork":false,"pushed_at":"2024-11-02T09:27:11.000Z","size":146,"stargazers_count":73,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T06:08:55.339Z","etag":null,"topics":["crdt","dart","database","flutter","postgres","postgresql","sql","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/sql_crdt","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":"2022-12-28T19:53:26.000Z","updated_at":"2025-03-21T14:58:59.000Z","dependencies_parsed_at":"2023-10-11T22:01:08.037Z","dependency_job_id":"2d81b690-8fd1-4ee8-986f-cd011036bb9c","html_url":"https://github.com/cachapa/sql_crdt","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"f0237af9710f343777f850f53fa063e63981ac49"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fsql_crdt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fsql_crdt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fsql_crdt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachapa%2Fsql_crdt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cachapa","download_url":"https://codeload.github.com/cachapa/sql_crdt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994121,"owners_count":21030050,"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","dart","database","flutter","postgres","postgresql","sql","sqlite","sqlite3"],"created_at":"2024-11-20T21:57:28.932Z","updated_at":"2025-04-09T07:08:57.325Z","avatar_url":"https://github.com/cachapa.png","language":"Dart","readme":"Dart implementation of Conflict-free Replicated Data Types (CRDTs) using SQL databases.\n\nThis project is heavily influenced by James Long's talk [CRTDs for Mortals](https://www.dotconferences.com/2019/12/james-long-crdts-for-mortals) and includes a Dart-native implementation of Hybrid Local Clocks (HLC) based on the paper [Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases](https://cse.buffalo.edu/tech-reports/2014-04.pdf).\n\n`sql_crdt` is based on [crdt](https://github.com/cachapa/crdt) and the learnings from [Libra](https://libra-app.eu), [StoryArk](https://storyark.eu) and [tudo](https://github.com/cachapa/tudo).  \n\nThis package is abstract and implements the base functionality for CRDTs backed by a relational database. Check [sqlite_crdt](https://github.com/cachapa/sqlite_crdt.git) and [postgres_crdt](https://github.com/cachapa/postgres_crdt.git) for usable implementations.\n\nSee also [tudo](https://github.com/cachapa/tudo) for a real-world FOSS implementation.\n\nThis package is compatible with [crdt_sync](https://github.com/cachapa/crdt_sync), a turnkey approach for real-time network synchronization of CRDT nodes.\n\n## Notes\n\n`sql_crdt` is not an ORM. The API is essentially that of a plain old SQL database with a few behavioural changes:\n\n* Every table gets 3 columns automatically added: `is_deleted`, `hlc`, and `modified`.\n* Deleted records aren't actually removed but rather flagged in the `is_deleted` column.\n* A reactive `watch` method to subscribe to database queries.\n* Convenience methods `getChangeset` and `merge` inherited from the `crdt` package to sync with remote nodes.\n\n\u003e ⚠ Because deleted records are only flagged as deleted, they may need to be sanitized in order to be compliant with GDPR and similar legislation.\n\n## API\n\nThe API is intentionally kept simple with a few methods:\n\n* `execute` to run non-select SQL queries, e.g. inserts, updates, etc.\n* `query` to perform a one-time query.\n* `watch` to receive query results whenever the database changes.\n* `getChangeset` to generate a serializable changeset of the local database.\n* `merge` to apply a remote changeset to the local database.\n* `transaction` a blocking mechanism that avoids running simultaneous transactions in async code.\n\nCheck the examples in [sqlite_crdt](https://github.com/cachapa/sqlite_crdt/blob/master/example/example.dart) and [postgres_crdt](https://github.com/cachapa/postgres_crdt/blob/master/example/example.dart) for more details.\n\n## Features and bugs\n\nPlease file feature requests and bugs in the [issue tracker](https://github.com/cachapa/sql_crdt/issues).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachapa%2Fsql_crdt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcachapa%2Fsql_crdt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachapa%2Fsql_crdt/lists"}