Library / SDK
matthewp/robot avatar
matthewp/robot

Robot: an immutable state machine library published as robot3, with a workspace of UI integrations

🤖 A functional, immutable Finite State Machine library

2,208 stars96 forksJavaScriptBSD-2-Clause

At a glance

What is it?
matthewp/robot is a small functional and immutable finite state machine library whose package is imported as robot3. This review covers its createMachine and interpret API, the packages in the monorepo, and what the repository does not document.
Who is it for?
Choose Robot if you want state transitions declared as plain data in a small BSD-2-Clause library and your UI layer is React, Preact, Haunted or Lit. Skip it if you need hierarchical or parallel states, because the README mentions none.
Can I use it commercially?
Yes. BSD-2-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 25 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • matthewp/robot2,208 ★ · +8
Star history
Repository2026-10-082026-11-25
matthewp/robot2.2k2.2k

8 Stars in the last 48 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

A toggle machine in four imports: createMachine, interpret, state and transition

The README shows the whole core vocabulary in one snippet. Four names come from robot3, the package the example imports from:

js
import { createMachine, interpret, state, transition } from 'robot3';

let machine = createMachine({
  off: state(
    transition('toggle', 'on')
  ),
  on: state(
    transition('toggle', 'off')
  )
});

const service = interpret(machine, () => {
  render();
});

Each key in the object passed to createMachine is a state name. A state is built by calling state() with one or more transition() calls, and each transition pairs an event name with a target state. Here the event toggle moves off to on and on to off.

interpret takes the machine and a callback. In the example the callback calls render(), so the service tells your UI to redraw whenever the machine changes. That one callback is the integration point the README shows for a plain setup, with no framework involved.

Robot calls itself functional and immutable, and the description repeats both words

The repository description reads a functional, immutable Finite State Machine library, and the README opens with a small functional and immutable Finite State Machine library. Both words are the project's own, so they are the claim to check against the docs.

In the toggle example the machine is built from nested function calls, state(transition(...)), rather than from a class you subclass or a config object with magic keys. That is what functional means in this README: states and transitions are values you compose.

The README also frames the purpose. Using state machines for your components brings the declarative programming approach to application state. It gives no benchmark, no size figure and no comparison with other state machine libraries, so any claim that Robot is smaller or faster than something else has no source here. The devDependencies include bundlesize, which suggests the maintainers track bundle weight, but the repository text shows no resulting number.

The repository is an npm workspace with six packages beside the docs

The root package.json is named robot-repo, version 0.0.0 and marked private, so it is a workspace root and not something you install. Its workspaces array lists docs and six packages: packages/core, packages/haunted-robot, packages/lit-robot, packages/preact-robot, packages/react-robot and packages/robot-hooks.

The README says Robot includes integrations for React, Preact, Haunted and more, and the package folders match the first three, with lit-robot and robot-hooks as the others. packages/core is the state machine itself, published as robot3.

The repository also carries .changeset/ and a changeset script that runs the changesets CLI at ^2.26.0, which is how the separate packages get versioned independently. Top-level entries include demos/, docs/, CODE_OF_CONDUCT.md and contributing.md, so there are working examples and contribution rules beyond the README.

Releases arrive per package, with [email protected] and [email protected] on the same day

Three GitHub releases are listed. [email protected] was published on 2026-10-05 at 01:15 UTC, [email protected] about half an hour earlier at 00:46 UTC the same day, and [email protected] at 01:15 UTC. The last push to the repository is also 2026-10-05.

Two things follow from the tag names. Packages version independently, so robot3 sits in the 1.x line while lit-robot is already at 3.0.1. And a patch and a minor release landed within an hour of each other.

The repository is not archived. The newest push is 2026-10-05. The GitHub release entries carry no notes, so what changed in [email protected] is not stated here. Read the changelog in packages/core before upgrading from 1.3.1.

The README has no install command, so the package name comes from the import line

There is no npm install line in the README. The only evidence of the package name is the import from 'robot3' and the release tags [email protected] and [email protected]. The repository name is robot, but the package you add to a project is robot3, and searching for the repository name alone sends you toward unrelated results.

Nothing else is said about how to load it. The README does not state whether the package ships as ES modules only, whether a CommonJS build exists, or whether a CDN script tag works. The import statement in the example is the only loading form shown.

The README does not document the TypeScript surface either. typescript ^7.0.2 and expect-type ^1.1.0 appear in the workspace manifest, which points to type-level tests, but the README never says that robot3 ships its own type definitions. Check the package contents before assuming typed transitions.

Browser QUnit tests need an HTTP server and a manual page load

Tests live in the test/ folder and are written in QUnit. To run them you load test/test.html in a browser through any HTTP server. The author names http-server as the one he uses.

That is a manual step. The README lists no npm test script and the root package.json defines only changeset and server scripts. The server script is a wireit task running ws -p 1965 with local-web-server, and it counts as ready when a line matches Listening on. So the repository can serve the test page on port 1965, but a human still opens it.

The devDependencies include node-qunit-puppeteer at ^2.2.0, a package for running QUnit pages in headless Chrome. How the repository invokes it is not in the README, so a contributor who wants CI-style output has to read the package scripts under packages/core. For a library user the consequence is small. For a contributor it means no single command confirms your change.

Documentation lives on regularhuman.dev, and the README covers only the toggle case

The README sends readers to regularhuman.dev for the main documentation and again for the Integrations section. Everything beyond a two-state toggle sits there, not in the README.

That leaves real gaps for anyone judging fit from the README alone. It says nothing about guards, side effects, context data, async transitions, nested or parallel states, or how an interpreter exposes the current state. It does not say how the React or Preact integrations bind a machine to a component. A reader can see that these questions exist and cannot answer them without leaving GitHub.

One tool is named. robot3-viz, maintained by jbreckmckye in a separate repository, visualizes Robot state machines. The README asks users to star the repository, file an issue for bugs, or submit a pull request. The license is BSD-2-Clause.

Editorial conclusion

Choose Robot if you want state transitions declared as plain data in a small BSD-2-Clause library and your UI layer is React, Preact, Haunted or Lit. Skip it if you need hierarchical or parallel states, because the README mentions none. Before committing, read regularhuman.dev for the API surface, since the README holds one toggle example and nothing else about guards, actions or context.

Frequently asked questions

What is the Robot library by matthewp?

Robot is a small functional and immutable finite state machine library for JavaScript. Its README example imports createMachine, interpret, state and transition from robot3.

Which UI libraries does Robot integrate with?

The README names React, Preact, Haunted and more. The repository workspace has packages for haunted-robot, lit-robot, preact-robot, react-robot and robot-hooks.

How do I run the Robot tests?

Tests are in the test/ folder and use QUnit. Load test/test.html in a browser through any HTTP server, for example http-server.

Official sources

  1. License: BSD-2-Clause
  2. matthewp/robot on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/matthewp-robot.svg)](https://hysenlabs.com/projects/matthewp-robot)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/matthewp-robot.svg)](https://hysenlabs.com/projects/matthewp-robot)

Was this useful?