Replies: 4 comments 3 replies
-
|
In most cases, Tauri apps indeed have most of their logic in Javascript. It's just simpler. Most developers choose Tauri not because of Rust backend, but because of lower memory footprint compared to Electron, imo. Reserving Rust layer for performance-heavy features, or features that require low-level platform control. I have a colleague who works on a Tauri project. He has chosen to write most of the logic in Rust, just because he's more comfortable with Rust, rather than Javascript. So, although not very common, that still might be a choice for some. |
Beta Was this translation helpful? Give feedback.
-
|
It would be great to have this logic on the rust side. That's where we have kept our sql connections using rusqlite |
Beta Was this translation helpful? Give feedback.
-
|
An update on this: We've shipped the initial version of the Tauri SDK! See our announcement and the documentation for more information. In its current state, almost everything from our JavaScript SDK is available. Databases can be shared between Rust and JavaScript code, that includes watched queries and sync status information. State from databases is also automatically shared across multiple windows if you use that feature. For now, connecting and disconnecting needs to be done in Rust (which allows a backend connector implementation to stay active across multiple window lifecycles, something that would be tricky to do in JavaScript alone). We're definitely looking for feedback if you're interested in trying this out! |
Beta Was this translation helpful? Give feedback.
-
|
What would be awesome is if you can combine tanstack db with the tauri sdk, I think that would make sense as tauri sdk interface is javascript as well! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Status: The initial version of the Tauri SDK has shipped! See our announcement and the documentation for more information.
We are investigating a potential Tauri (v2) SDK, and would love to hear your thoughts and feedback if you're interested!
Scope
The main interface of a Tauri SDK would match that of our existing JavaScript SDKs. Our JavaScript SDKs use a layered architecture where high-level features are implemented over a low-level SQLite driver, and this seems like a reasonable approach for a Tauri SDK as well:
@powersync/common.This would be a reasonable approach for an initial Tauri SDK since very little work on our side (exposing the Rust connection pool API we already have) gets us very far (a whole new JavaScript SDK).
Rust APIs?
While simple, using the existing JavaScript implementation for everything is not a perfect solution:
A reasonable roadmap might be to start with the connection pool in Rust only, but we should strongly prefer to keep all PowerSync database state (including the streaming HTTP client) in Rust.
Later, we can also investigate using Tauri's permission model to e.g. restrict database paths usable with PowerSync.
Supported platforms
Initially, we're aiming to support Desktop platforms (Linux, macOS and Windows).
Since we have no external platform dependencies and can compile all our code through cargo, there's nothing fundamentally preventing us from supporting Android and iOS too. However, if we do decide to implement networking logic in Rust, then we might need a way to use the platform's HTTP client since Android does not expose trusted root certificates otherwise. It would be worth checking how
reqwestdoes that.Prior art
@MrLightful shared an example using PowerSync with Tauri. A native Tauri SDK would offer a similar JavaScript API, but with the following improvements:
Beta Was this translation helpful? Give feedback.
All reactions