Ecosystem Integrations
xstate-statemachine is architected to integrate seamlessly with the most popular, high-download crates in the Rust ecosystem.
The core engine (xstate-core) maintains zero external heavy dependencies and executes with sub-microsecond latency. Everything that connects to a web framework, database ORM, or message broker is decoupled into modular crates or feature flags.
๐บ๏ธ Pick Your Path
Find the optimal combination for your architecture:
flowchart TD
W{Web Framework?}
W -->|Axum| AX["Axum (xstate-axum)<br/>REST ยท SSE ยท WebSockets"]
W -->|"Actix-web"| AC["Actix-web<br/>web::Data ยท Actor Bridge"]
W -->|Tower| TW["Tower Service & Layer<br/>State Guard ยท Rate Limiter"]
W -->|"None / CLI / Embedded"| DB
AX --> DB{Persistence?}
AC --> DB
TW --> DB
DB -->|"SQLx (Async SQL)"| SQLX["PostgreSQL ยท SQLite<br/>(xstate-persistence)"]
DB -->|"SeaORM (Async ORM)"| SEA["SeaORM ActiveModel<br/>Entity State Transitions"]
DB -->|"Diesel (Sync ORM)"| DIE["Diesel Compile-Time ORM<br/>ToSql / FromSql Mappings"]
DB -->|Redis| RD["Redis & Redis Streams<br/>Distributed Redlock"]
DB -->|"In-Memory / None"| EV
SQLX --> EV{Event-Driven?}
SEA --> EV
DIE --> EV
RD --> EV
EV -->|"NATS / RabbitMQ / SQS"| BRK["Message Brokers (xstate-eda)<br/>CloudEvents 1.0 ยท Outbox"]
EV -->|"Internal Tokio Channels"| TK["Tokio Actors & Workers<br/>Bounded Mailbox Backpressure"]
๐ฆ High-Download Rust Packages Supported
| Crates.io Package | Downloads | Ecosystem Role | Integration Guide | Feature Flag / Crate |
|---|---|---|---|---|
axum | 35M+ | Tokio web framework | Axum Guide | xstate-axum / features = ["axum"] |
actix-web | 40M+ | High-throughput web framework | Actix-web Guide | Standalone pattern / adapter |
tower | 70M+ | Universal networking middleware | Tower Middleware | Universal service layer |
sqlx | 45M+ | Async SQL toolkit (PG, SQLite) | SQLx Guide | features = ["sqlite", "postgres"] |
sea-orm | 15M+ | Async relational ORM | SeaORM Guide | ORM ActiveModel adapter |
diesel | 30M+ | Compile-time synchronous ORM | Diesel Guide | Custom SQL mapping types |
redis | 35M+ | Caching, locks & streams | Redis Guide | features = ["redis", "redis-streams"] |
tracing | 150M+ | Diagnostics & structured logging | Tracing Guide | TracingPlugin (core) |
metrics | 25M+ | Metrics facade (Prometheus) | Prometheus Guide | features = ["observability"] |
validator | 20M+ | Schema & invariant validation | Validation Guide | Pre-transition guard plugin |
proptest | 30M+ | Property-based testing | Testing Harness | features = ["testing"] |
tokio | 180M+ | Async runtime & actors | Workers & Queues | features = ["tokio"] |
โก Cross-Language Parity with Python
If you are migrating or operating a polyglot fleet with Python xstate-statemachine:
xstate-axummirrorsxstate_statemachine.contrib.fastapiandstarlette.xstate-persistencemirrorsxstate_statemachine.persistence.sqliteandpostgres.xstate-edamirrorsxstate_statemachine.contrib.brokers(NATS, RabbitMQ, SQS, CloudEvents).xstate-observabilitymirrorsxstate_statemachine.contrib.observability.xstate-agentsmirrorsxstate_statemachine.contrib.agents(LangGraph / PydanticAI tool loop guards).