Documentation navigation

Concepts

Core concepts

Understand Foldkit's typed update architecture, effects, view builder, and browser lifecycle.

Foldkit structures UI as data and explicit transitions. The Model is application state; a Message names an event; update computes a new Model and optional effects; view projects that Model into a declarative tree. Browser work is isolated into Commands, Subscriptions, and Mount actions rather than hidden inside rendering.

type Model = { readonly count: number }
type Message = { readonly _tag: 'Increment' } | { readonly _tag: 'Decrement' }
const update = (model: Model, message: Message): Model =>
  message._tag === 'Increment'
    ? { count: model.count + 1 }
    : { count: model.count - 1 }

The example is a pure transition; a running application also supplies a view and runtime configuration. Explore Model–Message–Update–View, Effect and Schema, Commands, Subscriptions, and Mounts, Submodels and Folds, HTML Builder and Events, Routing and Ports, Testing, and SSR and hydration. SSR/hydration is experimental in this release.