Cookbook

Sample app: Fieldbook

A small but real app on one Rust core: field notes with photos, on the web, iOS and Android.

What it is#

Fieldbook is a small but real app: field notes with photos, for a team that works where there is no signal. One Rust core, three apps (web, iOS, Android) that use only the public API, and a test suite that runs the core with no device. The cookbook's recipes, in one product.

What it demonstrates#

FeatureIn the core
Sign-in with a team code, tokens in the secure store, one re-auth on a 401auth.rs
A note is on the device before the screen shows it, and is sent when there is a network, even after a killnotes.rs: Kv, an idempotent push_note
Search, tag chips, pinned first, newest firsta keyed list, a DerivedList and a Computed
Photos kept in the app's files and uploaded in the backgroundFs and the queue
An update that renames a field and adds three, without losing data#[undra(default)], #[undra::migrate]
Who else is in the notebookpresence.rs: a reconnecting WebSocket (feature presence)
State kept across a rebuild under undra devevery store has a restore function, tested

Run it#

Show the commands
shell
cd examples/fieldbook/web && npm install && npm run dev   # the web app, with an in-page demo server (team code: fieldbook)
node examples/fieldbook/server/server.mjs                    # a backend for the iOS and Android apps
cargo test -p fieldbook-core                                  # the core, against the fakes
cd examples/fieldbook/web && npm test                          # the bindings over the real wasm core

Tick offline in the web app, write two notes, reload, untick it: the notes were on the device the whole time, and the core sends them when the network returns.

How far it goes#

Source: examples/fieldbook, with a README that says how to run each platform. The cookbook has the recipes it is made of.

Edit this page on GitHub