trillium 1.0.0

a modular toolkit for building async web apps
Documentation

๐ŸŒบ trillium โ€” a modular async web framework

ci crates.io version docs.rs

๐Ÿ“– Guide ยท ๐Ÿ“‘ Rustdocs

Trillium is a modular async web framework for Rust. Its key design point: there is no distinction between middleware and endpoints โ€” everything is a Handler. Handlers compose by nesting in tuples, running left to right and stopping at the first that halts the connection. This makes it easy to mix routing, logging, auth, compression, and any other behavior without special-casing at the framework level.

To build a Trillium app you also need a runtime adapter: trillium-tokio, trillium-smol, or trillium-async-std.

Example

use trillium::Conn;

// Any async fn(Conn) -> Conn is a Handler:
async fn hello(conn: Conn) -> Conn {
    conn.ok("hello trillium!")
}

// Handlers compose left-to-right in a tuple.
// The first handler to call conn.halt() stops the chain.
let app = (
    hello,
    // add trillium_logger::logger(), trillium_router::router(), etc. here
);

// run with your chosen runtime adapter:
// trillium_tokio::run(app);

Safety

This crate uses #![forbid(unsafe_code)].

License