{"id":26863844,"url":"https://github.com/rluders/gofsm","last_synced_at":"2026-04-10T23:02:35.840Z","repository":{"id":284849567,"uuid":"953950307","full_name":"rluders/gofsm","owner":"rluders","description":"Simple Finite State Machine written in Go that can play with Redis and Kafka.","archived":false,"fork":false,"pushed_at":"2025-03-25T18:37:47.000Z","size":42,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T01:51:48.685Z","etag":null,"topics":["finite-state-machine","fsm","go","golang","kafka","kubernetes","microservice","redis"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rluders.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-24T10:36:15.000Z","updated_at":"2025-03-25T18:35:59.000Z","dependencies_parsed_at":"2025-03-28T02:02:04.592Z","dependency_job_id":null,"html_url":"https://github.com/rluders/gofsm","commit_stats":null,"previous_names":["rluders/gofsm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fgofsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fgofsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fgofsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fgofsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rluders","download_url":"https://codeload.github.com/rluders/gofsm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413363,"owners_count":20773052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finite-state-machine","fsm","go","golang","kafka","kubernetes","microservice","redis"],"created_at":"2025-03-31T03:32:58.616Z","updated_at":"2026-04-10T23:02:35.769Z","avatar_url":"https://github.com/rluders.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GOFSM\n\nAn extensible Finite State Machine (FSM) library for Go, designed for event-driven and distributed systems.\n\n\u003e [!WARNING]\n\u003e This library was initially created as a proof of concept (PoC) to solve a specific coordination issue in a distributed system.\n\u003e It is **not production-ready** and may contain bugs or limitations that have not yet been addressed.\n\u003e Contributions, suggestions, and improvements are **very welcome**!\n\n## 🧩 What Problem Does It Solve?\n\nIn distributed systems, managing workflows and transitions across multiple services can become complex—especially when coordination, concurrency, and external events are involved.\n\n`gofsm` aims to provide a decoupled, pluggable, and testable FSM core that allows:\n\n- Safe state transitions under concurrency (with Redis locking support)\n- Reactive behavior driven by events (from Kafka, HTTP, etc.)\n- Clean separation between FSM logic and infrastructure concerns\n\nIt is ideal for scenarios such as:\n\n- Orchestrating Kubernetes jobs\n- Reacting to Kafka or event-stream inputs\n- Coordinating microservices through stateful flows\n\n## ✨ Features\n\n- Reusable FSM engine with `OnEnter`, `HandleEvent`, and `OnExit` lifecycle hooks\n- Fully decoupled from transport and storage\n- Pluggable storage layer with Redis adapter (uses lock + retry)\n- Optional Kafka integration using `segmentio/kafka-go`\n- Support for `TransitionHook` to notify or trigger side-effects\n- Designed for testability and distributed coordination\n\n## 📦 Installation\n\n```bash\ngo get github.com/rluders/gofsm@latest\n```\n\n## 🚀 Basic Usage\n\n```go\nengine, err := fsm.NewFSM([]fsm.State{\n    \u0026MyInitialState{},\n    \u0026MyFinalState{},\n}, fsm.WithStateStorage(myStorage))\n\n// Triggering an event\nerr = engine.Trigger(ctx, \"entity-id\", fsm.NewBasicEvent(\"MyEvent\", nil))\n```\n\n## 📄 License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frluders%2Fgofsm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frluders%2Fgofsm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frluders%2Fgofsm/lists"}