# machina > Focused finite state machines for JavaScript and TypeScript. States in, states out. machina is TypeScript-first. Handlers receive `{ ctx, inputName, defer, emit }` as a destructured args object. A handler returns a state name to transition and returns nothing to stay in the current state. String shorthand (`timeout: "yellow"`) declares an unconditional transition. The compiler validates state names, transition targets, `handle()` inputs, and `defer({ until })` targets. Hierarchies are typed: a parent's `handle()` accepts its children's inputs at any depth, and `bubbles` declares the inputs an FSM sends upward, checked at the `_child` mounting site. An input payload map (`createFsm()`) types each input's arguments at the handler and at every `handle()` call. ## Documentation Sets - [Abridged documentation](https://machina-js.org/llms-small.txt): a compact version of the documentation for machina, with non-essential content removed - [Complete documentation](https://machina-js.org/llms-full.txt): the full documentation for machina ## Notes - The complete documentation includes all content from the official documentation - The content is automatically generated from the same source as the official documentation ## Optional - [Source code](https://github.com/ifandelse/machina.js): GitHub repository - [npm package](https://www.npmjs.com/package/machina): Install with `npm install machina` - [API Reference](https://machina-js.org/api/): TypeDoc-generated API documentation: classes, interfaces, type aliases