Skip to content

OpusCapita/fsm-workflow

Repository files navigation

FSM Workflow (for Node.js)

CircleCI Status badge-license

Demo

Introduction

Finite State Machine workflow is implemented in JS using Promise-s.

  • state is stored in the business object related to workflow(machine), not in an extra workflow generic object. Multiple workflows could be defined for one business object, it means that for each workflow own state field should be used
  • one state per workflow execution (no parallelism)
  • actions are executed in the transition, not in the node/state
  • no event sending inside the workflow itself (in action)
  • no variables in state workflow: all variables/data need to be stored in the business objects
  • events: visible/available in UI as action buttons for the user
  • workflow definition stored as JSON
  • guard support (transition/event availability is defined via condition/expression/function = guard)
  • hierarchical states are not supported

Notes

The following things will be implemented later as extensions/helpers (separate sibling library) or in specific application:

  • automatic transitions
  • task list is based on domain object
  • graphical editor
  • logging
  • analysis

P.S. basic ideas on how FSM API looks like are taken from fsm-as-promised

FSM (Core)

FSM core could be found here here

Task/Work Management

Task management is implemented as additional library. You can find more detailed info here.

Workflow Transition History

Workflow Transition History is implemented as separate library. You can find more information here.

FAQ for developers

How do I set a version for all packages? Define it as version value in lerna.json file. There's no need to rewrite version in packages, release process will handle it itself.

References

Existing FSM libs review

Contributors

Alexey Sergeev
Kirill Volkovich
Daniel Zhitomirsky
Egor Stambakio

Contributing are welcome. We need YOU! 🤘