# looplab/fsm

Finite State Machine for Go

Repository: https://github.com/looplab/fsm
Canonical: https://ross.abutalabs.com/products/fsm
Language: Go
License: Apache-2.0
License Family: permissive
Topics: finite-state-machine, fsm, go
Last push: 2025-05-07T12:11:11+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 20, release rhythm 8, longevity 100
- inputs: {"age_days": 4760, "days_push": 483, "days_rel": 483, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3409, forks 331 (observed 2026-08-28T04:08:03.274482+00:00)

## What it is
A finite state machine (FSM) library for Go, inspired by javascript-state-machine and fysom. It lets you define states, events, transitions, and callbacks, and can be embedded as a struct field.

## Use cases
- model state transitions for a Go application
- implement a state machine with events and callbacks
- manage object lifecycle states in Go
- embed a state machine in a struct
- guard invalid state transitions with errors

## When to choose
- you need a lightweight, well-tested FSM in a Go project
- you want simple event-driven state transitions with callbacks
- you prefer a minimal library with context support

## When to avoid
- you need hierarchical or concurrent statecharts
- you need persistence or distributed state machine orchestration
- you are not working in Go

## Facets
- artifact type: library
- maturity: stable
- function: developer-tools
- domain: developer-tools
- platform: go, cross-platform
- tags: finite-state-machine, fsm, state-machine, go-library, callbacks, algorithms, automation

## Member repositories
- looplab/fsm (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:03.274482+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-29T18:38:32.516054+00:00, confidence not recorded.
  - readme: https://github.com/looplab/fsm (fetched 2026-08-28T04:08:03.274482+00:00, sha 279034bae1f7)
- Data as of 2026-08-30T08:39:29.467469+00:00.
