1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//! # modo
//!
//! A Rust web framework for small monolithic apps. Single crate, zero proc
//! macros, built on [`axum`] 0.8 with [`libsql`](https://crates.io/crates/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`:
//!
//! ```toml
//! [dependencies]
//! modo = { package = "modo-rs", version = "0.8" }
//!
//! [dev-dependencies]
//! modo = { package = "modo-rs", version = "0.8", features = ["test-helpers"] }
//! ```
//!
//! Minimal application:
//!
//! ```rust,no_run
//! 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:
//!
//! ```ignore
//! 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>` alias
//! - [`Config`] — top-level application configuration
//! - [`run!`](crate::run) — macro that waits for SIGTERM/SIGINT then shuts down each
//! supplied [`Task`](crate::runtime::Task) in 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 constructor
//! - [`extractors`] — every public request extractor
//! - [`guards`] — 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, responses
//! - [`serde`] — `Serialize` / `Deserialize` derives
//! - [`serde_json`] — JSON values and macros
//! - [`tokio`] — runtime, tasks, sync primitives
pub use Config;
pub use ;
pub use axum;
pub use serde;
pub use serde_json;
pub use tokio;