Examples
The repository contains five examples. Three examples run in a browser. Two examples are headless packages.
| Example | Type | Command | Purpose |
|---|---|---|---|
| Kanban | Browser | just example kanban | Typed fields, local edits, merge, and reconnect |
| Todo | Browser | just example todo | A small checklist document |
| Workspace | Browser | just example workspace | Component hosting, composition, ownership, and typed bindings |
| Intake | Headless | Focused test and build commands | A component that emits a typed request output |
| Profile | Headless | Focused test and build commands | A 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.
Source layout
Section titled “Source layout”The browser examples contain:
- a
doc_schema.gleammodule for typed CRDT data; - a
doc_view.gleammodule for the Lustre surface; - a
ws.gleammodule that wrapsstrata_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.
Test and build headless examples
Section titled “Test and build headless examples”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.
Set up browser tests
Section titled “Set up browser tests”Install Node.js and npm. The repository does not pin a Node.js version.
Install the dependencies and the Playwright browser:
cd examplesnpm cinpx playwright install chromiumRun one browser suite with a script from examples/package.json:
npm run test:todonpm run test:kanbannpm run test:workspaceRun all three browser suites:
npm run test:e2eExample limits
Section titled “Example limits”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.