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 customization options 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 from same-origin /static/js/ routes
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, and optional multipart support).
  • health – Compatibility alias for readiness plus legacy health helpers.
  • middleware – Built-in middleware (request IDs).
  • pagination – Standardized page/size extractor and response wrapper.
  • prelude – Glob import for the most common types.

§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 channels::Broadcast;
pub use channels::BroadcastError;
pub use channels::BroadcastPayload;
pub use channels::ChannelBackendConfigError;
pub use channels::ChannelMessage;
pub use channels::ChannelPublishError;
pub use channels::ChannelStats;
pub use channels::Channels;
pub use channels::ChannelsBackend;
pub use channels::LocalChannelsBackend;
pub use plugin::Plugin;
pub use plugin::Plugins;
pub use repository::RepositoryError;
pub use hooks::DraftField;
pub use hooks::FieldDiff;
pub use hooks::MutationContext;
pub use hooks::MutationHooks;
pub use hooks::MutationOp;
pub use hooks::NoHooks;
pub use hooks::Patch;
pub use hooks::UpdateDraft;
pub use paths::PathExt;
pub use form::Changeset;
pub use form::ChangesetForm;
pub use form::IntoChangeset;
pub use app::app;
pub use db::Db;
pub use error::AutumnError;
pub use error::AutumnResult;
pub use pagination::Page;
pub use pagination::PageRequest;
pub use pagination::CursorPage;
pub use pagination::CursorRequest;
pub use validation::Valid;
pub use validation::Validated;
pub use mail::Mail;
pub use mail::MailConfig;
pub use mail::MailDeliveryQueue;
pub use mail::MailDeliveryQueueHandle;
pub use mail::MailError;
pub use mail::MailTransport;
pub use mail::Mailer;
pub use mail::SmtpConfig;
pub use mail::TlsMode;
pub use mail::Transport;
pub use validation::ValidateExt;
pub use auth::ApiToken;
pub use auth::RequireApiToken;
pub use auth::DbApiTokenStore;
pub use auth::API_TOKEN_MIGRATIONS;
pub use crate::extract::Json;
pub use crate::extract::Path;
pub use crate::extract::Form;
pub use crate::extract::Query;

Modules§

actuator
Actuator endpoints for operational observability.
app
Application builder – the entry point for configuring and running an Autumn server.
assets
Fingerprinted asset pipeline for cache-busted static file delivery.
audit
Structured audit logging with pluggable sinks.
auth
Authentication utilities for Autumn applications.
authorization
Policy-based record-level authorization.
cache
Caching infrastructure for the Autumn framework.
channels
Named broadcast channel registry for real-time messaging.
config
Framework configuration with sensible defaults and profile-based layering.
db
Database connection pool and extractor.
error
Framework error type and result alias.
error_pages
Styled error pages and dev-mode error badge overlay.
extract
Re-exports of Axum extractors for use in Autumn handlers.
flash
Flash messages for Autumn applications.
form
Changeset-style form helpers with validation and Maud rendering.
health
Compatibility health endpoint.
hooks
Mutation hook types for repository lifecycle callbacks.
i18n
Locale-aware text resolution (opt-in via the i18n feature flag).
job
On-demand background job infrastructure.
mail
Transactional email support.
middleware
Built-in middleware for Autumn applications.
migrate
Database migration support.
openapi
OpenAPI (Swagger) specification auto-generation.
pagination
Standardized pagination primitives.
paths
Typed path helpers and the PathExt fluent query-string builder.
plugin
Plugin trait for composable Autumn integrations.
plugin_conformance
Plugin conformance checks for Autumn plugin authors.
prelude
Convenience re-exports for Autumn applications.
probe
Liveness, readiness, and startup probes.
reexports
Re-exports of upstream crates used in macro-generated code.
repository
Repository error types for framework-generated CRUD operations.
route_listing
Route listing types and collection logic for autumn routes.
scheduler
Scheduled-task coordination backends.
security
Spring Security-style protection for Autumn applications.
seed
Seed context for populating databases with representative data.
session
Cookie-based session management for Autumn applications.
sse
Server-Sent Events (SSE) support for Autumn applications.
static_gen
Static site generation support. Static Site Generation (SSG) and Incremental Static Regeneration (ISR).
storage
Pluggable file storage backends for Autumn applications.
system_info
System information plugin.
task
Scheduled task infrastructure.
telemetry
Telemetry runtime planning and subscriber initialization.
test
First-party integration-testing utilities for Autumn applications.
ui
Shared UI primitives for framework-owned HTML surfaces.
validation
Validation support via the validator crate.
webhook
Signed webhook intake for third-party callbacks.
ws
WebSocket support for Autumn applications.

Macros§

add_blob_column
Build the (up, down) SQL pair to add or drop a Blob column on an existing Postgres table.
html
Type-safe HTML templating macro.
jobs
Collect #[job] handlers into a Vec<JobInfo>. Collect #[job] handlers into a Vec<JobInfo>.
mail_previews
Collect mailer preview registrations into an AppBuilder. Collect #[mailer_preview] impl blocks into runtime preview registrations.
one_off_tasks
Collect #[task] handlers into a Vec<task::OneOffTaskInfo>. Collect #[task] handlers into a Vec<OneOffTaskInfo>.
paths
Emit a pub mod paths { … } re-exporting typed path helpers.
routes
Collect route-annotated handlers into a Vec<Route>.
static_params
Convenience macro for building a StaticParams map.
static_routes
Collect #[static_get] handlers into a Vec<StaticRouteMeta>. Collect #[static_get] handlers into a Vec<StaticRouteMeta>.
t
Translation lookup macro with compile-time key validation.
tasks
Collect #[scheduled] task handlers into a Vec<TaskInfo>. Collect #[scheduled] task handlers into a Vec<TaskInfo>.

Structs§

AppState
Shared application state passed to all route handlers.
PreEscaped
Wrap a pre-escaped string so Maud renders it verbatim.
Redirect
HTTP redirect response.
RepositoryApiMeta
Metadata attached to routes emitted by the #[repository(api = ...)] macro.
Route
A single route binding an HTTP method + path to an Axum handler.
State
State extractor. Re-exported from Axum. Extractor for state.

Constants§

HTMX_CSRF_JS_PATH
htmx version string embedded in the binary.
HTMX_JS_PATH
htmx version string embedded in the binary.
HTMX_VERSION
htmx version string embedded in the binary.

Type Aliases§

Markup
Rendered HTML fragment produced by the html! macro.

Attribute Macros§

api_doc
Enrich a route handler’s auto-generated OpenAPI documentation.
authorize
Enforce a record-level Policy before a handler runs. Coexists with secured: #[secured] answers “are you in?”, #[authorize] answers “are you allowed to act on this record?”
cached
Cache the return value of a function based on its arguments.
delete
Annotate an async function as a DELETE route handler.
get
Annotate an async function as a GET route handler.
job
Declare an on-demand background job. See job module. Declare an on-demand background job.
mailer
Generate ergonomic send_* and deliver_later_* helpers for mailer impls. Generate send_* and deliver_later_* helpers for a mailer impl block.
mailer_preview
Register zero-argument mail template previews for the dev mail UI. Register zero-argument mail preview methods for the dev mail preview UI.
main
Set up the Tokio async runtime for an Autumn application.
model
Derive Diesel and Serde traits for a database model struct.
oauth2_callback
Annotate an OAuth2/OIDC callback handler.
patch
Annotate an async function as a PATCH route handler.
post
Annotate an async function as a POST route handler.
put
Annotate an async function as a PUT route handler.
repository
Derive a repository with CRUD operations and derived queries.
scheduled
Declare a scheduled background task. See task module. Declare a scheduled background task.
secured
Secure a route handler with authentication and optional role checks.
service
Define a service for cross-model orchestration and non-DB side effects.
static_get
Annotate an async function as a statically pre-rendered GET route.
task
Declare a one-off operational task. See task::OneOffTaskInfo. Declare a one-off operational task runnable with autumn task <name>.
ws
Annotate an async function as a WebSocket route handler.