crates.io ↗

iet-stack-web-axum

stack preset official

Names the web wiring once so applications do not repeat it; the RestApi builder stays as the escape hatch.

CoreFeaturesIntegrationsStacksTooling
Used byno framework crate yetexamples/htmx-starterexamples/skills-only-appexamples/skills-only-app-task-tracker
iet-stack-web-axumpresetWeb composition preset
Depends oniet-http-axumcontract

How to use it

This crate is a backend-neutral composition preset: it re-exports iet_http_axum::RestApi as WebStack, so no listener or providers are installed and the existing builder stays the escape hatch. Applications build a WebStack with rate-limiting policy, hand it to an auth stack's register, add their own modules, and call finish(state) to obtain the axum::Router passed to the HTTP host.

rust
// examples/htmx-starter/servers/web/src/main.rs
use iet_stack_web_axum::WebStack;

let mut stack = WebStack::new()
    .rate_limit(limiter)
    .rate_limits_enabled(load_test_config.rate_limits_enabled);
// ...
let api = AuthStack::login(services.clone(), csrf.clone())
    .account(services.clone())
    .configuration(config)
    .register(stack)?; // the stack is the RestApi the auth stack mounts onto
let router = api
    .module("tasks", task_adapter_htmx::routes())?
    .finish(task_adapter_htmx::AppState { /* ... */ });
  • rate_policy(name, RateLimitConfig::fixed(limit, window)) registers a named limit before modules are added.
  • module(name, Router) and finish(state) come from RestApi; WebStack adds nothing on top of them.

How it works

It is a compile-time alias: pub use iet_http_axum::RestApi as WebStack; means every method and the resulting type are the upstream ones, so the crate installs no listener, state, or providers of its own.

flowchart LR
  W["WebStack"] -->|re-exports| R["iet_http_axum::RestApi"]
  R --> B["new + rate_limit + rate_policy"]
  B --> G["AuthStack register"]
  G --> M["module name Router"]
  M --> F["finish state"]
  F --> X["axum::Router"]

What it implements

  • Concrete mechanism; see the public API below.

What's inside

Modules

  • src/lib.rs

Public API

Depends on

Used by

  • No other framework crate depends on it directly.

In this repository

  • examples/htmx-starter
  • examples/skills-only-app
  • examples/skills-only-app-task-tracker

Source: crates/stacks/iet-stack-web-axum