From 5ea2af1fcd5210bf99354ffc18f7810656a1253c Mon Sep 17 00:00:00 2001 From: James Arthur Date: Tue, 10 Dec 2024 15:33:44 +0100 Subject: [PATCH] example: copy tweaks. --- examples/linearlite/README.md | 27 ++++++++++++++++----------- examples/linearlite/package.json | 4 ++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/examples/linearlite/README.md b/examples/linearlite/README.md index 4a7e0d7c08..52c0dc39e2 100644 --- a/examples/linearlite/README.md +++ b/examples/linearlite/README.md @@ -1,20 +1,25 @@ -# Linearlite + PGlite + ElectricSQL -This is a demo app that shows how to build a local-first app using PGlite and the ElectricSQL sync engine. +# Linearlite -It's an example of a team collaboration app, such as Linear built using ElectricSQL - a sync engine that synchronises small subsets of your Postgres data into local apps and services, so that you can have the data you need, in-sync, wherever you need it. +This is a comprehensive example of a local-first [Linear](https://linear.app) clone built with [Electric](https://electric-sql.com) and [PGlite](https://pglite.dev). -This example syncs the data into a local PGlite database and uses a "write through the database" pattern, where local mutations are saved to the local PGlite database and then synced to the server. See the [Write Path](#write-path) section for more details. +Linear is a collaborative project management app for teams, built on a [sync engine architecture](https://linear.app/blog/scaling-the-linear-sync-engine). Linearlite is an example app that shows how you can build a Linear-quality application using Electric and PGlite. It's built on top of the excellent clone of the Linear UI built by [Tuan Nguyen](https://github.com/tuan3w). -The following features are implemented: +It uses syncs data using Electric into a local PGlite database and uses a [write through the database](https://electric-sql.com/docs/guides/writes#through-the-db) pattern, where local mutations are saved to the local database and then synced to the server. See the [Write Path](#write-path) section below for more details. + +## Data set + +Linearlite is configured to load a large dataset of 100,000 issues, with comments, totally ~150MB into the local database. It demonstrates both fast initial sync and instant local reactivity, using fast, windowed live queries in PGlite. As such, it is intended to show how you can build large-scale, real-world apps on Electric and PGlite. -- Full bi-directional sync of data to and from the server using a "write through the database" pattern -- An indicator on each issue to show if it's been synced to the server -- Filtering and sorting of issues and comments -- A kanban board for issues with drag and drop reordering; the ordering is handled with fractional indexing so that it can be completed in a conflict free manner -- Full text search of issues and comments using Postgres's `tsvector` and `tsquery` features +## Features + +The following features are implemented: -It's built on top of the excellent clone of the Linear UI built by [Tuan Nguyen](https://github.com/tuan3w). +- full bi-directional sync of data to and from the server +- an indicator on each issue to show if it's been synced to the server +- filtering and sorting of issues and comments +- a kanban board for issues with drag and drop reordering (with conflict free ordering handled using fractional indexes) +- full text search of issues and comments using Postgres's `tsvector` and `tsquery` features ## Setup diff --git a/examples/linearlite/package.json b/examples/linearlite/package.json index 8d49b8cec9..2cbb7d3ceb 100644 --- a/examples/linearlite/package.json +++ b/examples/linearlite/package.json @@ -5,8 +5,8 @@ "private": true, "type": "module", "scripts": { - "backend:down": "PROJECT_NAME=linearlite pnpm -C ../../ run example-backend:down", - "backend:up": "PROJECT_NAME=linearlite pnpm -C ../../ run example-backend:up && pnpm db:migrate && pnpm db:load-data", + "backend:down": "PROJECT_NAME=linearlite-example pnpm -C ../../ run example-backend:down", + "backend:up": "PROJECT_NAME=linearlite-example pnpm -C ../../ run example-backend:up && pnpm db:migrate && pnpm db:load-data", "db:migrate": "dotenv -e ../../.env.dev -- pnpm exec pg-migrations apply --directory ./db/migrations-server", "db:load-data": "dotenv -e ../../.env.dev -- node ./db/load_data.js", "reset": "pnpm backend:down && pnpm backend:up && pnpm db:migrate && pnpm db:load-data",