This repository contains two independent parts:
logic/— Rust smart-contract (compiled to WASM)app/— React frontend (Vite) that talks to the contract via generated ABI client
The folders are separate projects; treat each as its own repo.
- pnpm (or npm) for JavaScript tooling
- Rust toolchain + wasm target:
rustup target add wasm32-unknown-unknown - Optional:
wasm-optfor size optimization
pnpm run logic:buildOptional cleanup:
pnpm run logic:clean- Key-value operations:
set,get,remove,entries,len,clear - Utility:
get_result,get_unchecked - Demo helper:
create_random_entry()— insertskey-<n>withvalue-<n>and returns the key
Events emitted: Inserted, Updated, Removed, Cleared
- Built WASM outputs to
logic/res/<crate_name>.wasm(minified ifwasm-optis available) - ABI JSON is expected at
logic/res/abi.json
cd app && pnpm installBuild and run:
pnpm --dir app build
pnpm --dir app devOpen the app in your browser and connect to a running node.
Docs: https://calimero-network.github.io/build/quickstart
The root app:dev script runs the web app alongside a unified watcher for logic/res/.
pnpm run app:devWhat happens:
logic:watch: watcheslogic/res/**/*- On
abi.jsonchange → runs codegen:app:generate-client - On
*.wasmchange → copies the changed file to data nodes vialogic:sync
- On
Key scripts (root package.json):
logic:watch:chokidar "logic/res/**/*" -c "node scripts/on-res-change.mjs {path}"logic:sync:bash ./scripts/sync-wasm.sh <path>— copies todata/calimero-node-1/anddata/calimero-node-2/app:generate-client:npx @calimero-network/abi-codegen@0.1.1 -i logic/res/abi.json -o app/src/apiapp:dev:concurrentlyruns the Vite dev server andlogic:watch
Notes:
- The watcher only triggers when
logic/res/changes. Make sure your build writes there. sync-wasm.shcopies by filename (basename) so any wasm produced inres/is propagated.
Client types and a thin client are generated into app/src/api from logic/res/abi.json.
- Ad-hoc run:
pnpm run app:generate-client- This is also run automatically by the watcher on
abi.jsonchanges.
You can bootstrap a local network with Merobox:
pnpm run network:bootstrapThis runs the workflow defined in workflows/workflow-example.yml and starts local Calimero nodes whose data dirs live under data/.
- Start dev (web + watchers):
pnpm run app:dev- Edit Rust contract under
logic/srcand build:
pnpm run logic:buildWhen the wasm in logic/res/ updates, the watcher copies it to data/calimero-node-1/ and data/calimero-node-2/ automatically.
- If you change public methods or events, update ABI and regenerate client:
# If you produce a new ABI at logic/res/abi.json
pnpm run app:generate-clientThe watcher also regenerates automatically on abi.json changes.
- If
concurrentlyorchokidarare missing, install dev deps at repo root:
pnpm add -D concurrently chokidar-cli- If ABI codegen fails due to missing schema, ensure you’re on
@calimero-network/abi-codegen@0.1.1(the script pins this version).