# jakesgordon/javascript-state-machine

A javascript finite state machine library

Repository: https://github.com/jakesgordon/javascript-state-machine
Canonical: https://ross.abutalabs.com/products/javascript-state-machine
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2025-06-01T22:01:49+00:00

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

## Adoption (not part of the score)
Stars 8750, forks 946 (observed 2026-08-28T04:10:25.564819+00:00)

## What it is
A JavaScript finite state machine library for defining states, transitions, and lifecycle event hooks. It works in both the browser and Node.js and generates transition methods and observer callbacks from a declarative config.

## Use cases
- model game or UI object states with explicit transitions
- implement a workflow with allowed state changes and guards
- replace ad-hoc boolean flags with a state machine
- add lifecycle hooks when an object changes state
- manage states like solid/liquid/gas or idle/running/paused in JavaScript

## When to choose
- you need a lightweight, dependency-free finite state machine in JavaScript
- you want declarative transitions with automatic transition methods and event observers
- you need the same state machine logic in browser and Node.js

## When to avoid
- you need hierarchical or concurrent statecharts (e.g. XState)
- your project is not JavaScript/Node.js based
- you need persistence or distributed state machine orchestration

## Facets
- artifact type: library
- maturity: stable
- function: state-management, developer-tools
- domain: web-development, frontend
- platform: browser, cross-platform
- tags: finite-state-machine, fsm, state-transitions, lifecycle-events, javascript, algorithms, nodejs

## Member repositories
- jakesgordon/javascript-state-machine (main) score 43

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:25.564819+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-29T17:25:16.615711+00:00, confidence not recorded.
  - readme: https://github.com/jakesgordon/javascript-state-machine (fetched 2026-08-28T04:10:25.564819+00:00, sha 9ca725f24f0b)
  - registry_npm: https://registry.npmjs.org/javascript-state-machine (fetched 2026-08-29T08:25:44.843667+00:00, sha 5f53d1cc4ec5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
