A simple .NET library for creating state machines and lightweight state machine-based workflows directly in C# code.
Stateless is a .NET library for creating state machines and lightweight state machine-based workflows directly in C# code. It allows developers to model complex business logic with explicit states and transitions, reducing bugs and improving code clarity. The library supports hierarchical states, guard clauses, parameterized triggers, and asynchronous operations.
.NET developers building applications with complex state-driven logic, such as order processing systems, UI workflows, or game AI, who need a lightweight and embeddable state machine solution.
Developers choose Stateless for its simplicity, fluent API, and deep integration with .NET, including async support and external state storage, without the overhead of larger workflow frameworks.
A simple library for creating state machines in C# code
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows nesting states as substates for shared behavior, as shown with the OnHold substate example, reducing code duplication for entry/exit actions.
Supports asynchronous entry/exit actions and trigger firing with FireAsync(), making it suitable for modern .NET async workflows, including integration with platforms like Microsoft Orleans.
Enables external state storage via read/write delegates in the constructor, allowing seamless integration with ORMs or UI frameworks without locking in persistence.
Exports state machines to DOT or Mermaid graphs directly from code, facilitating documentation and debugging with tools like Graphviz or GitHub Markdown.
Due to design limitations, handling initial transitions requires a dummy state and manual activation, as admitted in the README, adding complexity for simple startups.
Lacks out-of-the-box solutions for state persistence; developers must implement external storage manually, which can be error-prone in distributed scenarios.
Despite async support, the library is not thread-safe and prohibits concurrent usage, limiting scalability in multi-threaded applications.