# ifandelse/machina.js

ts ex machina - finite state machines in TypeScript

Repository: https://github.com/ifandelse/machina.js
Canonical: https://ross.abutalabs.com/products/machinajs
Homepage: http://machina-js.org/
Language: TypeScript
License: NOASSERTION
License Family: other
Topics: fsm, state-machine
Last push: 2026-08-11T21:55:31+00:00

## Health v2 (maintenance only)
Score: 76/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 35, longevity 100
- inputs: {"age_days": 5300, "days_push": 22, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1969, forks 144 (observed 2026-08-28T04:06:00.747242+00:00)

## What it is
machina is a TypeScript-first library for building finite state machines in JavaScript and TypeScript, with full type inference for states, inputs, and transitions. It supports hierarchical states with input bubbling, behavioral FSMs that track state per-client via WeakMap, deferred inputs, lifecycle hooks, and static analysis tooling.

## Use cases
- model complex UI component states as finite state machines
- manage connection lifecycle states for multiple clients with one FSM definition
- implement hierarchical state machines with parent-child delegation
- queue and replay inputs that arrive before a state is ready
- catch unreachable states and missing handlers at compile time or lint time

## When to avoid
- you need full SCXML or statechart features like parallel regions or history states
- you want a batteries-included state container with built-in store integration like Redux or Zustand
- your project is plain JavaScript and you do not benefit from the TypeScript-first design

## Facets
- artifact type: library
- maturity: active
- function: state-management, developer-tools
- domain: developer-tools, programming-languages
- platform: browser, cross-platform
- tags: finite-state-machine, fsm, hierarchical-states, behavioral-fsm, typescript-first, state-charts, automation, nodejs, typescript, javascript

## Member repositories
- ifandelse/machina.js (main) score 76

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:00.747242+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:05:09.845963+00:00, confidence not recorded.
  - readme: https://github.com/ifandelse/machina.js (fetched 2026-08-28T04:06:00.747242+00:00, sha c3cb92b50f05)
  - homepage: http://machina-js.org/ (fetched 2026-08-29T10:45:08.791856+00:00, sha c985bbdc8831)
  - site_page: https://machina-js.org/guide/getting-started (fetched 2026-08-29T10:45:08.800899+00:00, sha db99775ead18)
- Data as of 2026-08-30T08:39:29.467469+00:00.
