Expand description
§modo
A Rust web framework for small monolithic apps. Single crate, zero proc
macros, built on axum 0.8 with libsql
(SQLite) for persistence. Handlers are plain async fn, routes use
axum::Router directly, services are wired explicitly in main(), and
database queries use raw libsql.
§Quick start
Add to Cargo.toml:
[dependencies]
modo = { package = "modo-rs", version = "0.8" }
[dev-dependencies]
modo = { package = "modo-rs", version = "0.8", features = ["test-helpers"] }Minimal application:
use modo::{Config, Result};
use modo::axum::{Router, routing::get};
use modo::runtime::Task;
async fn hello() -> &'static str { "Hello, modo!" }
#[tokio::main]
async fn main() -> Result<()> {
let config: Config = modo::config::load("config/")?;
let app = Router::new().route("/", get(hello));
let server = modo::server::http(app, &config.server).await?;
modo::run!(server).await
}Inside a handler module, pull in the common handler-time types with:
use modo::prelude::*;§Key crate-level exports
These items are re-exported at the crate root for convenience:
Error— the framework error type (HTTP status + message + optional source/code)Result—std::result::Result<T, Error>aliasConfig— top-level application configurationrun!— macro that waits for SIGTERM/SIGINT then shuts down each suppliedTaskin declaration order
§Virtual flat-index modules
Three virtual modules re-export items across the crate so you don’t have to remember which source module they live in:
middlewares— every public middleware constructorextractors— every public request extractorguards— every route-level gating layer applied via.route_layer()
prelude bundles the extras a typical handler signature needs on top of
those (Error, Result, AppState, Session, Role, Flash, ClientIp,
Tenant, TenantId, and the Validate trio).
§Features
Every module is always compiled — no cargo features gate production code.
The only feature flag is test-helpers, which exposes in-memory backends
and test harnesses ([testing]); enable it in your [dev-dependencies].
| Feature | Purpose |
|---|---|
test-helpers | Enables [testing] module with TestDb, TestApp, TestSession, and all in-memory/stub backends |
§Dependency re-exports
modo re-exports the four crates that appear in nearly every handler signature, so you don’t need to pin matching versions yourself:
axum— router, extractors, responsesserde—Serialize/Deserializederivesserde_json— JSON values and macrostokio— runtime, tasks, sync primitives
Re-exports§
pub use config::Config;pub use error::Error;pub use error::Result;pub use axum;pub use serde;pub use serde_json;pub use tokio;
Modules§
- audit
- modo::audit
- auth
- modo::auth
- cache
- modo::cache
- config
- modo::config
- cookie
- modo::cookie
- cron
- modo::cron
- db
- modo::db
- dns
- modo::dns
- modo::email
- embed
- modo::embed
- encoding
- modo::encoding
- error
- modo::error
- extractor
- modo::extractor
- extractors
- Flat index of every axum extractor modo ships.
- flash
- modo::flash
- geolocation
- modo::geolocation
- guards
- Flat index of every route-level gating layer.
- health
- modo::health
- id
- modo::id
- ip
- modo::ip
- job
- modo::job
- middleware
- modo::middleware
- middlewares
- Flat index of every Tower Layer modo ships.
- prelude
- Handler-time prelude.
- qrcode
- modo::qrcode
- runtime
- modo::runtime
- sanitize
- modo::sanitize
- server
- modo::server
- service
- modo::service
- sse
- modo::sse
- storage
- modo::storage
- template
- modo::template
- tenant
- modo::tenant
- tier
- modo::tier
- tracing
- modo::tracing
- validate
- modo::validate
- webhook
- modo::webhook
Macros§
- run
- Waits for a shutdown signal and then shuts down each task in order.