Installation

The TypeScript packages, their entry points, and what each one needs at runtime.

An application uses up to three TypeScript packages. This page lists them, their entry points and their requirements.

Packages

PackageUse it inFor
@voidhash/mimic-coreBrowser and backendDefining document schemas; the document model
@voidhash/mimicBrowserOpening and editing documents over a WebSocket
@voidhash/mimic-serverBackend, build toolsReading and writing documents, minting document tokens, migrations

@voidhash/mimic and @voidhash/mimic-server both depend on @voidhash/mimic-core, and on @voidhash/mimic-contracts (the wire contracts they share), which they install themselves; add @voidhash/mimic-contracts as a dependency of your own only to import from it (/core), since a package manager such as pnpm does not let you import a dependency's dependency. Define your schemas in a module that both your frontend and your backend import, so both sides use the same schema.

Entry points

Import from these paths only.

Import pathContents
@voidhash/mimic-corePrimitive (schema builders), values, commands, validation, schemaFingerprint, serializeSchema
@voidhash/mimic/syncThe client: createSyncClientDocument, which opens a document at /v1/sessions
@voidhash/mimic/zustandThe mimic zustand middleware and the useDraft hook
@voidhash/mimic/zustand-commanderCommands with undo and redo for a zustand store, and their React hooks
@voidhash/mimic/historycreateHistory, a per-user undo history
@voidhash/mimic-server/engineThe engine SDK: EngineSDK with promises, and EngineClient, its Effect core
@voidhash/mimic-server/testingcreateTestEngine, an in-memory stand-in for the HTTP API and sessions, for tests
@voidhash/mimic-server/migrateThe migration framework: defineMigration, defineMigrationRegistry and their checks
@voidhash/mimic-server/migrate/artifactBuilding migration artifacts and running migrations in Node as the server does (Node only)
@voidhash/mimic-contracts/coreCore values in their JSON form: coreValueToJson, for presence data and imports

Requirements

  • @voidhash/mimic has react (18 or 19) and zustand (5) as peer dependencies. @voidhash/mimic/sync and @voidhash/mimic/history import neither, so an application that does not use the bindings does not load them. The client needs a global WebSocket, which browsers provide, or a socket you pass it (see Creating a client).
  • @voidhash/mimic-server has effect (4) as a peer dependency. EngineSDK hides it behind promises; EngineClient returns Effect values. Building migration artifacts uses esbuild and runs in Node.
  • @voidhash/mimic-core needs crypto.randomUUID and crypto.getRandomValues at runtime to generate ids, which browsers (in secure contexts) and Node provide.

The packages are ES modules and ship their own TypeScript types.

Next