The Crux Counter example is a simple multi-platform application that calls a cloud-hosted API.
It makes HTTP requests to a shared global counter hosted at https://crux-counter.fly.dev, incrementing or decrementing the counter value.
The server also has an endpoint for Server Sent Events (https://crux-counter.fly.dev/sse), which signals when changes are made to the global counter value — so that when you update the counter in one client, all the other clients will update too.
We have included an example of a Server Sent Events capability, which uses the core's ability to stream responses from the shell.
-
Please make sure you have the following rust targets installed (there is a
rust-toolchain.toml
in the root directory of this repo, so you should be able to typerustup target list --installed
, in or below the root directory, and these targets will be installed if they are not already present).aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim aarch64-linux-android wasm32-unknown-unknown x86_64-apple-ios
-
This example currently depends on the
pnpm
package manager when generating types for TypeScript. We are currently revisiting the type generation for foreign types and so this requirement will probably go, but for now, please installpnpm
.
-
Make sure the core builds
cargo build --package shared
-
Generate the shared types for your client applications
cargo build --package shared_types
To build and run the Tauri app:
cd tauri
pnpm install
pnpm tauri dev