Example apps
The apps/
directory of core is the ground truth for writing an app: every example is a
real calimero-sdk crate, built into a wasm32-wasip2 component by
calimero-app-build and tested on TestApp and its scenarios/*.json
(Testing). Each is a standalone crate, so it builds and
tests on its own:
cargo test --manifest-path apps/kv-store/Cargo.tomlEach follows the same shape (SDK macros): one
#[app::state] struct of tables and collections,
an #[app::logic] impl with an #[app::init], calls and views, and optionally
#[app::error] and #[app::event] enums. Read the state struct first: it says
which reads and writes are cheap.
Start here
Section titled “Start here”| App | Shows |
|---|---|
kv-store |
The basic example: a string key-value store on an UnorderedMap, events, views. |
kv-store-init |
An init that seeds entries. |
sorted-kv-store |
Ordered reads on a map: range, prefix, page, first, last. |
sorted-set-store |
The same on a Set. |
custom-key-store |
A newtype slug as a map key (ToKey / FromKey). |
team-metrics |
Per-team Counters and a badge bitmask. |
Tables
Section titled “Tables”| App | Shows |
|---|---|
indexed-issue-tracker |
List views that are index seeks: #[table(index(..), count(..))], find, count. |
indexed-forum |
Threads and posts on tables with indexes and counts. |
rooms |
The reference app: bookings with a unique slot, timers, confirm, public methods. |
Access control
Section titled “Access control”| App | Shows |
|---|---|
org-gated |
Members read, admins write, a team writes its own note (guards, env::in_team). |
permissions-showcase |
One write rule per record kind: write-once, moderated, author-keyed, content-addressed. |
kv-store-with-user-and-frozen-storage |
PerUser values and content-addressed Frozen values. |
kv-store-with-shared-storage |
A key-value store guarded by writer sets. |
authored-sorted-kv-store |
A noticeboard with per-note authors and topic slices. |
name-registry-admin |
Usernames: one owner per name, decided by the admins. |
components-demo |
An owned cell, a writer set and a role registry. |
See Access control for the patterns.
Fixtures
Section titled “Fixtures”apps/v2-fixtures/ holds the small apps the node’s own tests run (kv,
org-gated, files, captcha). kv is also the kv-store-test-fixture.mpk
attached to core’s releases, which the clients’ tests install.