Tools / Editor
State Machine Diagram Builder
Map lifecycle states, events and transitions in a Mermaid state diagram. Add guards and actions, then preview and export the model.
Define allowed lifecycle changes
Describe the lifecycle of an order, job, or interface with a state machine diagram. States name stable conditions; transitions explain what causes a change. This keeps lifecycle rules separate from the sequence of implementation steps used to carry them out.
A worked example
Diagram source
stateDiagram-v2
direction LR
state "Draft" as Draft
state "Review" as Review
state "Published" as Published
[*] --> Draft
Draft --> Review : submit
Review --> Published : approve [valid] / publish
Published --> [*]How to use this tool
- Create states with distinct IDs and clear labels. Use a parent state when a group shares a meaningful lifecycle context.
- Add transitions with a source, target, and event. Include guard and action text where it explains the rule.
- Trace normal, failure, and cancellation paths before exporting. Check whether every state has the intended way in and out.
What to check
| Detail | Guidance |
|---|---|
| Initial and final markers | Use [*] at a lifecycle boundary. It is not an ordinary state with business data. |
| Guard conditions | Describe the condition that permits a transition. The diagram does not execute or validate the condition. |
| Choice, fork, and join | Use these only when the model needs a decision or concurrent paths. Extra symbols can obscure a simple lifecycle. |
Common questions
How is this different from a flowchart?
A state diagram focuses on what an object is allowed to become after an event. A flowchart focuses on steps in a process. Choose the former for lifecycle rules and the latter for procedural decisions.