Pre-beta, under heavy active development: the API changes often and nothing here is stable yet.

Spar

Coming from Foldkit

Both are built on Effect and both keep app state changes explicit and replayable. The differences:

FoldkitSpar
One Model for the whole app, described by a SchemaOne state tree: stores for app data and UiState for a component's own state are slots in it, each with its Schema
Messages and one updateStore actions with a reducer each; commands are store.commands.<name>(payload)
Commands returned from updateAn Effect on a service that sends commands, and Outbox.channel for what must be sent
view(model, h) re-runs and a virtual DOM is diffedA view runs once; reactive values update single nodes
h.div([...], [...])JSX
Subscriptions as a function of the ModelStreams in a withEffect enhancer, released on unmount
Submodels and OutMessagesComponents and props; a child's handlers are Effects the parent passes in
Routes from parser combinatorsRouter.route(path, Schema) values and Router.outlet
foldkit/story and foldkit/sceneStores tested as services; components tested with spar/testing by role
Crash viewView.crash per part, plus App.CrashReporter
DevTools overlay and MCP serverDevtools from the Vite plugin, an MCP server and a CLI (docs/devtools-compared.md)
Server rendering and hydrationServer.render and App.hydrate, the same components chosen by layers

Porting a screen

apps/sidebar is a port of a real Foldkit screen. What moved where:

  • Model fields that were only about the screen (menu, tagging, naming, the filter text) became UiState or form state inside the component that owns them. They are no longer saved or replayed.
  • Model fields that are real data (agents, projects, which sections are collapsed) became a saved store (layerSaved).
  • Each Message that changed data became a store action. Messages that only changed screen state became UiState.set in a handler.
  • The pure functions that turned data into sections moved over unchanged in spirit (src/domain.ts) and are tested the same way.
  • update tests became store tests; scene tests became spar/testing or browser scenarios.

What you give up: declaring the whole Model in one file. The app's state is still one value, one tree of slots, and the one log, time travel over stores and screen state together, forking and server rendering are all there. What you get: rows that update without re-running a view, local state without ceremony, and errors and services checked at the mount.