I'm cooking up a Rust port of Kotlin Multiplatform.
Making a little cashu wallet to start.
I'm cooking up a Rust port of Kotlin Multiplatform.
Making a little cashu wallet to start.
I'm copying a pattern used by Facebook Messenger where all UI state is stored in SQLite and the UI is a thin, pure function render:
- https://engineering.fb.com/data-infrastructure/messenger/
- https://www.droidcon.com/2019/10/25/the-light-way-2/
In the demo I can kill the app and re-open it in exactly the same place because the router state is stored in SQLite.
Yes, you heard that correctly. The router state is written to SQLite by Rust.

SwiftUI re-renders reactively based on changes in this view model, which just receives notifications of any relevant changes to the SQLite database 
This is how the database changes are propogated to Swift. sqlite-watcher listens for changes to database tables in Rust, and sends notifications to Swift via Updater::send_update 
Strict 1-directional data flow as God intended 
Beautifully simple
You write your UI in platform-native options like SwiftUI or Jetpack Compose. You could also write it in React Native or Flutter. But honestly I don't think they are worth it. When the UI is a pure function you can vibe-code it. Your application is written and tested in Rust.
The UI above was a Cursor one-shot based on this TLDraw diagram. Notice how it put the "choose mint" screen in the wrong place. History screen was also broken so commented it out.
Forget React Native and Flutter!
Why SQLite and not a rust native data store like redb ?
Because SQLite is so stable and well-supported. Should I look into redb? Does anything use it in production? Last time I looked it was only Casey Rodarmor using it lol.
For sure its not as battle tested as sqlite but Im playing around with it since its interesting tech. Rodarmor is looking at making a bdk wallet persister with it too.
Are you aware of Crux? It is a Rust based elm architecture framework, wat you are doing seems similar, so maybe that framework can save you some time.
I looked into it a few times in the past, but it always seemed way too complex and opinionated for me. And they never had any working apps. Have you tried it?
I did play with it but not enough to stand by it yet, whenever I tried it it didn't seem complex but still clunky, however they don't do anything I wouldn't do myself except with great effort so I can't judge them for not ironing out the interface yet, it is not an easy task.
So you like the effectless core? That never made sense to me.
For any kind of real application I would need to make sure they all had traits for any IO they do. Then I would need to implement these traits based on the "capabilies" they offer. But they don't support SQLite so I would need to implement that in Swift and Kotlin? Now I'm writing database codee in Swift and Kotlin -- exactly what I don't want to do. Why?
I would much rather just write a normal rust program.
Hmm seems like you might be able to implement the capabilities in rust. Man their docs really suck.
They are couple of people cut them some slack, but yes you can implement whatever you want, but when something seems like a core logic you want to both reuse across platforms and more importantly test with ease, then you move it to the core.
They both seem vDOM-like, with the real difference being bindings vs nested data? Which is an old UI debate. Bindings win for many "edge" cases and are more conducive to spot optimizations, but they can blow up if you cross the streams.
Processing the data into a UI state that is trivially 1:1 mapped to the UI makes a lot of sense and was very helpful at my past work. Just the sqlite thing is weird.