Browse documentation

One domain. One hook.

comwit is state management for React and Next.js, built for vibe coding. Give your coding agent llms.txt: one compact guide covers the core interface, domain structure, and examples it needs to start building.

It powers the comwit.io vibe coding platform, where more than 1,000 projects use it. Sponsored by burrr.ai.

The interface

// Load when the view mounts. Render the query state directly.
const products = useProduct((s) => s.products.load(filter))

// Read existing data without starting a request.
const detail = useProduct((s) => s.detail.data)

// Keep mutations and side effects in the domain.
const actions = useProduct((s) => s.actions)

A domain defines its types, initial state, and actions. create() combines them into a hook. Actions mutate state directly; components subscribe to the fields they use. One ComwitProvider scopes the state for your app, and models initialize on access.

Pick the data flow

You need to…Use
Fetch for a mounted viewquery() + .load(arg)
Render data fetched by a Server ComponentuseDomain.hydrate(...)
Restore an exact IndexedDB snapshot and revalidatelocal.query()
Restore cached data without an API calllocal() + .restore(arg)
Save preferences or a local draftpersist()
Run a command, optimistic update, or several requestsaction()

Related lists, details, filters, and UI state stay in the same domain. Add derived values, validation, undo/redo, or action decorators when the feature needs them.

Start building