Skip to content

Packaging & signing your app

Once your app compiles, it still has to become something a node can install. That deliverable is an .mpk bundle: a single archive carrying your calimero:app component, a manifest.json, and an Ed25519 signature. This page walks the builder workflow that produces one.

Every step is a meroctl app subcommand: build compiles the components, signer makes the signing key, pack writes the manifest, signs it and packs the archive, and inspect checks the result as a node would. The node side — how a bundle is parsed, verified, and trusted on install — lives in Upgrades & migration; this page does not duplicate that detail.

from a Rust crate to a running app1 · Rust cratecdylib + calimero-sdk#[app::state] struct#[app::logic] impl#[app::event] / errorcargo test: TestAppon the real engine2 · componentmeroctl app buildcargo build --release wasm32-wasip2lift calimero:abi→ app.wasm(+ compute.wasm)3 · signed .mpkmeroctl app packmanifest.json: package, appVersion, sha256 of app.wasmsigned: JCS+Ed25519→ pkg-1.0.0.mpk4 · on the clusterinstall the package: signature, digest imports ⊆ world prepare (wasmtime)create an app: init as the owner, in an organizationdevelopment cluster only: meroctl context create --path app.wasmevery call, at run timeclient → any node → app's leader: handle(kind, method, args) on the componentOk → writes + events become one entry in the app's Raft log; followers apply the diff, never re-runErr or trap → nothing written, no events; a view reads state and writes nothing
  1. Build the component.

    meroctl app build compiles your crate for wasm32-wasip2 and turns it into a calimero:app component, with the ABI the SDK’s macros embed (its calimero:abi section). meroctl comes with each release, beside merod (Install).

    Terminal window
    meroctl app build apps/my-app --out my-app.wasm

    A WASM core module (an SDK 0.12 app) is refused by the node (400 UNSUPPORTED_BUNDLE).

  2. Generate a signing key (one-time).

    meroctl app signer new creates an Ed25519 keypair and derives your signer id — a did:key identifier built from the public key (the 0xed01 ed25519-pub multicodec tag plus the 32-byte key, base58btc-encoded under the did:key: prefix).

    Terminal window
    meroctl app signer new my-signing-key.json
    # Generated new keypair: my-signing-key.json
    # signerId: did:key:z6Mkrb81NKkv7Mw4dZAWA5PTuwBhbq9u9eCPuby3icBUdirg

    The key file is JSON with base64url-encoded private_key and public_key plus the derived signer_id (meroctl app signer id <file> prints it again). signer new will not overwrite an existing file unless you pass --force, which loses the old key for good. Keep it secret and out of version control — it is your update authority (see below).

  3. Write and sign the manifest, and create the .mpk.

    meroctl app pack writes manifest.json (version, package, appVersion, minRuntimeVersion and the app.wasm artifact with its SHA-256 and size), signs it, and packs manifest.json and app.wasm into a gzip-compressed tar. Signing derives the signerId from the key, refuses to sign if minRuntimeVersion is absent (a signer must not rewrite the document it signs), canonicalizes the manifest with RFC 8785 (JCS), signs the domain-tagged SHA-256 of those canonical bytes, and writes a signature object back into the manifest.

    Terminal window
    meroctl app pack --wasm my-app.wasm --package com.example.my-app \
    --app-version 1.0.0 --key my-signing-key.json --out dist/com.example.my-app-1.0.0.mpk
    # omit --key to sign with the development key
    meroctl app inspect dist/com.example.my-app-1.0.0.mpk # verify it as a node does

    Given the crate’s directory instead, meroctl app pack apps/my-app --key my-signing-key.json reads package, min-runtime-version and frontend-dir from the crate’s [package.metadata.calimero] and the release from its version, builds the components when --wasm and --compute are not given, and writes apps/my-app/dist/<package>-<version>.mpk. The same table gives the display metadata (name, description, author, icon, tags, license, category, guide), handlers.slug, links (frontend, github, docs) and frontendAliases, and the crate’s calimero-sdk git dependency gives buildInfo (sdkSource, sdkVersion: the SDK it was built with).

    --min-runtime-version (default 0.1.0) is the oldest merod release the app needs; a cluster with an older replica refuses the upgrade (409 RUNTIME_TOO_OLD). For every release after the first, pass --previous <last .mpk>: pack then compares the two ABIs, warns about changes that break callers, and refuses a state change made without a state version bump (App interface).

    The other fields a release may carry:

    Flag Manifest field
    --frontend <dir>, --frontend-entry <file> frontend the app’s static web build, served by the node (Ship a frontend)
    --outbound <https prefix> (repeatable) outbound URL prefixes a run may send requests under (Call an external service)
    --upgrades owner|publisher upgrades who upgrades the package’s instances; absent means owner
    --guests allowed|forbidden guests whether an instance’s listed accounts reach it without joining its organization; absent means forbidden (Guests)
    --instance-org standalone|org|either instanceOrg which organization an instance is created in: one made with it, one its creator is in, or either; absent means either (Where an instance goes)

    pack checks each against the node’s own rules before signing.

    lineage, from [package.metadata.calimero] only, pins the release’s instances: with lineage = "pinned", an instance created from it moves only to later releases of the same package, signed by the same key, whoever upgrades it, the operator included (Pinned instances). Absent means free. A pinning release names a semver version, and a node installs one only from cluster version 1.0.0-rc.39. A release signed with the development key pins its instances to a key everyone holds; only a node that takes development releases (--allow-unsigned-bundles) installs one, so such a pin is for local testing only.

    One more comes only from the crate’s [package.metadata.calimero]:

    • uses: the other apps the release calls, by the name its code knows each by. Each names the package, the semver range it works with, and mode: create (the default) is created with the app and upgraded with it, attach is an app the deployer already runs. A calimero.lock beside Cargo.toml pins each to a release inside its range and to that release’s ABI digest; pack writes both into the manifest and checks the vendored ABI (calimero/abi/<name>.json) against the digest. Without a lock the references are packed unpinned, with a note.

      [package.metadata.calimero.uses]
      kv = { package = "com.calimero.confidential-kv", range = "^0.1", mode = "create" }
      calendar = { package = "com.example.calendar", range = "^2", mode = "attach", methods = ["listEvents", "createEvent"] }

      methods lists what the release calls on that app as the person its run serves, once that person grants it (As the person); without it the release calls the app as itself. pack checks each against the vendored ABI.

      A node refuses a release whose references break the rules (400 BAD_USES: names a-z0-9_, at most 16, not its own package, a semver range, a locked version inside it, an ABI digest sha256:<hex>, at most 64 distinct method names, none of the node’s own __). It lists them on the release’s capability card, and an upgrade’s consent page names the apps the new release starts using or uses differently.

      Creating an instance of a release with create references first creates each of them: in the same organization, by the same owner, from the release its lock pinned (else the newest installed one inside its range), among the installed releases the creator may use, those signed by the same key as the instance’s own package, and, for an instance from a deployment, those the same deployment offers; a package with none answers 409 USES_NOT_INSTALLED, as for a package that is not installed at all, named <instance>.<name>. The instance’s record names them (links), the create answers them, and an init that takes a links parameter is told their ids:

      #[app::init]
      pub fn init(links: Option<BTreeMap<String, String>>) -> app::Result<Self> { .. }

      links in initArgs is the node’s; a client that sends it is refused. attach references are never created.

      The instance and its members are one unit. An instance created from a deployment’s offer gives each member the same deployment, which need not offer the member’s release when the same key signed it (the instance’s offer covers the unit): every member’s usage is billed to the deployment’s developer, and the deployment’s secret values fill what the member’s own release declares, as they do the instance’s. Deleting the instance deletes every member with it, down to the members’ own members (DELETE /apps/{app} answers them in members), and a member is not deleted alone while its instance stands (409 UNIT_MEMBER). Both wait for every node to run 1.0.0-rc.32 (409 FEATURE_NOT_ACTIVE).

      uses: an app made with the instance, or one the owner already runsmode = "create": a unitkv = { package = "…confidential-kv", mode = "create" }instance "Support"links: { kv }env::linked("kv")member "Support.kv"created firstenv::unit_of() = Supportmade with it· named <instance name>.<reference>· same org, same owner· the instance's deployment (billed to it)· its release: locked, else newest in rangelives and goes with it· upgraded together: POST …/upgrade-unit (alone only in range: OUTSIDE_UNIT_RANGE)· DELETE the instance deletes every member· a member alone: 409 UNIT_MEMBER· KV, inference: admin app:<unit_of>a unit gains members only when it is createdmode = "attach": a linkcalendar = { package = "…calendar", mode = "attach" }instance "Booking"attached: { calendar }env::linked("calendar")"Team calendar"already running,its owner's ownlinked by the owner· starts empty: never created· PUT /apps/{app}/links/{name} { app } + passkey; who manages both apps· same org, the reference's packagelives on its own· never upgraded with the instance; out of range: inRange false, a warning· never deleted with the instance· deleting it detaches it; DELETE …/links· keeps its own owner and deploymentthe owner may attach another app later, or none

      The two modes side by side: a create member is part of its instance’s unit, an attach link points at an app that stays its owner’s own.

      The owner attaches an app they already run to an attach reference with PUT /apps/{app}/links/{name} { app } (whoever manages both apps, in one organization, with a passkey; DELETE detaches it). The app must run the reference’s package (409 WRONG_PACKAGE); one outside the range is attached anyway, answered inRange: false, and an upgrade’s consent page warns when the new release takes an attached app in another range: an attached app lives on its own and is never upgraded with the instance. Deleting the attached app detaches it. GET /apps/{app}/links lists every reference of the release the app runs with the app linked under it, the release that app runs and inRange. The app’s code reads a link at any time, not only in init:

      let kv = env::linked("kv").ok_or_else(|| Error::NoKv.into())?;

      A member names the instance that created it with env::unit_of() (None for an app created on its own): Confidential KV and Private Inference releases take app:<env::unit_of()> as their admin, so the instance uses them with no grant step.

      A unit upgrades in one consent: an app’s frontend asks the node’s consent page with upgradeUnit { app, toVersion } (every app’s sheet on one page), or a client calls POST /apps/{app}/upgrade-unit { version } (meroctl and the clients: upgrade_unit) moves the instance to version and each member to the release the new one pins for it (else the newest installed one in range), with one passkey assertion over the instance, its version and every member’s target. It answers an upgrade run, followed with GET /orgs/{org}/upgrades/{run}. A member is not moved on its own off the range its instance takes it with (409 OUTSIDE_UNIT_RANGE), and a new release that creates a member the instance does not have is refused: a unit gains members only when it is created.

    A package of several services (each app instance runs one of them, named by meroctl instance create --service NAME) gives each with --service NAME=PATH, where PATH is the service’s crate directory (built) or its component; the manifest then declares services instead of wasm:

    Terminal window
    meroctl app pack --service directory=crates/directory --service room=crates/room \
    --package com.example.rooms --app-version 1.0.0 --key my-signing-key.json

    Or list them in the crate’s table, paths relative to it, and meroctl app pack DIR packs them with no flags (--service replaces the list). A workspace root with no [package] of its own is read from [workspace.metadata.calimero], its release from [workspace.package] version, and its services build into one target directory:

    [workspace.metadata.calimero]
    package = "com.example.rooms"
    services = [
    { name = "directory", path = "crates/directory" },
    { name = "room", path = "crates/room" },
    ]

    Each service is packed as services/<name>.wasm, with its compute component (built from its crate, or --service-compute NAME=FILE beside a component) as services/<name>.compute.wasm and its pipelines (--service-pipeline NAME=FILE) under services/<name>/pipelines/. A name is 1 to 64 letters, digits, - or _. --wasm, --compute and --pipeline pack one service and are refused beside services.

    An app with compute methods also builds a compute component (meroctl app build <crate> --out app.wasm --compute-out compute.wasm). Pass it with --compute compute.wasm: the manifest then declares it as compute, and the .mpk carries it as compute.wasm. Without it a release cannot run compute, and neither can a raw .wasm upload. --compute without --wasm packs a package with only a compute component.

    A release may also ship pipelines over its compute methods: --pipeline daily.yaml (repeatable) packs each file as pipelines/<name>, and the manifest lists it under pipelines (at most 16 per package, each at most 64 KiB), signed with the rest. The node compiles each file at install and checks it against the package’s own compute methods and the cluster’s pools: the module is self (or left out) or another installed package by its exact name, optionally pinned (module: com.acme.pdf@0.1.0; without a version, the newest release the installer may pin). That package must ship a compute component; its methods and caps are the ones the step is checked against. A module is pinned only from a release the installer may use that is public or the operator’s, signed by the package’s own signer, or, for a release installed private, private to every organization the release is for; anything else, or a module with no compute component, is UNKNOWN_MODULE. An install of the same release again (for another organization, or public) keeps its pins and is refused the same way when a pin no longer meets that rule, so it never widens who runs a private module. The release keeps running the module release it was installed against until the pipeline’s own package is released again. The module’s package cannot be uninstalled while such a release exists (409 MODULE_IN_USE). The step’s files, payer and usage stay the calling app’s. Every method must be one its module declares, and each step’s limits may only lower the method’s caps. A problem is 400 BAD_PIPELINE with details, a list of {file, path, code, message} for every error. A release with pipelines installs only once every node runs this release (409 CLUSTER_NOT_UPGRADED). meroctl package pipelines PACKAGE prints what a version registered.

    A release may ship only pipelines: meroctl app pack --pipeline daily.yaml with no --wasm, --compute or DIR. It has no self module, so every step names a module (MISSING_MODULE otherwise), and its apps only run those pipelines.

    A release may also ship recipes: pipeline files kept for others to start from. --recipe daily.yaml (repeatable) packs each file as recipes/<name>.yaml, and the manifest lists it under recipes (at most 32 per package, each at most 64 KiB), signed and digest-checked like every artifact. The node never compiles or resolves a recipe at install, so one may name modules that are not installed; a recipe that is not UTF-8 text, or whose bytes differ from the signed hash, refuses the release. GET /packages/{package}/{version}/recipes answers each recipe’s hash and source by name, from a listing the node keeps at install. A node before recipes verifies the manifest (the signature covers recipes) and ignores the field.

  4. Install it.

    A real cluster installs releases from its operator’s registry (POST /packages/install { package, version }); publish the .mpk there with meroctl app publish dist/com.example.my-app-1.0.0.mpk: it pushes to the app registry (--registry) with the registry’s API key (--api-key or CALIMERO_REGISTRY_API_KEY), or with --org ORG as a Calimero Cloud organization, whose API key it trades for a publish token. A new package is private unless --public lists it. A public registry refuses a dev-signed bundle. A development cluster (merod --dev, and merod local, which meroctl local up starts) also takes an upload:

    Terminal window
    meroctl package install --path dist/com.example.my-app-1.0.0.mpk
    meroctl instance create --name my-app --package com.example.my-app --alias my-app

    Before it logs the install, the node checks the publisher’s signature and every artifact’s digest, minRuntimeVersion, the package’s pinned signer (the first release’s), and that each component prepares and imports only what the calimero:app world offers. Installing is what produces an installed package: the manifest’s package and signerId fix its identity. A WASM that a release of another signer’s package already ships is refused (409).

A connector is a crate an app compiles in to reach one external service, such as calimero-connector-nearai for NEAR AI Cloud. It declares the prefixes it sends under and the credentials it needs in its own Cargo.toml, in the shape an app’s outbound and secrets take (Outbound requests):

[package.metadata.calimero.connector]
outbound = ["https://cloud-api.near.ai/v1/chat/completions"]
[package.metadata.calimero.connector.secrets.NEAR_AI_API_KEY]
host = "cloud-api.near.ai"
paths = ["/v1/chat/completions"]
header = "authorization"
format = "Bearer {}"
description = "NEAR AI Cloud API key"
required = true
stream = { text = "/choices/0/delta/content" }

An app that depends on it opts in by name:

[package.metadata.calimero]
connectors = ["calimero-connector-nearai"]

meroctl app pack DIR finds each listed name among the crate’s normal dependencies for wasm32-wasip2 (cargo metadata) and adds its outbound prefixes and secrets to the app’s own, printing each one it adds and the crate it came from. The signed manifest carries them as if the app had written them, so a node and the consent page see an ordinary release. pack refuses a listed name that is not such a dependency, a dependency with no connector table, and a secret two declarations (the app and a connector, or two connectors) bind differently; the same binding twice is kept once. A dependency the app does not list adds nothing, whatever it declares. The merged secrets are then checked as the app’s own are. How to use one from an action, and how to write one, is in Connectors.

meroctl app check says what the people running your app will see when this release replaces the last one, with the same classifier the node uses for the upgrade sheet (calimero_bundle::update):

Terminal window
meroctl app check --mpk release.mpk --against last.mpk
com.acme.notes 1.3.0 → 1.4.0
Data can go to: https://inference.near.ai/v1/
Users on automatic updates: wait for an owner's or admin's approval (green, but the app or the apps it created can send data out; only an update whose unit sends nothing out applies on its own)
New methods: pin, unpin · removed: none · state version unchanged (1)
Egress added: none · removed: none
Signer: did:key:z6Mk… (unchanged)

The first line after the versions lists every destination outside Calimero the release and the apps it creates may send data to, or says Data: stays in Calimero when there is none. Any destination outside Calimero is just a destination: the platform never vouches for an external endpoint, a TEE included. If your app trusts one (a private-inference service, say), verify its attestation in your own code; it is still listed.

The next line says what an organization that lets updates apply on their own (autoApply: noDestinations, Updates that apply on their own) would see: only a green release of an app whose unit sends nothing out, before or after, that removes no method and moves none of the apps the release creates, applies on its own, after the hold. A green release that can send data out, removes a method or moves the apps the release creates still waits for an owner’s or admin’s approval: an update on its own moves the app alone, so an owner or admin moves the unit whole.

A release is red, and waits for a person’s approval, when it is signed by another key, can send data somewhere new, declares another state version, creates or drops an app that has egress, or newly calls another app’s methods as the person; each reason is listed. --against VERSION reads the installed release from a node instead of a file, and the apps a release creates with uses come from --uses-mpk FILE (or that node).

In a release workflow, run it before app publish (and before app release) as a gate, so a destination never appears by accident: --fail-on egress fails when egress grows, --fail-on red on any red reason, and --allow-egress PREFIX is the pull request saying a new destination is meant. It exits 0 when the gate passes, 1 when it fails, and 2 when it cannot judge.

- name: What users will see
run: |
meroctl app check --mpk dist/release.mpk --against dist/last.mpk \
--fail-on egress # add "--allow-egress https://api.acme.com/" when the PR allows a new destination

For a bundle, the package’s identity is its package and its signerId together — not the bytecode. That makes the identity version-stable: a new release signed by the same key under the same package keeps the same identity and is recognized as an upgrade of the existing app.

The corollary is the rule to remember: a new signed version must use the same signer key. Sign a new release with a different key and the node sees a different identity — it is a different package, not an upgrade, and existing instances will not pick it up. Treat the signing key as the long-lived identity of your app and guard it accordingly.