Firefly for Rust

Rust’s type system. A shared way to build.

Firefly for Rust brings application patterns into the Tokio and Axum ecosystem. Compose typed handlers, dependency injection, reactive operations, and persistence while keeping Rust’s explicit contracts.

Runtime & foundation
  • Rust 1.88+
  • Tokio
  • Axum

The building blocks,
explained.

Explore what this implementation provides, with a direct path to the code behind each capability.

Reactive composition

Compose asynchronous values with Mono operators for mapping, chaining, recovery, retries and timeouts.

Explore this capability
Dependency injection

Register components and resolve dependencies with singleton and transient lifecycles.

Explore this capability
Typed CQRS dispatch

Route typed commands and queries through registered handlers and a middleware chain.

Explore this capability
Compensating sagas

Attach compensating actions to steps and unwind completed work when a later step fails.

Explore this capability
SQLx repositories

Use repository APIs for SQL reads, writes, filtering and pagination, with explicit not-found and optimistic-lock results.

Explore this capability

See the ideas
in real code.

Verbatim Lumen Ledger entry point: link the actual layer crates, include controllers, and run FireflyApplication on Tokio.

View the complete source
main.rsRust
firefly::link!(
    lumen_ledger_core,
    lumen_ledger_models,
    lumen_ledger_interfaces
);

mod controllers;

#[tokio::main]
async fn main() -> Result<(), firefly::BoxError> {
    firefly::FireflyApplication::new("lumen-ledger")
        .version(firefly::VERSION)
        .run()
        .await
}
An exact excerpt from the project

Learn through Lumen Ledger.

See how a real sample connects its application, domain, and infrastructure. Read the source alongside its guide and tests.

  1. Follow the Lumen quickstart

    Read the book’s real first-service walkthrough and its application bootstrap.

    Follow this step
  2. Inspect the Lumen Ledger entry point

    See how the sample links its layer crates and starts FireflyApplication.

    Follow this step
  3. Trace a failed saga

    Read the source test that fails the shipping step and verifies reverse-order compensation.

    Follow this step
Firefly for Rust by Example cover

Firefly for Rust by Example

Event-Driven Rust Microservices with the Firefly Framework

Build Lumen Ledger while exploring application composition, event-driven services, persistence, and clear service boundaries. English and Spanish editions are available.

PDF & EPUB · v26.6.36

Keep exploring.

Follow the projects and references connected to Firefly for Rust.

Source references
Another language. A shared direction.Firefly for .NET