-
Notifications
You must be signed in to change notification settings - Fork 118
Add PowerSync DB Collection #747
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
Conversation
Update main
Update From Upstream
🦋 Changeset detectedLatest commit: 718c4f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| "author": "JOURNEYAPPS", | ||
| "license": "Apache-2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to suggest alternatives for this. I've just used standard values we typically use at PowerSync.
|
serlization.ts → serialization.ts It'd be simpler to keep everything MIT I think if that's ok with y'all. Apache is more heavy operationally vs MIT and I'd rather keep things simple. |
|
Otherwise I think the PR is looking good! |
Thanks for the quick feedback! Our team is happy with MIT, we've made these changes :) |
|
Ok great! I need to do the initial manual release locally for the "PR / Preview" CI job to pass so will do that a bit later today. |
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
KyleAMathews
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
|
I'll merge the release PR in a bit — lemme know how you'd like help publicizing this! |
|
🎉 This PR has been released! Thank you for your contribution! |
🎯 Changes
This PR adds a PowerSync integration for TanStack DB collections.
Special thanks to @KyleAMathews for his advice when developing the initial POC of this integration!
This PR integrates TanStackDB collections with the PowerSync synced SQLite database. TanStack DB collections are tied to the local synced SQLite tables with the help of collection builders. These collection builders link the TanStack collection state to the SQLite table via SQLite Trigger based diff tracking. Mutations made on TanStack DB collections are persisted to SQLite via
PowerSyncTransactor, once persisted the PowerSync upload queue ensures changes are uploaded to a backend.flowchart TB subgraph UI[UI Layer] UI_Component[UI Components] end subgraph TanStack[TanStack DB Layer] TS_Cache[In-Memory Cache] TS_Collections[TanStack Collections] end subgraph PowerSync[PowerSync Layer] PS_SQLite[Local SQLite DB] PS_Client[PowerSync Client] end subgraph Backend[Backend Infrastructure] Backend_App[Application Backend] PS_Service[PowerSync Service] end UI_Component -->|Mutations| TS_Collections TS_Cache -->|Updates| UI_Component TS_Collections -->|Persist| PS_SQLite PS_SQLite -->|Watch| TS_Cache PS_Client -->|Sync| PS_SQLite PS_SQLite -->|Changes| PS_Client PS_Client -->|Changes| Backend_App Backend_App -->|Apply| PS_Service PS_Service -->|Sync| PS_Client style UI fill:#f9f,stroke:#333,stroke-width:2px style TanStack fill:#bbf,stroke:#333,stroke-width:2px style PowerSync fill:#bfb,stroke:#333,stroke-width:2px style Backend fill:#fdb,stroke:#333,stroke-width:2pxDetailed examples are in the unit tests. The main flow is to:
Create a PowerSync SDK Client
Define TanStack DB collections using the database
Use the TanStack DB collections as one would any other collection
✅ Checklist
pnpm test:pr.🚀 Release Impact