Expand description
Arcature — an opinionated full-stack Rust web framework.
One package, batteries included. cargo add arcature is enough for the
canonical generated application: HTTP routing, native Inertia, database,
auth, validation, cache, storage, mail, jobs, events, and the arc CLI.
§Quick start
ⓘ
use arcature::prelude::*;
#[arcature::main]
async fn main() -> Result<()> {
Application::new()
.routes(Routes::new([Route::get("/", index).name("home")]))
.run()
.await
}
async fn index() -> Result<Response> {
Ok(text(StatusCode::OK, "hello"))
}§Philosophy
Arcature integrates proven wheels (Axum, Tower, Tokio, SeaORM, SQLx, Inertia, OpenDAL, lettre, tracing) and owns the developer experience: the application lifecycle, conventions, integration, and a coherent vocabulary. The raw Axum/Tower/SeaORM escape hatches stay available for when the framework’s opinions run out.
Re-exports§
pub use application::Application;pub use application::ApplicationBuilder;pub use application::EngineError;pub use application::Lifecycle;pub use application::LifecycleState;pub use application::Resources;pub use http::json;apiorinertiapub use http::RedirectResponse;pub use http::no_content;pub use http::redirect;pub use http::text;pub use routing::IntoRoutes;pub use routing::Middleware;pub use routing::Next;pub use routing::Route;pub use routing::RouteGroup;pub use routing::RouterState;pub use routing::Routes;pub use dx::Bound;apianddatabaseanddxpub use dx::ApplicationGraph;dxpub use dx::ControllerMetadata;dxpub use dx::ControllerMethod;dxpub use dx::Empty;dxpub use dx::FieldShape;dxpub use dx::GraphError;dxpub use dx::Inject;dxpub use dx::Json;dxpub use dx::ModuleDescriptor;dxpub use dx::ModuleNode;dxpub use dx::Page;dxpub use dx::Provider;dxpub use dx::RequestCacheDescriptor;dxpub use dx::RequestMetadata;dxpub use dx::Resolve;dxpub use dx::ResourceMetadata;dxpub use dx::RouteDescriptor;dxpub use dx::RouteMethod;dxpub use dx::Service;dxpub use dx::page;dxpub use dx::Command;dxpub use dx::CommandError;dxpub use dx::CommandFuture;dxpub use dx::CommandRegistry;dxpub use dx::CommandBinding;dxpub use dx::JobBinding;dxpub use dx::DbFromState;databaseanddxpub use dx::RouteModel;databaseanddxpub use dx::RequestCache;dxpub use dx::RequestCacheKey;dxpub use inertia::AssetVersion;inertiapub use inertia::Inertia;inertiapub use inertia::InertiaConfig;inertiapub use inertia::InertiaError;inertiapub use inertia::InertiaLayer;inertiapub use inertia::InertiaRequest;inertiapub use inertia::RootDocument;inertiapub use inertia::ScriptBody;inertiapub use inertia::default_root_document;inertiapub use inertia::vite_root_document;inertiapub use database::DatabaseConfig;databasepub use database::Db;databasepub use auth::Auth;authpub use auth::AuthError;authpub use auth::AuthManager;authpub use auth::AuthUser;authpub use auth::AuthzError;authpub use auth::CsrfConfig;authpub use auth::CsrfConfigError;authpub use auth::CsrfError;authpub use auth::CsrfLayer;authpub use auth::CsrfToken;authpub use auth::Current;authpub use auth::Flash;authpub use auth::FlashError;authpub use auth::FlashLevel;authpub use auth::FlashMessage;authpub use auth::LoginBuilder;authpub use auth::OptionalAuth;authpub use auth::OptionalCurrent;authpub use auth::PasswordHashError;authpub use auth::PasswordHashString;authpub use auth::PasswordHasher;authpub use auth::PasswordSecret;authpub use auth::PasswordVerifyError;authpub use auth::Policy;authpub use auth::RehashOutcome;authpub use auth::SameSite;authpub use auth::Session;authpub use auth::SessionBuildError;authpub use auth::SessionConfig;authpub use auth::SessionConfigError;authpub use auth::SessionError;authpub use auth::SessionKey;authpub use auth::SessionLayer;authpub use auth::SigningKeyReason;authpub use auth::UserLoader;authpub use auth::verify_password;authpub use validation::Request;validationpub use validation::Validated;validationpub use validation::ValidatedForm;validationpub use validation::ValidatedJson;validationpub use validation::ValidatedPath;validationpub use validation::ValidatedQuery;validationpub use validation::validate_or_problem;validationpub use validation::validation_problem;validationpub use validation::rejection::from_form_rejection;validationpub use validation::rejection::from_json_rejection;validationpub use validation::rejection::from_path_rejection;validationpub use validation::rejection::from_query_rejection;validationpub use cache::Cache;cachepub use cache::CacheConfig;cachepub use cache::CacheConfigError;cachepub use cache::CacheConnectError;cachepub use cache::CacheError;cachepub use cache::CacheHealthError;cachepub use cache::Namespace;cachepub use storage::Disk;storage-fspub use storage::FsConfig;storage-fspub use storage::S3Config;storage-fspub use storage::Storage;storage-fspub use storage::StorageBuilder;storage-fspub use storage::StorageConfig;storage-fspub use storage::StorageConfigError;storage-fspub use storage::StorageConnectError;storage-fspub use storage::StorageError;storage-fspub use storage::StoragePath;storage-fspub use storage::StoragePathError;storage-fspub use mail::Email;mailpub use mail::EmailAttachment;mailpub use mail::EmailError;mailpub use mail::Mail;mailpub use mail::MailBuilder;mailpub use mail::MailConfigError;mailpub use mail::MailSendError;mailpub use mail::Mailable;mailpub use mail::Mailer;mailpub use mail::SmtpConfig;mailpub use mail::SmtpCredentials;mailpub use mail::TlsMode;mailpub use jobs::ClaimedJob;jobspub use jobs::DEFAULT_MAX_PAYLOAD_BYTES;jobspub use jobs::EnqueueError;jobspub use jobs::EnqueuedJob;jobspub use jobs::Job;jobspub use jobs::JobError;jobspub use jobs::JobModel;jobspub use jobs::JobRequest;jobspub use jobs::JobStatus;jobspub use jobs::Jobs;jobspub use jobs::MigrateError;jobspub use jobs::RegisterError;jobspub use jobs::Registry;jobspub use jobs::RetryPolicy;jobspub use jobs::ScheduleBinding;jobspub use jobs::ScheduleCadence;jobspub use jobs::Scheduler;jobspub use jobs::SchedulerError;jobspub use jobs::Worker;jobspub use jobs::WorkerBuilder;jobspub use jobs::WorkerConfig;jobspub use jobs::WorkerError;jobspub use events::DispatchError;eventspub use events::Dispatcher;eventspub use events::Event;eventspub use events::ListenerBinding;eventspub use realtime::Broadcast;realtimepub use realtime::SseEndpoint;realtimepub use realtime::WebSocketEndpoint;realtimepub use api::PROBLEM_JSON;pub use api::Problem;pub use api::ProblemBuilder;pub use api::ProblemKind;pub use observe::RequestId;observepub use axum;pub use sea_orm;databasepub use validator;validationpub use serde_json;
Modules§
- api
- API subsystem: RFC 9457 problem details and typed API responses.
- application
- The application composition root and lifecycle.
- assets
- Static assets: the Vite manifest, and serving
public/. - auth
auth - Authentication, sessions, authorization policies, password hashing, and CSRF protection.
- cache
cache - Cache subsystem: Valkey/Redis key-value cache over one multiplexed
connection, with the
Cache::remembercache-aside facade. - cli
cli - The
arcCLI entry point. - config
- Application configuration.
- database
database - Database: one pool, two first-class paths (SeaORM + SQLx).
- dev_
proxy dev-proxy - The one-TCP-port development proxy (AP2.1-3).
- dx
dx - The Arcature application DX layer.
- events
events - In-process typed event dispatch.
- http
- HTTP response vocabulary and helpers shared by all subsystems.
- inertia
inertia - Native Inertia.js server protocol.
- jobs
jobs - Durable background jobs on PostgreSQL, SQLite, or MySQL.
- mail
mail - Mail subsystem: SMTP mail over lettre, with the
Mail::to(...).send(...)facade. - observe
observe - Observability: request IDs, access logging, JSON logs, metrics, trace context, and the OpenTelemetry pipeline.
- pages
pages - Static pages, assets, and the root HTML document.
- prelude
- The curated Arcature prelude.
- proxy
- Pre-routing proxy — application-owned global request policy (engine spec §4/§5). One responsibility per file (AGENTS.md §1).
- realtime
realtime - Realtime WebSocket + SSE wrappers over axum.
- routing
- HTTP routing.
- storage
storage-fs - Storage subsystem: object/file storage over OpenDAL, with a named-disk
registry and the
Storage::disk(name).put(...)facade. - templates
templates - The canonical application templates and generator.
- uag
uag - The Unified Application Graph.
- validation
validation - Request validation built on the
validatorcrate, integrated with Axum and RFC 9457 problem responses.
Macros§
- application
dxandmacros application! { pub App { .. } }— seeapplication/mod.rs.- inertia
inertia - The
inertia!()macro renders an Inertia page with named props. - module
dxandmacros module! { pub Accounts { .. } }— seemodule/mod.rs.- page_
macro dxandmacros page_macro!(ShowUserPage { .. })— seepage_macro.rs. Namedpage_macrorather thanpagebecause attribute and function-like macros share one namespace, and#[page("name")]already ownspage.- redirect
dxandmacros redirect!(route::...)— seeredirect.rs.- routes
dxandmacros routes! { pub app { .. } }— seeroutes/mod.rs.
Structs§
- Validation
Error - A single validation failure, keyed by the offending field path.
Enums§
- Error
- The single error type returned by Arcature framework code and the
Result<T>alias used across the public API.
Constants§
- FRAMEWORK_
VERSION - The Arcature framework version, as
MAJOR.MINOR.PATCH.
Traits§
- Deserialize
apiorauthordatabaseoreventsorinertiaorjobsorpagesorvalidation - A data structure that can be deserialized from any data format supported by Serde.
- DxComponent
- The base trait that gives a framework component (job, event, etc.) its
static name, used for dispatch lookup and inspection. Always available;
the
#[job]and#[derive(Event)]macros generateimpl DxComponent. - Serialize
apiorauthordatabaseoreventsorinertiaorjobsorpagesorvalidation - A data structure that can be serialized into any data format supported by Serde.
Functions§
- any
- Route requests with the given handler regardless of the method.
- bad_
request - Shorthand for a bad-request error.
- delete
- Route
DELETErequests to the given handler. - forbidden
- Shorthand for a forbidden error.
- from_fn
- Create a middleware from an async function.
- get
- Route
GETrequests to the given handler. - head
- Route
HEADrequests to the given handler. - not_
found - Shorthand for a not-found error.
- options
- Route
OPTIONSrequests to the given handler. - patch
- Route
PATCHrequests to the given handler. - post
- Route
POSTrequests to the given handler. - put
- Route
PUTrequests to the given handler.
Type Aliases§
- Result
- The framework
Resultalias. Every public Arcature function that can fail returnsResult<T>(theTvaries), so a controller writesResult<Response>.
Attribute Macros§
- command
dxandmacros #[command("name")]— seecommand.rs.- controller
dxandmacros #[controller]— seecontroller.rs.- job_
handler dxandmacros #[job_handler]— seejob_handler.rs.- listener
macros #[listener(Event)]— seelistener.rs.- main
macros - Marks async function to be executed by the selected runtime. This macro
helps set up a
Runtimewithout requiring the user to use Runtime or Builder directly. - middleware
dxandmacros #[middleware]— seemiddleware.rs.- model
macros #[model(table = "users")]— seemodel.rs.- page
dxandmacros #[page("users/show")]— seepage.rs.- policy
dxandmacros #[policy(Model)]— seepolicy.rs.- provider
dxandmacros #[provider]— seeprovider.rs.- request
macros #[request]— seerequest.rs.- request_
cache dxandmacros #[request_cache(name = "...", key = "...")]— seerequest_cache.rs.- resource
dxandmacros #[resource]— seeresource.rs.- route_
model dxandmacros #[route_model(entity = ..., key_type = ...)]— seeroute_model.rs.- service
dxandmacros #[service]— seeservice.rs.
Derive Macros§
- Deserialize
apiorauthordatabaseoreventsorinertiaorjobsorpagesorvalidation - DxComponent
dxandmacros #[derive(DxComponent)]— seecomponent.rs.- Event
macros #[derive(Event)]— seeevent.rs.- Job
macros #[derive(Job)]— seejob.rs.- Serialize
apiorauthordatabaseoreventsorinertiaorjobsorpagesorvalidation