TypeScript & ReScript·Open source·MIT

Domain-Driven State Management

A state management library for TypeScript and ReScript that supports Domain-Driven Design. Plain objects, pure functions, views that observe them directly — no stores, no dispatch, no boilerplate.

tilia /ti·li·a/ n., Latin — the linden. The carver's wood: even-grained, cuts clean, holds detail.

Reactive state
const sky = tilia({
  color: 'pink'
})

observe(() => {
  console.log(sky.color)
})

// views: @tilia/react
function Sky() {
  useTilia()
  return <div>{sky.color}</div>
}
let sky = tilia({
  color: "pink"
})

observe(() => {
  Console.log(sky.color)
})

// views: @tilia/react
let make = () => {
  useTilia()
  <div> {React.string(sky.color)} </div>
}
$ npm install tilia @tilia/react

Why tilia

State management usually asks the domain to bend to the framework. tilia bends the other way.

1.1

The domain is the API

State consists of plain objects and pure functions in the shape your domain already has. No stores, no actions, no dispatch.

1.2

Views follow the model

Components re-render exactly when a value they read changes — no selectors, no memo rituals, no stale props.

1.3

Typed at every edge

Written in ReScript and published with first-class TypeScript types. Your state's shape is checked everywhere it is used.