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.
The packages are developed in the open-source repository
(github.com/voidhashcom/mimic-db, under packages/)
and are marked private there: they are not published to the public npm registry, so there is no
npm install command to copy from this page. Build them from the repository with pnpm install
and pnpm build. Each package's dist folder, with the entry points its publishConfig
declares, is what an application consumes.
Packages
| Package | Use it in | For |
|---|---|---|
@voidhash/mimic-core | Browser and backend | Defining document schemas; the document model |
@voidhash/mimic | Browser | Opening and editing documents over a WebSocket |
@voidhash/mimic-server | Backend, build tools | Reading 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 path | Contents |
|---|---|
@voidhash/mimic-core | Primitive (schema builders), values, commands, validation, schemaFingerprint, serializeSchema |
@voidhash/mimic/sync | The client: createSyncClientDocument, which opens a document at /v1/sessions |
@voidhash/mimic/zustand | The mimic zustand middleware and the useDraft hook |
@voidhash/mimic/zustand-commander | Commands with undo and redo for a zustand store, and their React hooks |
@voidhash/mimic/history | createHistory, a per-user undo history |
@voidhash/mimic-server/engine | The engine SDK: EngineSDK with promises, and EngineClient, its Effect core |
@voidhash/mimic-server/testing | createTestEngine, an in-memory stand-in for the HTTP API and sessions, for tests |
@voidhash/mimic-server/migrate | The migration framework: defineMigration, defineMigrationRegistry and their checks |
@voidhash/mimic-server/migrate/artifact | Building migration artifacts and running migrations in Node as the server does (Node only) |
@voidhash/mimic-contracts/core | Core values in their JSON form: coreValueToJson, for presence data and imports |
Requirements
@voidhash/mimichasreact(18 or 19) andzustand(5) as peer dependencies.@voidhash/mimic/syncand@voidhash/mimic/historyimport neither, so an application that does not use the bindings does not load them. The client needs a globalWebSocket, which browsers provide, or a socket you pass it (see Creating a client).@voidhash/mimic-serverhaseffect(4) as a peer dependency.EngineSDKhides it behind promises;EngineClientreturnsEffectvalues. Building migration artifacts usesesbuildand runs in Node.@voidhash/mimic-coreneedscrypto.randomUUIDandcrypto.getRandomValuesat runtime to generate ids, which browsers (in secure contexts) and Node provide.
The packages are ES modules and ship their own TypeScript types.
Next
- Quickstart: connect the packages to a server.
- Schemas: define your first document.