Skip to content
Strata is pre-1.0. APIs, protocol, and storage format may change.

Examples

The repository contains five examples. Three examples run in a browser. Two examples are headless packages.

ExampleTypeCommandPurpose
KanbanBrowserjust example kanbanTyped fields, local edits, merge, and reconnect
TodoBrowserjust example todoA small checklist document
WorkspaceBrowserjust example workspaceComponent hosting, composition, ownership, and typed bindings
IntakeHeadlessFocused test and build commandsA component that emits a typed request output
ProfileHeadlessFocused test and build commandsA fixed-record component with typed input and output ports

just example supports kanban, todo, and workspace. Each command builds static files, sets a separate data directory, and starts Strata on port 8000. Open http://localhost:8000.

The browser examples contain:

  • a doc_schema.gleam module for typed CRDT data;
  • a doc_view.gleam module for the Lustre surface;
  • a ws.gleam module that wraps strata_transport;
  • an application module that owns connection and document state;
  • unit tests for application logic.

The workspace example also contains src/strata_workspace/page.gleam and src/strata_workspace/composite.gleam. These modules show the PageStore(page) API and typed child references.

The Intake and Profile examples contain a component definition, a document schema, and unit tests. They do not contain a browser entry point or a build script for just example.

Terminal window
just example-test intake
(cd examples/intake && gleam build --warnings-as-errors)
just example-test profile
(cd examples/profile && gleam build --warnings-as-errors)

Run these commands from the repository root. The two headless examples only support focused test and build commands.

Install Node.js and npm. The repository does not pin a Node.js version.

Install the dependencies and the Playwright browser:

Terminal window
cd examples
npm ci
npx playwright install chromium

Run one browser suite with a script from examples/package.json:

Terminal window
npm run test:todo
npm run test:kanban
npm run test:workspace

Run all three browser suites:

Terminal window
npm run test:e2e

The examples use the development token and a fixed localhost URL. They use a fixed two-second reconnect delay. Some error branches keep the current state without a user message. Use the examples to learn the data flow. Add explicit error reporting, configurable endpoints, and reconnect backoff in an application that you deploy.

Workspace workflow bindings are session-local and best-effort. Closing, reloading, or crashing the browser loses routes and pending work. Disconnect can leave sent operations with unknown outcomes. Reconnect restores document state, not a durable workflow queue; see the workflow delivery boundary.