Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ We use the following icons for supported backend databases and SDKs:
- Flutter: `icon="flutter"`
- React Native: `icon="react"`
- Web: `icon="js"`
- Kotlin: `icon="k"`
- Kotlin: `icon="android"`
- Swift: `icon="swift"`
- Node.js: `icon="node-js"`
- .NET: `icon="microsoft"`
Expand Down
2 changes: 1 addition & 1 deletion client-sdks/advanced/data-encryption.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
Encryption support is available for PowerSync's Node.js SDK using [`better-sqlite3-multiple-ciphers`](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers). See usage details and code examples in the [Node.js SDK reference](/client-sdks/reference/node#encryption-and-custom-sqlite-drivers).
</Accordion>

<Accordion title="Kotlin" icon="k">
<Accordion title="Kotlin" icon="android">
Encryption support is available for PowerSync's Kotlin SDK (since version 1.9.0) using [`SQLite3MultipleCiphers`](https://utelle.github.io/SQLite3MultipleCiphers/) via the [`com.powersync:sqlite3multipleciphers`](https://central.sonatype.com/artifact/com.powersync/sqlite3multipleciphers) package. This allows you to encrypt your local SQLite database with various cipher algorithms.

**Setup:**
Expand All @@ -57,7 +57,7 @@

2. Add a dependency on `com.powersync:sqlite3multipleciphers`.

3. Since `:core` includes a Ktor client implementation, you'll need to [add one manually](https://ktor.io/docs/client-engines.html) if you're not already using Ktor:

Check warning on line 60 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L60

Did you really mean 'Ktor'?

Check warning on line 60 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L60

Did you really mean 'Ktor'?
- Android/JVM: `io.ktor:ktor-client-okhttp`
- Apple targets (Kotlin/Native): `io.ktor:ktor-client-darwin`

Expand Down Expand Up @@ -108,9 +108,9 @@
The PowerSync Swift SDK depends on [CSQLite](https://github.com/powersync-ja/CSQLite) to build and link SQLite.
That package can be configured to optionally link SQLite3 Multiple Ciphers by enabling the `Encryption` trait. Due to SwiftPM limitations, we can't directly expose that trait on the Swift SDK.

Instead, we recommend directly depending on CSQLite with the encryption trait, which will enable the same for the SDK (since each package can only appear in a build once). Since Xcode doesn't support specifying package traits when adding dependencies, you first need to add a local Swift package as a workaround.

Check warning on line 111 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L111

Did you really mean 'CSQLite'?

1. Create a local `Package.swift` in your project that depends on CSQLite with the `Encryption` trait:

Check warning on line 113 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L113

Did you really mean 'CSQLite'?

```swift
// swift-tools-version: 6.2
Expand Down
2 changes: 1 addition & 1 deletion client-sdks/orms/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We specifically avoid implementing our own ORM since we feel it's better to supp
<Card title="Dart/Flutter" icon="flutter" horizontal href="/client-sdks/orms/flutter-orm-support" />
<Card title="JavaScript" icon="js" horizontal href="/client-sdks/orms/js/overview" />
<Card title="Swift" icon="swift" horizontal href="/client-sdks/orms/swift/grdb" />
<Card title="Kotlin" icon="k" horizontal href="/client-sdks/orms/kotlin/overview" />
<Card title="Kotlin" icon="android" horizontal href="/client-sdks/orms/kotlin/overview" />
</CardGroup>

## Learn More
Expand Down
2 changes: 1 addition & 1 deletion client-sdks/reading-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
Read data using SQL queries:

<CodeGroup>
```typescript React Native, Web, Node.js & Capacitor (TS)
```typescript TypeScript
// Get all todos
const todos = await db.getAll('SELECT * FROM todos');

// Get a single todo
const todo = await db.get('SELECT * FROM todos WHERE id = ?', [todoId]);

Check warning on line 19 in client-sdks/reading-data.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reading-data.mdx#L19

Did you really mean 'todoId'?

// Watch for changes (reactive query)
const stream = db.watch('SELECT * FROM todos WHERE list_id = ?', [listId]);

Check warning on line 22 in client-sdks/reading-data.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reading-data.mdx#L22

Did you really mean 'list_id'?

Check warning on line 22 in client-sdks/reading-data.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reading-data.mdx#L22

Did you really mean 'listId'?
for await (const todos of stream) {
// Update UI when data changes
console.log(todos);
Expand Down
19 changes: 0 additions & 19 deletions client-sdks/reference/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -342,22 +342,3 @@ See [Supported Platforms -> Kotlin SDK](/resources/supported-platforms#kotlin-sd
## Upgrading the SDK

Update your project's Gradle file (`build.gradle.kts`) with the latest version of the [SDK](https://central.sonatype.com/artifact/com.powersync/core).

## Developer Notes

### Client Implementation

The PowerSync Service sends encoded instructions about data to sync to connected clients.
These instructions are decoded by our SDKs, and on Kotlin there are two implementations available for this:

1. **Kotlin (default)**
- This is the original implementation method, mostly implemented in Kotlin.
- Most upcoming features will not be ported to this implementation, and we intend to remove it eventually.
2. **Rust (currently experimental)**
- This is a newer implementation, mostly implemented in Rust but still using Kotlin for networking.
- Apart from newer features, this implementation is also more performant.
- We [encourage interested users to try it out](https://releases.powersync.com/announcements/improved-sync-performance-in-our-client-sdks)
and report feedback, as we intend to make it the default after a stabilization period.

To enable the Rust client, pass `SyncOptions(newClientImplementation = true)` as a second parameter when
[connecting](https://powersync-ja.github.io/powersync-kotlin/core/com.powersync/-power-sync-database/connect.html).
18 changes: 7 additions & 11 deletions client-sdks/reference/rust.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import LocalOnly from '/snippets/local-only-escape.mdx';

<Warning>
This SDK is currently in a **pre-alpha / experimental** state and is intended for gathering external feedback. It is not suitable for production use.
This SDK is currently in **pre-alpha** and is intended for gathering external feedback. It is not suitable for production use.
We also can't guarantee continued support for the SDK at this time.
If you're interested in using the PowerSync Rust SDK, please [contact us](/resources/contact-us) with details about your use case.
</Warning>
Expand Down Expand Up @@ -117,15 +117,15 @@

#### Database setup

For maximum flexibility, the PowerSync Rust SDK can be configured with different asynchronous runtimes and HTTP clients used to connect to the PowerSync Service.

Check warning on line 120 in client-sdks/reference/rust.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reference/rust.mdx#L120

Did you really mean 'runtimes'?
These dependencies can be configured through the [`PowerSyncEnvironment`](https://docs.rs/powersync/latest/powersync/env/struct.PowerSyncEnvironment.html)
struct, which wraps:

1. An HTTP client (using traits from the `http-client` crate). We recommend enabling the `curl_client` feature
on that crate and then using an `IsahcClient`. The `H1Client` is known not to work with PowerSync because it can't cancel response streams properly.
1. An HTTP client (implement the `powersync::http::HttpClient` trait). When enabling the `reqwest` feature on
the `powersync` crate, that trait is implemented for `reqwest::Client`.
2. An asynchronous pool giving out leases to SQLite connections.
3. A timer implementation allowing the sync client to implement delayed retries on connection errors.
This is typically provided by async runtimes like Tokio.

Check warning on line 128 in client-sdks/reference/rust.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reference/rust.mdx#L128

Did you really mean 'runtimes'?

Check warning on line 128 in client-sdks/reference/rust.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reference/rust.mdx#L128

Did you really mean 'Tokio'?

To configure PowerSync, begin by configuring a connection pool:

Expand Down Expand Up @@ -176,11 +176,10 @@
.expect("could not load PowerSync core extension");

let pool = open_pool().expect("open pool");
let client = Arc::new(IsahcClient::new());
let env = PowerSyncEnvironment::custom(
client.clone(),
reqwest::Client::new(),
pool,
Box::new(PowerSyncEnvironment::tokio_timer()),
PowerSyncEnvironment::tokio_timer(),
);

let db = PowerSyncDatabase::new(env, schema::app_schema());
Expand All @@ -195,12 +194,11 @@
```Rust
async fn start_app() {
let pool = open_pool().expect("open pool");
let client = Arc::new(IsahcClient::new());
let env = PowerSyncEnvironment::custom(
client.clone(),
reqwest::Client::new(),
pool,
// Use the async_io crate to implement timers in PowerSync
Box::new(PowerSyncEnvironment::async_io_timer()),
PowerSyncEnvironment::async_io_timer(),
);

let db = PowerSyncDatabase::new(env, schema::app_schema());
Expand All @@ -222,9 +220,9 @@
</Tab>

<Tab title="Other">
PowerSync is executor-agnostic and supports all async Rust runtimes. You need to provide:

Check warning on line 223 in client-sdks/reference/rust.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reference/rust.mdx#L223

Did you really mean 'runtimes'?

1. A future that delays execution by scheduling its waker through a timer.

Check warning on line 225 in client-sdks/reference/rust.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reference/rust.mdx#L225

Did you really mean 'waker'?
2. A way to spawn futures as a task that is polled independently.

PowerSync uses the [`Timer`](https://docs.rs/powersync/latest/powersync/env/trait.Timer.html)
Expand All @@ -242,7 +240,6 @@
```Rust
// MyBackendConnector is defined in the next step...
db.connect(SyncOptions::new(MyBackendConnector {
client,
db: db.clone(),
})).await;
```
Expand All @@ -265,7 +262,6 @@

```Rust
struct MyBackendConnector {
client: Arc<dyn http_client::HttpClient>,
db: PowerSyncDatabase,
}

Expand Down Expand Up @@ -377,7 +373,7 @@
## ORM / SQL Library Support

The Rust SDK does not currently support any higher-level SQL libraries, but we're investigating
support for Diesel and sqlx.

Check warning on line 376 in client-sdks/reference/rust.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/reference/rust.mdx#L376

Did you really mean 'sqlx'?
Please reach out to us if you're interested in these or other integrations.

## Troubleshooting
Expand Down
Loading