Better HN
topnewbestaskshowjobs
Log inSign up

quambo

45 karma · joined Feb 23, 2019 (7y ago) · 28 submissions

Submissions

1.

Comparing performance of different offline first solutions(github.com ↗)

2 points · by quambo · 2mo ago · discuss

2.

After the Offline Write: Durable Server Work in Syncular(syncular.dev ↗)

1 points · by quambo · 2mo ago · discuss

comment 3mo ago · link · parent

Hey, nice, looks like I’ll have to rerun the benchmarks soon!

sqlite-wasm with opfs-sahpool has mostly behaved. No OPFS in private mode, storage may be evicted, handles can’t be passed to workers, and webviews may close them when backgrounded.

We open SQLite inside one dedicated worker and proxy other tabs through it, so that avoids some of the mess. Tauri uses native SQLite.

comment 3mo ago · link · parent

The README has had plenty of LLM help, yes. I’ve described how I use them here: https://syncular.dev/llms/

I’ll keep refining it (talking about docs, tests, benchmarks etc). LLMs are involved throughout Syncular, as they are in my other projects, but this sure wasn't prompted into existence, its been built on and off over a lot of time. Have spent years deep in the offline-first rabbit hole. Most code, design and its trade-offs come from that experience and predate LLMs.

comment 3mo ago · link · parent

That’s kinda the tension I wanted to avoid. I’m not trying to make the whole SQL database a CRDT.

CRDTs are opt-in per column. A row can keep normal, queryable fields like project_id, status, and title, while one doc column stores Yjs/yrs bytes. Concurrent edits to that column are merged by the server; normal columns still use versions and explicit conflicts. Flutter uses yrs through the shared Rust core.

The trade-off is that SQL can’t query inside the CRDT document. Anything you need for filtering, joins, or aggregates should remain an ordinary column. That boundary gives you relational queries without giving up CRDTs where they’re really useful.

I’d be interested in your feedback on the Flutter client. I chose a very small C ABI—five hand-written dart:ffi bindings into the Rust core, rather than generating a large FFI surface. The app-specific schema, row types, subscriptions, and typed SQL/SYQL queries are generated from the shared schema IR using syncular generate. I’d love to hear how that feels compared with your flutter_rust_bridge setup.

More detail: https://syncular.dev/concepts-crdt/ https://syncular.dev/platform-flutter/

comment 3mo ago · link · parent

Thanks for pointing me there! Posted to their discord, but seems not so active.

comment 3mo ago · link · parent

Both use local SQLite and keep the backend authoritative. The main difference is that PowerSync mostly handles downstream replication and gives you an upload queue; your API still owns the write semantics. Syncular specifies the whole round trip. Durable commits, auth scopes, conflicts, replay, revocation and bootstrap. Syncular also goes further up the stack: schemas plus SQL/SYQL generate typed queries for TS, Swift, Kotlin, Dart and Rust, and blobs, CRDT/encrypted columns and windowed sync are built into the protocol.

In my separate benchmark harness, Syncular currently does considerably better than the tested PowerSync setup. For example, 100k bootstrap is ~0.57s vs ~6.5s and offline replay ~35ms vs ~5.1s. Those are early results from one environment, though, not a universal claim (https://github.com/bkniffler/offline-sync-bench).

I've used PowerSync in the past with a huge initial bootstrap sync and was very frustrated by the performance back then (ca 1 year ago), which was one of the reasons to create my own library.

PowerSync is much more mature today obviously and still a great and proven tool.

comment 3mo ago · link · parent

Nice! Would recommend to decouple as much as possible and have tons of testing, every issue thats catched before having to go to the length of debugging client side issues is gonna save some sleep. Have been there, learned the hard way..

Whats your app?

comment 3mo ago · link · parent

It’s great to see apps being shipped with offline first (and flawless syncing as an optional feature) from ground up, sad to see many modern notes apps like notion or capacities treating offline as afterthought. But alas, it’s still a non trivial nut to crack.

Hope one day offline first will be a default and a solved problem.

comment 3mo ago · link · parent

Hi HN! I’ve been circling this problem for a long time.

In 2019 I built an offline-first datastore called debe. It used CRDTs and multi-master replication and never became something I could confidently ship. It did teach me that convergence is only a small part of sync. The difficult parts are durable writes, authorization changes, lost acknowledgements, schema upgrades, bounded bootstrap, and explaining what happened after something fails.

I eventually came back to the problem and built Syncular over the last year.

Every client has a real SQLite database: sqlite-wasm on OPFS in the browser and native SQLite elsewhere. Writes apply locally and enter a durable outbox in the same transaction. A server-authoritative commit log validates and orders them, using explicit scopes resolved inside the application backend.

The protocol is written down independently of the implementations. SSP2 is currently a draft, with canonical binary encoding and golden byte vectors. There are independent TypeScript and Rust client cores, both run against the same 95-scenario conformance catalog. The Rust core is exposed through Swift, Kotlin, Flutter, React Native, Tauri, Rust, and a small C API.

It also includes realtime WebSocket sync, resumable bootstrap segments, explicit conflict evidence, authorization revocation and local purge, windowed replicas, blobs, optional CRDT columns, per-column encryption, and typesafe generated queries for five languages. Important boundaries: it is pre-1.0, self-hosted, and there is no managed service or peer-to-peer mode. Native packaging maturity still varies by ecosystem.

Let me know what you think, I'm happy about feedback!

Demo: https://demo.syncular.dev Protocol: https://github.com/syncular/syncular/blob/main/docs/SPEC.md Background: https://syncular.dev/blog/offline-first-writes/ Docs: https://syncular.dev/

11.

Show HN: Syncular – offline-first SQL sync with TypeScript and Rust cores(github.com ↗)

79 points · by quambo · 3mo ago · 29 comments

comment 7y ago · link · parent

I've just found a solution that works pretty nicely for me: Coda. It has an integrated SSH terminal, it has FTPS and uploads changes to files on save and it has support for many languages (don't know about rust though). It also saves your terminals and open files within each project so you can easily switch around.

Coda on iPad + Raspberry Pi (or an old Mac mini) make a pretty nice dev environment.

If you are more of a VIM guy, something like Terminus works well too.