Skip to main content

modo/
lib.rs

1//! # modo
2//!
3//! A Rust web framework for small monolithic apps. Single crate, zero proc
4//! macros, built on [`axum`] 0.8 with [`libsql`](https://crates.io/crates/libsql)
5//! (SQLite) for persistence. Handlers are plain `async fn`, routes use
6//! [`axum::Router`] directly, services are wired explicitly in `main()`, and
7//! database queries use raw libsql.
8//!
9//! ## Quick start
10//!
11//! ```toml
12//! [dependencies]
13//! modo = { package = "modo-rs", version = "0.7" }
14//!
15//! [dev-dependencies]
16//! modo = { package = "modo-rs", version = "0.7", features = ["test-helpers"] }
17//! ```
18//!
19//! Inside a handler module, pull in the common handler-time types with:
20//!
21//! ```ignore
22//! use modo::prelude::*;
23//! ```
24//!
25//! ## Virtual flat-index modules
26//!
27//! Three virtual modules re-export items across the crate so you don't have
28//! to remember which source module they live in:
29//!
30//! - [`middlewares`] — every public middleware constructor
31//! - [`extractors`] — every public request extractor
32//! - [`guards`] — every route-level gating layer applied via `.route_layer()`
33//!
34//! [`prelude`] bundles the extras a typical handler signature needs on top of
35//! those (`Error`, `Result`, `Json`, `State`, etc.).
36//!
37//! ## Features
38//!
39//! Every module is always compiled — no cargo features gate production code.
40//! The only feature flag is `test-helpers`, which exposes in-memory backends
41//! and test harnesses ([`testing`]); enable it in your `[dev-dependencies]`.
42//!
43//! ## Dependency re-exports
44//!
45//! modo re-exports the four crates that appear in nearly every handler
46//! signature, so you don't need to pin matching versions yourself:
47//!
48//! - [`axum`] — router, extractors, responses
49//! - [`serde`] — `Serialize` / `Deserialize` derives
50//! - [`serde_json`] — JSON values and macros
51//! - [`tokio`] — runtime, tasks, sync primitives
52
53pub mod config;
54pub mod error;
55pub mod runtime;
56pub mod server;
57pub mod service;
58
59pub mod cache;
60pub mod db;
61pub mod storage;
62
63pub mod cookie;
64pub mod extractor;
65pub mod flash;
66pub mod ip;
67pub mod middleware;
68pub mod sse;
69
70pub mod auth;
71pub mod tenant;
72pub mod tier;
73
74pub mod cron;
75pub mod job;
76
77pub mod email;
78pub mod qrcode;
79pub mod template;
80pub mod webhook;
81
82pub mod audit;
83pub mod health;
84pub mod tracing;
85
86pub mod dns;
87pub mod embed;
88pub mod geolocation;
89
90pub mod encoding;
91pub mod id;
92pub mod sanitize;
93pub mod validate;
94
95#[cfg(feature = "test-helpers")]
96pub mod testing;
97
98pub mod extractors;
99pub mod guards;
100pub mod middlewares;
101pub mod prelude;
102
103pub use config::Config;
104pub use error::{Error, Result};
105
106pub use axum;
107pub use serde;
108pub use serde_json;
109pub use tokio;