Skip to main content

Crate autumn_web

Crate autumn_web 

Source
Expand description

§Autumn

An opinionated, convention-over-configuration web framework for Rust.

Autumn assembles proven Rust crates (Axum, Maud, Diesel, htmx, Tailwind) into a Spring Boot-style developer experience with proc-macro-driven conventions and escape hatches at every level.

§Quick start

use autumn_web::prelude::*;

#[get("/")]
async fn index() -> Markup {
    html! { h1 { "Hello, Autumn!" } }
}

#[autumn_web::main]
async fn main() {
    autumn_web::app()
        .routes(routes![index])
        .run()
        .await;
}

§Architecture overview

LayerCratePurpose
HTTP serverAxumRouting, extractors, middleware
HTML templatesMaudType-safe, compiled HTML via html! macro
DatabaseDieselAsync Postgres via diesel-async + deadpool
Client interactivityhtmxEmbedded JS served at /static/js/htmx.min.js
StylingTailwind CSSDownloaded + managed by autumn-cli

§Modules

  • app – Application builder for configuring and launching the server.
  • config – Layered configuration: defaults, autumn.toml, env overrides.
  • db – Database connection pool and the Db request extractor.
  • error – Framework error type (AutumnError) and result alias.
  • extract – Re-exported Axum extractors (Form, Json, Path, Query).
  • health – Auto-mounted health check endpoint.
  • logging – Structured logging via tracing-subscriber.
  • middleware – Built-in middleware (request IDs).
  • prelude – Glob import for the most common types.
  • route – Route descriptor used by macro-generated code.

§Zero-config defaults

An Autumn app runs out of the box with no configuration file. Every setting has a sensible default (port 3000, info log level, etc.). Override via autumn.toml or AUTUMN_* environment variables. See config::AutumnConfig for the full list.

Re-exports§

pub use app::app;
pub use db::Db;
pub use error::AutumnError;
pub use error::AutumnResult;

Modules§

app
Application builder – the entry point for configuring and running an Autumn server.
config
Framework configuration with sensible defaults.
db
Database connection pool and extractor.
error
Framework error type and result alias.
extract
Re-exports of Axum extractors for use in Autumn handlers.
health
Health check endpoint.
logging
Structured logging initialization via tracing-subscriber.
middleware
Built-in middleware for Autumn applications.
prelude
Convenience re-exports for Autumn applications.
reexports
Re-exports of upstream crates used in macro-generated code.
route
Route descriptor types used by macro-generated code.

Macros§

html
Type-safe HTML templating macro.
routes
Collect route-annotated handlers into a Vec<Route>.

Structs§

AppState
Shared application state passed to all route handlers.
Json
JSON request body extractor and response type.
PreEscaped
Wrap a pre-escaped string so Maud renders it verbatim.

Constants§

HTMX_VERSION
htmx version string embedded in the binary.

Type Aliases§

Markup
Rendered HTML fragment produced by the html! macro.

Attribute Macros§

delete
Annotate an async function as a DELETE route handler.
get
Annotate an async function as a GET route handler.
main
Set up the Tokio async runtime for an Autumn application.
model
Derive Diesel and Serde traits for a database model struct.
post
Annotate an async function as a POST route handler.
put
Annotate an async function as a PUT route handler.