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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//! Lariv application kernel — configuration, HTTP server wiring, and aggregated plugin registries.
//!
//! **lariv-rs** is a compile-time plugin web application framework built on **Axum**,
//! **SeaORM**, **Maud**, and **HTMX 4**.
//!
//! # Architecture
//!
//! The app lifecycle has three phases:
//!
//! 1. **Builder** — [`App`](app::App) holds an HList of capability stores (hooks + items).
//! Plugins call [`define_plugin_install!`](plugin_install::define_plugin_install) to register
//! deferred hooks for routes, templates, migrations, CLI commands, etc.
//! 2. **Mount** — [`App::mount`](app::App::mount) resolves hooks, folds capabilities to
//! [`Tagged`](tag::Tagged) outputs, and produces a [`MountedApp`](app::MountedApp).
//! 3. **Runtime** — Axum serves HTTP; handlers extract mounted state via [`Cap`](http::Cap).
//!
//! # Quickstart
//!
//! ```ignore
//! use lariv_rs::app::App;
//! use lariv_rs::plugins::{dashboard, users};
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! let app = App::new_web_app();
//! let app = users::install(app);
//! let app = dashboard::install(app);
//! let app = app.load_config("config.toml").await?;
//! let mounted = app.mount();
//! mounted.run_migrations().await?;
//! mounted.run_seeds().await?;
//! mounted.run().await
//! }
//! ```
//!
//! See [`app`] for lifecycle details and [`plugins`] for bundled plugins.
//!
//! # Beginner guides
//!
//! Step-by-step tutorials for new plugin authors live in the [`docs`] module:
//!
//! - [`docs::quickstart`] — Hello World plugin tutorial
//! - [`docs`] — project layout and guide index
//!
//! # Core modules
//!
//! | Module | Role |
//! |--------|------|
//! | [`app`] | Builder and mounted app lifecycle |
//! | [`capability`] | Capability stores, hooks, mount folding |
//! | [`tag`] | Type-level tagging via [`tag::Tagged`] |
//! | [`traits`] | HList lookup, add, replace, remove |
//! | [`http`] | Route registry and Axum router |
//! | [`template`] | Maud page template registry |
//! | [`layers`] | Compile-time view middleware stacks |
//! | [`components`] | Maud UI builders (fields, tables, shells) |
//! | [`web`] | HTMX-aware page rendering helpers |
//! | [`html_form`] | Form macro and widget traits |
//! | [`rt`] | Large-stack process entry helpers ([`main`]) |
//! | [`config`] | TOML configuration loading |
//! | [`db`] | SeaORM connection capability |
//! | [`migration`] | Composite SeaORM migrator |
//! | [`command`] | CLI command registration |
//! | [`hooks`] | State attachment and seed hooks |
//! | [`apps`] | Dashboard app tile catalog |
//! | [`export`] | XLSX export table catalog |
//! | [`llm_tools`] | Gemini function-calling tools |
//! | [`rune_env`] | Rune script native bindings |
//! | [`grapesjs`] | Website builder block/component registries |
//! | [`genai`] | Gemini HTTP client |
//! | [`views`] | Named view registry (PWA offline page) |
//!
//! # Plugin authoring
//!
//! | Module | Role |
//! |--------|------|
//! | [`plugin_install`] | [`define_plugin_install!`] macro |
//! | [`plugin_routes`] | [`define_plugin_routes!`] DSL reference |
//! | [`define_plugin_routes`] | Proc-macro re-export |
//!
//! # Bundled plugins
//!
//! | Plugin | Module | Purpose |
//! |--------|--------|---------|
//! | Users & auth | [`plugins::users`] | JWT/scrypt auth, roles, user CRUD |
//! | Dashboard | [`plugins::dashboard`] | Apps launchpad and home redirects |
//! | Blog | [`plugins::blog`] | Articles and hierarchical tags |
//! | Filesystem | [`plugins::filesystem`] | DB-backed virtual filesystem |
//! | Website | [`plugins::website`] | DB routes, Minijinja pages, GrapesJS builder |
//! | LLM assistant | [`plugins::llm_assistant`] | Gemini chat, skills, WebSocket |
//! | OTP recovery | [`plugins::otp`] | SMS/email one-time password recovery |
//! | PWA | [`plugins::pwa`] | Manifest, service worker, offline page |
//! | Export | [`plugins::export`] | XLSX data export UI |
//! | Signup | [`plugins::signup`] | Public self-service signup |
//!
//! Proc-macro derives expand to `::lariv_rs::…` paths; this crate aliases itself as `lariv_rs` for in-tree use.
extern crate self as lariv_rs;
/// Generate route tags, proof type, and [`RouteRegistrar`](http::RouteRegistrar) hook.
///
/// See [`plugin_routes`] for the full DSL reference.
pub use define_plugin_routes;
/// Attribute macro: run `async fn main` on a thread with a raised stack size.
///
/// Deep HList install/mount chains overflow the default ~8 MiB stack. This macro
/// raises the process stack soft limit, spawns a dedicated thread, and drives a
/// Tokio runtime with the requested stack.
///
/// # Attributes
///
/// - `stack_size = <expr>` — bytes (default: [`rt::DEFAULT_STACK_SIZE`], 64 MiB)
/// - `flavor = "current_thread" | "multi_thread"` — Tokio runtime (default: `"current_thread"`)
/// - `thread_name = "..."` — OS thread name (default: `"lariv-server"`)
///
/// # Examples
///
/// ```ignore
/// #[lariv_rs::main(stack_size = 64 * 1024 * 1024)]
/// async fn main() -> anyhow::Result<()> {
/// // install / mount / run
/// Ok(())
/// }
///
/// #[lariv_rs::main(stack_size = 64 * 1024 * 1024, flavor = "multi_thread")]
/// async fn main() -> anyhow::Result<()> {
/// Ok(())
/// }
/// ```
pub use main;
/// Re-exported for [`define_plugin_install!`](plugin_install::define_plugin_install) `cap_attach` /
/// `cap_hook` unique type-parameter names (used via `$crate::paste` from the macro).
pub use paste;