Contexts & Applications
An application is a WASM bundle on a node; a context is a running instance
of its shared state. This guide walks the lifecycle install → create context →
join, all on mero.admin. Every method is async throws. The full surface is in
the admin API reference.
The lifecycle
Section titled “The lifecycle”Install an application
Section titled “Install an application”From a hosted bundle URL:
let installed = try await mero.admin.installApplication( InstallApplicationRequest(url: "https://example.com/app.wasm", hash: nil, metadata: []))let applicationId = installed.applicationIdFrom a registry package — MeroKit resolves the manifest, derives the bundle artifact URL, and installs it:
let versions = try await mero.admin.getRegistryVersions( registryUrl: registryURL, packageName: "my-package") // newest first
let app = try await mero.admin.installFromRegistry( registryUrl: registryURL, packageName: "my-package", version: versions[0])During development, install from a path with installDevApplication(_:).
Inspect and manage:
let apps = try await mero.admin.listApplications().appslet app = try await mero.admin.getApplication(applicationId)_ = try await mero.admin.uninstallApplication(applicationId)Create a context
Section titled “Create a context”let created = try await mero.admin.createContext( CreateContextRequest(applicationId: applicationId, groupId: groupId))let contextId = created.contextIdlet memberKey = created.memberPublicKeyFor a multi-service application, name the service:
let ctx = try await mero.admin.createContext( CreateContextRequest(applicationId: applicationId, groupId: groupId, serviceName: "chat"))List and inspect:
let contexts = try await mero.admin.getContexts().contexts // [ContextWithGroup]let one = try await mero.admin.getContext(contextId) // Contextlet forApp = try await mero.admin.getContextsForApplication(applicationId)let storage = try await mero.admin.getContextStorage(contextId).sizeInBytesIdentities & joining
Section titled “Identities & joining”A context identity is your keypair within a context. Generate one, then join:
let identity = try await mero.admin.generateContextIdentity() // .publicKey_ = try await mero.admin.joinContext(contextId)
let all = try await mero.admin.getContextIdentities(contextId).identitieslet mine = try await mero.admin.getContextIdentitiesOwned(contextId).identitiesKeeping state in sync
Section titled “Keeping state in sync”try await mero.admin.syncContext(contextId) // request a synclet r = try await mero.admin.resyncContext(contextId, request: ResyncContextRequest(force: true))- Executing methods — run WASM methods in a context.
- Groups & governance — namespaces, members, capabilities.