Skip to content

About Matchina

Matchina is a TypeScript-first, lightweight toolkit for building type-safe state machines, with powerful pattern matching and async handling. It provides:

  • Strongly-typed state machines with full type inference
  • Tagged unions via the matchbox pattern for discriminated types
  • Type-safe transitions with smart parameter inference
  • Promise integration for handling async operations safely
  • Nano-sized, opt-in primitives for state machines and async logic
  • Composable APIs that work together or standalone
  • Lightweight: Each feature is just a few hundred bytes
  • TypeScript-First: Full type inference and safety
  • Composable: Use only what you need
  • No Dependencies: Zero runtime dependencies
  • React Integration: First-class support for React
  • Factory autocompletes states types
  • State Creator autocompletes parameters
  • State autocompletes key
  • State autocompletes data
  • match autocompletes state types
  • match handler autocompletes state properties
  • transition config autocompletes state keys
  • transition config autocompletes transition type and from properties
  • autocomplete available states
  • api autocompletes state types
  • api autocompletes transition params
  • event autocompletes event type, to, from, and params
  • event.match autocompletes event type
  • event.match handler autocompletes event params
  • type assert matching to.key, from.key and event type
  • Matching: switch and filter matching, union factories
  • State Machines: state machine, promise machine
  • Extensibility: composable setup, enhancers, lifecycle
  • Extras: when, delay, effects, subscribe, reset
  • Integrations: React