An application starts clean, then its state splinters. A fetch hook caches server rows, a URL store holds the active filter, a sync layer grows its own reducer, and an agent handler re-implements transitions. Soon those copies disagree.
Foldkit keeps UI state in one state machine: one typed Model (your application state), a Message union (everything that can happen), and one pure update function that produces the next Model. Foldkit Plus extends that state machine to the rest of your app without adding a second store. Server data reconciles into the Model, offline edits replay through update, the URL mirrors Model fields, and agents only send Messages your application already handles.
See the packages running at foldkit-plus.pages.dev. Server-backed demos run their server inside your browser, shared across tabs, so nothing leaves your machine:
- A blog studio and its site (
examples/cms): Drafts beside the row, revisions, scheduled publishing and a page builder, with the public site rendered at build time. - Two devices, one registry (
examples/registry): Two devices edit 10,000 products in a data grid, offline and in conflict, and agree once both are back. - Pages two tabs edit at once (
examples/pages): Rich text two people edit at the same time, online or not, converging through one journal. - A rich text playground (
examples/richtext-playground): One document with movable blocks, anchored discussions, images, tables, code, toggles and footnotes, every edit a transition of the Model. - A todo list an agent can use (
examples/todo-app): One application definition drives the view, the tools an agent calls, the document replicas share, and the policy the server enforces. - A Twitter clone, Chirp (
examples/chirp): Posts declared once as Entities, guarded on the server, served through Remote, posted and edited through forms built from the same input, and liked in one round trip. - A data grid over 100,000 rows (
examples/data-grid): A grid that owns focus, selection, columns and the open editor, while the application owns every row. - Eight widgets from shared primitives (
examples/widgets): Once the capabilities exist, a family of widgets gets cheap: each one is a Bundle placement plus Behaviors on a shared Collection description, with no bespoke state machine.
| What you want to do | Package | Guide |
|---|---|---|
| Keep filters or drafts in the URL or storage | foldkit-mirror |
Mirrored state |
| Cache server data and mutate optimistically | foldkit-remote |
Server-derived state |
| Sync offline edits across devices and tabs | foldkit-sync, foldkit-durable |
Replicated state |
| Edit server rows offline through a journal | foldkit-sync, foldkit-remote |
Editing server data |
| Let an AI agent use your app via MCP or A2A | foldkit-agent |
Agents |
| Share one data schema across DB, cache, and forms | foldkit-entity |
One domain declaration |
| Enforce read and write permissions everywhere | foldkit-guard |
Guard README |
| Build forms and CRUD screens from a schema | foldkit-form, foldkit-crud |
Form README |
| Use accessible, themed UI widgets | foldkit-mixins-ui |
Widget catalog |
| Style or extend views without forking markup | foldkit-mixins |
View composition |
| Reuse a child state machine in many places | foldkit-bundle |
Bundle README |
| Render on the server and resume in the browser | foldkit-ssr |
SSR README |
| Edit rich text or a 100,000-row data grid | foldkit-richtext, foldkit-data-grid |
Rich text |
For the rest of the catalog—including foldkit-surface, foldkit-primitives, foldkit-cms, foldkit-media, foldkit-site, foldkit-host, and foldkit-react—see the documentation map.
To connect an extension without a second store, foldkit-surface wraps your Model, Message, and update so extensions can point at Model fields by name. Below, foldkit-mirror binds filter and page to the URL and reads query strings back into the Model:
import { Schema } from 'effect'
import { defineMessageUnion } from 'foldkit/message'
import { modifyFields } from 'foldkit/struct'
import { Surface } from 'foldkit-surface'
import { Mirror } from 'foldkit-mirror'
const Filter = Schema.Literals(['all', 'active', 'done'])
const Model = Schema.Struct({ filter: Filter, page: Schema.Number })
const Message = defineMessageUnion({ ChangedFilter: { filter: Filter } })
const initial = { filter: 'all', page: 1 } as const
const update = (model: typeof Model.Type, message: typeof Message.Type) =>
Message.match(message, {
ChangedFilter: ({ filter }) => ({ model: modifyFields(model, { filter: () => filter }) }),
})
const App = Surface.application({ Model, Message, initial, update })
const Filters = Mirror.url(App, { name: 'filters', fields: [App.model.filter, App.model.page] })
const active = Filters.urlChanged(initial, '/todos?filter=active&page=2')
const next = update(active, Message.ChangedFilter({ filter: 'done' })).model
console.log(active)
console.log(Filters.href(next))
console.log(Filters.href(initial))What happened when this ran:
{ filter: 'active', page: 2 }
/?filter=done&page=2
/
Filters.urlChanged reads the query string back into your Model ({ filter: 'active', page: 2 }). After update sets filter to 'done', Filters.href(next) builds /?filter=done&page=2, while Filters.href(initial) drops default values back to /. Your Model owns both fields and update remains the only place they change.
Run the setup command to check your effect and foldkit versions, print the install command for your package manager, and optionally install the coding-agent skill:
npx --legacy-peer-deps foldkit-plus setupOr install the umbrella package directly with pnpm (every package is also published on its own):
pnpm add foldkit-plus- Browse guides and API docs: foldkit-plus.pages.dev
- Explore the full documentation map: docs/README.md
- Run focused code examples: examples/README.md
- Install the coding-agent skill:
npx skills add doeixd/foldkit-plus --skill foldkit-plus
MIT license. These are community packages for Foldkit and are not affiliated with or endorsed by the Foldkit maintainers.