Skip to main content

Crate lariv_rs

Crate lariv_rs 

Source
Expand description

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 holds an HList of capability stores (hooks + items). Plugins call define_plugin_install! to register deferred hooks for routes, templates, migrations, CLI commands, etc.
  2. Mount — App::mount resolves hooks, folds capabilities to Tagged outputs, and produces a MountedApp.
  3. Runtime — Axum serves HTTP; handlers extract mounted state via Cap.

§Quickstart

ⓘ
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:

§Core modules

ModuleRole
appBuilder and mounted app lifecycle
capabilityCapability stores, hooks, mount folding
tagType-level tagging via tag::Tagged
traitsHList lookup, add, replace, remove
httpRoute registry and Axum router
templateMaud page template registry
layersCompile-time view middleware stacks
componentsMaud UI builders (fields, tables, shells)
webHTMX-aware page rendering helpers
html_formForm macro and widget traits
rtLarge-stack process entry helpers (main)
configTOML configuration loading
dbSeaORM connection capability
migrationComposite SeaORM migrator
commandCLI command registration
hooksState attachment and seed hooks
appsDashboard app tile catalog
exportXLSX export table catalog
llm_toolsGemini function-calling tools
rune_envRune script native bindings
grapesjsWebsite builder block/component registries
genaiGemini HTTP client
viewsNamed view registry (PWA offline page)

§Plugin authoring

§Bundled plugins

PluginModulePurpose
Users & authplugins::usersJWT/scrypt auth, roles, user CRUD
Dashboardplugins::dashboardApps launchpad and home redirects
Blogplugins::blogArticles and hierarchical tags
Filesystemplugins::filesystemDB-backed virtual filesystem
Websiteplugins::websiteDB routes, Minijinja pages, GrapesJS builder
LLM assistantplugins::llm_assistantGemini chat, skills, WebSocket
OTP recoveryplugins::otpSMS/email one-time password recovery
PWAplugins::pwaManifest, service worker, offline page
Exportplugins::exportXLSX data export UI
Signupplugins::signupPublic self-service signup

Proc-macro derives expand to ::lariv_rs::… paths; this crate aliases itself as lariv_rs for in-tree use.

Re-exports§

pub use paste;

Modules§

app
Application lifecycle: builder phase, mount, and runtime CLI/HTTP.
apps
App catalog capability — plugins register launchable tiles; dashboard reads them live.
capability
Uniform capability shape: hooks + items, infallible Capability::mount → Tagged.
command
CLI command registry capability — plugins register subcommands; clap builds and dispatches them.
components
Reusable Maud UI builders — fields, inputs, buttons, layouts, shells, and forms for the Lariv application framework.
config
TOML configuration loading and the core AppConfig section.
datetime
Timezone-aware datetime display/edit helpers (stored values remain DateTime<Utc>).
db
Shared SeaORM database connection capability.
docs
Beginner guides and tutorials for building Lariv applications and plugins.
duration
Duration parsing and formatting for storage as nanoseconds (i64).
export
Export catalog capability — plugins register exportable DB tables.
genai
Shared Gemini HTTP client (used by LLM Assistant, Totschool AI workers, etc.).
grapesjs
GrapesJS registries capability — plugins register blocks, components, traits, and themes.
hooks
Deferred state-attachment and startup seed hooks.
html_form
Attribute-macro-backed HTML forms: HtmlForm + FormWidget.
http
Typed HTTP routing capability for Lariv apps.
layers
Compile-time view layer stack for request processing and page data assembly.
llm_tools
LLM tool registry capability — plugins register tools; assistant chat runs them.
migration
Database migration capability — plugins register SeaORM migrators; CLI runs them as one composite up.
picker
Type-safe FK / many-to-many picker responses.
plugin_install
Declarative plugin install helper — expands After* type aliases, InstallOutput, and install.
plugin_routes
Declarative plugin HTTP route registration — proc-macro generated tags and crate::http::RouteRegistrar.
plugins
Bundled Lariv plugins for standard web application capabilities.
rt
Process / thread runtime helpers for deep HList install/mount chains.
rune_env
Rune environment registry — plugins register bindings for assistant scripts.
tag
Type-level tagging for HList items and compile-time type equality.
template
Compile-time template registry for page types.
traits
HList manipulation traits for the capability system.
views
Runtime string→handler view registry for dynamic page dispatch.
web
HTTP response helpers for HTML pages, cookies, and HTMX-aware rendering.

Macros§

define_passthrough_cap
define_passthrough_cap_impl
CapStore<Tag, HNil, Value> that mounts as Tagged::new(items).
define_plugin_install
Generate the capability-stack install function and intermediate type aliases.
define_plugin_routes
Generate route tags, proof type, and RouteRegistrar hook.
define_register_apps
Register a dashboard app tile for a plugin.
define_register_export
Register an exportable table for a plugin.
define_register_items
Declare item tags and a Register* impl for a marker-style capability.
define_register_migrations
Register a plugin migrator via a local hook type.
define_replace_templates
Register a template hook that replaces tagged pages (and optionally prepends new ones).
impl_create_modal
Implement CreateModal for a swap key with typed GET/POST routes and form identity.
impl_picker_modal
Implement PickerModal pairing a picker dialog key with its inner table key.
swap_key
Declare a SwapKey type with a literal id.

Attribute Macros§

main
Attribute macro: run async fn main on a thread with a raised stack size.