Skip to content

Commit

Permalink
example: README copy tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
thruflo committed Nov 22, 2024
1 parent c395b34 commit e021081
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions examples/write-patterns/README.md
Original file line number Diff line number Diff line change
@@ -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 ...
Expand All @@ -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.

Expand All @@ -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`

0 comments on commit e021081

Please sign in to comment.