Skip to content

Interactive MistDemo: web (MistKit vs CloudKit JS) + native app (pure CloudKit framework) #330

Description

@leogdion

Vision

Transform MistDemo from a CLI-driven example into an interactive demonstration with two distinct stories:

  1. Web demo — a single HTML UI with a top-level mode toggle that runs the same CRUD operations through either MistKit (Swift on Hummingbird) or CloudKit JS (in the browser). Same auth, same container, same operations — only the SDK shape differs. This is the value-prop demonstration: MistKit is the Swift equivalent of CloudKit JS, suitable for server/Linux/WASI/Windows contexts where CloudKit JS would otherwise be your only option.

  2. Native app — pure CKContainer / CKDatabase via the CloudKit framework, no MistKit. The honest pitch for Apple platforms: use the right tool. MistKit is unnecessary here.

Plan

Six issues, intended to be tackled in order. Refactor-first sequencing because the existing auth-token scaffolding will buckle under new routes/UI otherwise.

Phase 1 — Foundation refactors

Phase 2 — Web CRUD + comparison

Phase 3 — Database selection

  • Add public database interface to MistDemoApp and web #275 — public/private database picker in the web demo. Mode + DB combine into four auth profiles:
    • MistKit + private → API token + web-auth token
    • MistKit + public → key-pair signing (server-to-server)
    • CloudKit JS + private → API token + web-auth token (shared with MistKit)
    • CloudKit JS + public → API token only

Phase 4 — Native app rework

Auth model

The ckWebAuthToken is an opaque session credential tied to (Apple ID, API token, container). It works identically whether the request comes from CloudKit JS in the browser or from MistKit on the server. The demo issues one token via the existing auth-token flow (#287) and shares it across both modes — same credential, same backend, only the SDK changes.

The single place modes diverge is the public database on the server: MistKit can sign with the key pair (CLOUDKIT_KEY_ID + private key) while CloudKit JS in the browser cannot. The UI will surface this asymmetry as a teaching point rather than try to hide it.

Non-goals

  • Subscriptions, push notifications, WebSocket fan-out. "Realtime" in this plan means interactive/live UI vs CLI, not push-driven. Subscriptions are a possible follow-up phase once the comparison story is in place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions