diff --git a/examples/write-patterns/README.md b/examples/write-patterns/README.md index 7de84785b5..941784a841 100644 --- a/examples/write-patterns/README.md +++ b/examples/write-patterns/README.md @@ -1,6 +1,8 @@ # Write patterns example -This example demonstrates the four different [write-patterns](https://electric-sql.com/docs/guides/writes#patterns) from the [Writes](https://electric-sql.com/docs/guides/writes#patterns) guide. All running together, at the same time, within a single web application. +This example demonstrates the four different [write-patterns](https://electric-sql.com/docs/guides/writes#patterns) described in the[Writes](https://electric-sql.com/docs/guides/writes#patterns) guide. + +All running together, at the same time, within a single web application. > ... screenshot ... @@ -15,12 +17,12 @@ There's some shared boilerplate in [`./shared`](./shared). The code implementing ### Patterns -All of the patterns [use Electric for read-path sync](https://electric-sql.com/product/sync) from Postgres into the local app. They each implement a different pattern for the write-path, (i.e.: how they handle local writes and get data from the local app back into Postgres). +All of the patterns use [Electric](https://electric-sql.com/product/sync) for the read-path (i.e.: syncing data from Postgres into the local app) and implement a different approach to the write-path (i.e.: how they handle local writes and get data from the local app back into Postgres): -- [`1-online-writes`](./patterns/1-online-writes) uses simple online writes through the backend API -- [`2-optimistic-state`](./patterns/2-optimistic-state) supports offline writes with simple optimistic state (no persistence) +- [`1-online-writes`](./patterns/1-online-writes) uses online writes through the backend API +- [`2-optimistic-state`](./patterns/2-optimistic-state) supports offline writes with simple optimistic state (component-scoped, no persistence) - [`3-combine-on-read`](./patterns/3-combine-on-read) syncs into an immutable table, persists optimistic state in a shadow table and combines the two on read -- [`4-through-the-db`](./patterns/4-through-the-db) uses the local database as a unified mutable store, monitors changes, syncs them to the server — and keeps enough history and bookkeeping data around to be able to revert local changes when necessary +- [`4-through-the-db`](./patterns/4-through-the-db) uses the local database as a unified mutable store, syncs changes to the server and keeps enough history and bookkeeping data around to be able to revert local changes when necessary For more context about the patterns and their benefits and trade-offs, see the [Writes](https://electric-sql.com/docs/guides/writes#patterns) guide. @@ -45,6 +47,8 @@ In this directory in another terminal: `pnpm run dev` +Open [localhost:5173](http://localhost:5173) in your web browser. + 4. When done, tear down the backend containers so you can run other examples `pnpm run backend:down`