Recipes
A recipe is a complete setup: every file you need, the command that installs the packages, and the few points where people usually get stuck. Copy it, run it, then change it.
The other pages explain one piece at a time. A recipe shows the pieces already connected: a document with its storage, a Flutter screen, a server and its clients.
The code on these pages is the code of the repository, and a test runs it in
CI. Most recipes live in the
crdt_lf_recipes
package. The Dart Frog and Serverpod servers are the example/ and
relay_example/ folders of their adapter packages.
馃嵆 Two peers, one resultTwo documents edit one text at the same time, with no connection. They exchange their changes and both read the same text.Dart VMFlutter nativecrdt_lf馃嵆 A text note saved on diskA Dart program that keeps one collaborative text in a local database, with the storage adapter you pick. Every run reads the note back and adds a line.Dart VMFlutter nativeSQLite 路 Drift 路 Hivecrdt_lf 路 crdt_lf_sqlite 路 crdt_lf_drift 路 crdt_lf_hive 路 hive馃嵆 A text note in Flutter, saved on the deviceA Flutter app with one collaborative text field. Hive keeps the note on the device, also on the web, and every restart shows it again.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter 路 crdt_lf_hive 路 hive 路 path_provider馃嵆 A list of notes: many documents in one appA Flutter app with a list of notes, one document each, kept on the device by Hive. The list reads each title without following the note, a tap opens the note to edit it, and a swipe deletes it.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter 路 crdt_lf_hive 路 hive 路 path_provider馃嵆 A todo list with containers: merged per fieldA Flutter todo list built with container handlers: each todo is a small map of handlers, a collaborative text and a done flag. Two peers can edit the text and check the same todo at the same time, or move it, and both edits are kept.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter馃嵆 A todo list as an aggregate: events and undoA Flutter todo list held by one aggregate: the app writes events (added, edited, checked, moved, removed), and a reducer folds them the same way on every peer. Each action can be undone.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter馃嵆 The history of a note: see it after each changeA Flutter note with a history page: a slider moves through the changes, the page shows the note as it was after each one, and says who made the change and when. The history is read-only.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter馃嵆 A rich text editor with flutter_quill, saved, with undoA flutter_quill editor and toolbar bound to a collaborative rich text. Hive keeps the page on the device, and undo takes back only your own edits, formats included.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter 路 crdt_lf_hive 路 crdt_lf_quill 路 flutter_quill 路 hive 路 path_provider馃嵆 A real-time note: a Dart server and its clientsA Dart server that holds one shared note, and a client that edits it. Every client that opens the same document sees the edits of the others live.Dart VMFlutter nativecrdt_lf 路 crdt_socket_sync馃嵆 Rooms on demand with a relayA relay server that hosts any number of rooms, with no setup, and a client that joins a room by its document id. The relay stores and rebroadcasts the changes; the clients merge them.Dart VMFlutter nativecrdt_lf 路 crdt_socket_sync馃嵆 An offline-first Flutter app: storage and sync in one callA Flutter note that opens from the device at once, then syncs through a relay server.
CRDTReplica opens the storage and the client in the right order, and edits made offline reach the other devices later.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter 路 crdt_lf_hive 路 crdt_socket_sync 路 hive 路 path_provider馃嵆 Remote cursors and presenceA relay server that shares who is in each room, and a Flutter note, kept on the device by Hive, that shows the carets of the other peers, with their name and color, as they type.Flutter nativeFlutter webcrdt_lf 路 crdt_lf_flutter 路 crdt_lf_hive 路 crdt_socket_sync 路 hive 路 path_provider馃嵆 A shared outline: nested data, saved and syncedA Dart program that keeps a tree (chapters, each with a title and a text) in a SQLite file and syncs it through a relay. Another device rebuilds the same tree, and a restart reads it back.Dart VMFlutter nativecrdt_lf 路 crdt_lf_sqlite 路 crdt_socket_sync馃嵆 A relay in a Dart Frog backendA Dart Frog route that serves a relay: any document id is a room, with no setup. The rooms live in memory.Dart VMcrdt_socket_sync 路 crdt_socket_sync_dart_frog 路 dart_frog馃嵆 A Dart Frog server with documents on diskA Dart Frog route in server鈥揷lient mode: the server holds the documents, stores them with Hive, and refuses a caller without the token before the WebSocket opens.Dart VMcrdt_lf_hive 路 crdt_socket_sync 路 crdt_socket_sync_dart_frog 路 dart_frog 路 hive馃嵆 A relay in a Serverpod backendA Serverpod web route that serves a relay: any document id is a room, with no setup. The rooms live in memory.Dart VMcrdt_socket_sync 路 crdt_socket_sync_serverpod 路 serverpod馃嵆 A Serverpod server with documents on diskA Serverpod web route in server鈥揷lient mode: the server holds the documents, stores them with Hive, and refuses a caller without the token before the WebSocket opens.Dart VMcrdt_lf_hive 路 crdt_socket_sync 路 crdt_socket_sync_serverpod 路 hive 路 serverpod馃嵆 A hybrid logical clockA Dart program that moves a hybrid logical clock through a local event and a message from another peer, compares the two clocks and stores the clock.Dart VMFlutter nativehlc_dartMissing the setup you need? Open an issue.