Signals
Reactive values you read like a function and write with .set. Subscribers update synchronously, in order.
const count = signal(0)
count.set(2) // graph notified
count() // => 2
Lattice is a 3kB fully-typed library that tracks dependencies as
a graph and recomputes only what changed. No virtual DOM, no proxies you
can't inspect — just signals that know who depends on them.
$ npm i lattice Why it exists
Modern UI state is a web of derived values, yet most tools either recompute everything or bury the reactivity behind machinery you can't see. Lattice treats state as what it actually is — a directed graph — and gives you a tiny, inspectable runtime that recomputes the minimum.
Features
One mental model — nodes and edges — covers reading, deriving, reacting, and debugging. The whole public API fits on a postcard.
Reactive values you read like a function and write with .set. Subscribers update synchronously, in order.
const count = signal(0)
count.set(2) // graph notified
count() // => 2 Derived nodes that auto-track their dependencies. Recompute lazily, cache until an input actually changes.
const doubled = computed(
() => count() * 2,
) // edges: [count] Side effects that re-run when — and only when — a value they read changes. Cleanup runs automatically.
effect(() =>
render(doubled())
) // reruns on change The dependency graph is a first-class object. Walk it, snapshot it, or print a dot diagram in tests.
graph.deps(doubled)
// => [Signal<count>]
graph.toDot() // graphviz Contributors
247 contributors and counting. Every avatar below is one merged pull request away from being you.
How to contribute
No CLA, no Slack invite, no committee. Read the steps, pick an issue, ship.
Fork the repo, then clone your fork. git clone git@github.com:you/lattice.git
One command installs deps and runs the suite. Everything is offline. pnpm i && pnpm test
Branch from main, make your change, keep the bundle under 3.5kB. git checkout -b fix/edge-case
Push and open a pull request. CI runs typecheck, tests and size-limit. gh pr create --base main
New to the codebase? 23 issues are tagged
good first issue
— small, well-scoped, and reviewed within a day.
Sponsors
Sponsorship pays for the maintainers' time so issues get answered and releases stay on schedule.
Gold
Silver
Backers
One scroll, one decision
Stars are how maintainers know it matters, how new users find it, and how sponsors decide. It costs you a click.