A safe, persistent, and extensible Finite State Machine (FSM) library for Go, inspired by Boost MSM.
go-msm provides a framework for building robust FSMs in Go, focusing on:
- Safety: Type-safe transitions, guards, and actions.
- Persistence: All FSM states and transitions are stored in a database (via GORM), enabling recovery, replay, and audit.
- Extensibility: Supports plugins, callbacks, and custom storage for advanced use cases.
- Not performance-oriented: Unlike Boost MSM, this library prioritizes reliability and traceability over performance.
- Define states, events, actions, and guards with type safety.
- Persist FSM state and transition history in a database (SQLite, PostgreSQL, etc. via GORM).
- Replay FSM history for debugging or recovery.
- Visualize FSMs using Graphviz.
- Plugin system for custom event processing.
- Callback system for logging, auditing, and side effects.
Add to your Go project:
go get github.com/agmt/go-msm
ToDo
See the msm_test.go
for a minimal working FSM.
ToDo
MIT
Inspired by Boost MSM.