Skip to main content

Crate sova

Crate sova 

Source
Expand description

Sova — Express-like HTTP framework for Rust.

Thin facade over sova-core plus optional plugin crates. Prefer prelude in application main; plugin authors use extend.

Modules§

extend
Extension API (handlers, bodies, Bind, …) — see sova_core::extend.
prelude
Everyday imports for application code.

Structs§

App
Application builder — thin wrapper over sova_core::App.
BoundApp
Bound app — serve / run return facade Result.
Cell
Shared Clone value with change notifications (tokio::sync::watch under the hood).
CheckResult
Outcome of one named check from App::run_checks.
ClientAddr
Peer address stored on each request for rate-limiting etc.
ConfigDoc
Full parsed sova.toml (raw root for plugins; profile name for overlays).
FormData
Parsed form body: text fields + file uploads (urlencoded or multipart).
Html
HTML body (text/html; charset=utf-8).
Json
JSON body (application/json).
LogConfig
Tracing install options (stdout and/or file).
MatchedRoute
Matched route path template (e.g. /users/:id), set after route match.
MatchedRouteCapture
Capture for root middleware: filled when a route matches (low-cardinality metrics).
NoContent
Empty 204 response.
OnUpgrade
Handle to finish an HTTP upgrade (e.g. WebSocket).
PluginMeta
Human-readable plugin metadata (CLI, docs, introspection).
PluginSdkVersion
Semantic version of the Plugin SDK (major.minor.patch).
RateLimitIdentity
Authenticated principal for rate-limit identity keys. Set by auth / passport when a user is hydrated; rate-limit falls back to IP if absent.
Redirect
HTTP redirect with explicit status.
Request
Incoming HTTP request with Express-style helpers.
RequestId
Per-request correlation id (inbound x-request-id or generated).
Response
Express-style HTTP response.
Router
Express-style router. Return from modules and app.mount("/blog", routes()).
Server
Compiled app ready to handle requests without recompiling the router.
Shutdown
Unified shutdown signal for BackgroundServices.
Slot
One-item ownership handoff between tasks (sockets, streams, anything non-Clone).
Static
Mount a directory behind Express-style routes (mount + mount/*path).
TestClient
Test client over a compiled Server, always tracking cookies.
Text
Plain text (text/plain; charset=utf-8).
Upload
One uploaded file (or any multipart part with a filename).
UploadRules
Per-file constraints for Upload::validate.

Enums§

AppError
Unified handler / main error for apps that use the sova facade.
CheckKind
Kind of app check — readiness probes vs deploy-time audits.
Error
Framework and application errors mapped to HTTP responses.
Http
HTTP protocol mode for a bound app.
LogRotate
How to rotate the log file when LogConfig::file is set.

Constants§

PLUGIN_SDK_VERSION
Current Plugin SDK version (author-facing surface, not crate semver).

Traits§

BackgroundService
Long-running work started after on_startup, stopped after connection drain.
IntoResponse
Convert a value into an HTTP response.
Plugin
Single extension trait for the framework.
ResponseAssert
Fluent assertions for HTTP responses in tests.

Functions§

ensure_request_id
Set RequestId from x-request-id or generate one (idempotent).
init_tracing
Install a default tracing subscriber (LogConfig::from_env).
logger
Request logger (method, path, status, latency_ms, optional request_id).
referer_or
Referer header value, or fallback when absent/empty.
request_id
Ensure RequestId, echo x-request-id, wrap in an http.server span.
with_state
Middleware with owned state — hides the Arc::clone dance.

Type Aliases§

Next
Call the rest of the middleware / handler chain.
Result
Facade result type (Result<T, AppError>).