pglite icon indicating copy to clipboard operation
pglite copied to clipboard

chore: Linearlite - Electric sync + PGlite demo app

Open samwillis opened this issue 1 year ago • 1 comments

This is a demo app demonstrating how to build a local-first app using Electric sync and PGlite. It's a clone of the Linear project management tool.

Features:

  • Sync with electric
  • Write through the database via a write path server src/server.ts where you can implement custom validation and conflict handling
  • Merging of non-synced edits handled in database using triggers
  • Postgres FTS for the search feature
  • Windowed live queries synced to the windowed/virtualised scrolling so that only the rows onscreen (and a few more) are loaded

Can handle in excess of 100k issues and 500k comments.

https://github.com/user-attachments/assets/808a4de6-8488-4a98-88d3-7d3d0a9f1641

This version replaces #368 where the modified rows are in the same table as the synced data. This improves read performance.

samwillis avatar Oct 16 '24 13:10 samwillis

Built bundles:

  • Postgres WASM: https://github.com/electric-sql/pglite/actions/runs/12233125505/artifacts/2292799339
  • Interim build files: https://github.com/electric-sql/pglite/actions/runs/12233125505/artifacts/2292799519
  • PGlite: https://github.com/electric-sql/pglite/actions/runs/12233125505/artifacts/2292844820
  • Demos: https://github.com/electric-sql/pglite/actions/runs/12233125505/artifacts/2292869753

github-actions[bot] avatar Oct 16 '24 13:10 github-actions[bot]

What's the status on merging and deploying this?

thruflo avatar Nov 19 '24 09:11 thruflo

I've cherry picked out all the changes to PGlite + the sync plugin, they are now all in main with docs and testing, and most were released (just windowed live queries aren't).

I just need to rebase this on main and merge it. I'll try and pick that up tomorrow. I'll have a chat with @balegas on plan for deploying it.

samwillis avatar Nov 19 '24 19:11 samwillis

@balegas could I get you to review the merge logic: https://github.com/electric-sql/pglite/pull/393/files#diff-9ea8511284754ad34fc4d8ee4bf19aeb0996d57e0b22ac29589580fe7e21848a

@msfstef if you have a moment early next week could you have a skim though the app code. Versions of Linerarlite have been reviewed so many times it should be relatively cursory

samwillis avatar Nov 22 '24 07:11 samwillis

🚀 Deployed on https://674d78c7b97b14c75c6d5041--pglite.netlify.app

github-actions[bot] avatar Nov 28 '24 12:11 github-actions[bot]

This example was moved into the main Electric monorepo

samwillis avatar Jan 13 '25 18:01 samwillis