Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Linearlite - Electric sync + PGlite demo app #393

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

samwillis
Copy link
Collaborator

@samwillis samwillis commented Oct 16, 2024

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.

Linearlite+PGlite-min.mp4

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

@thruflo
Copy link
Contributor

thruflo commented Nov 19, 2024

What's the status on merging and deploying this?

@samwillis
Copy link
Collaborator Author

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 samwillis force-pushed the samwillis/linearlite2 branch from 48b2562 to b1245af Compare November 20, 2024 14:27
@samwillis samwillis requested review from balegas and msfstef November 22, 2024 07:43
@samwillis
Copy link
Collaborator Author

@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 samwillis force-pushed the samwillis/linearlite2 branch from f2b7ee4 to 0d1e75c Compare November 28, 2024 12:29
Copy link
Contributor

github-actions bot commented Nov 28, 2024

@samwillis samwillis force-pushed the samwillis/linearlite2 branch from 2a70daa to a28c961 Compare December 2, 2024 08:55
@samwillis samwillis force-pushed the samwillis/linearlite2 branch from 38b785d to 5194c45 Compare December 3, 2024 16:07
@samwillis samwillis force-pushed the samwillis/linearlite2 branch from 5194c45 to 44bf9b3 Compare December 3, 2024 16:14
FindAPattern and others added 6 commits December 3, 2024 16:17
* Swap to postgres.js so compatible with CF Workers

* Added table schema checks to linearite demo triggers.

I ran into an issue using these triggers on a table with the same name as a table in another schema. Adding table schema checks fixes the issue.

---------

Co-authored-by: Sam Willis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants