Expand description
Sova core — App, Router, Request, Response, middleware, server.
§Request path
accept → server/conn → to_sova_request → CompiledRouter::dispatch
→ root middleware → matchit → route middleware → handler → IntoResponse
→ hyper response.
§Public surface
This crate root exports names used by applications. Plugin authors and
advanced integrations use extend.
Product docs: https://s00d.github.io/sova/ (VitePress guide /guide/concepts).
Modules§
- extend
- Extension / plugin-author API (handlers, bodies, route introspection, …).
- html
- HTML string helpers for plugins that mutate
text/htmlresponses.
Structs§
- App
- Thin wrapper over
Routerplus server settings and lifecycle hooks. - Bound
App - App + bind target + optional programmatic shutdown.
- Cell
- Shared
Clonevalue with change notifications (tokio::sync::watchunder the hood). - Check
Result - Outcome of one named check from
App::run_checks. - Client
Addr - Peer address stored on each request for rate-limiting etc.
- Config
Doc - Full parsed
sova.toml(raw root for plugins; profile name for overlays). - Form
Data - Parsed form body: text fields + file uploads (urlencoded or multipart).
- Html
- HTML body (
text/html; charset=utf-8). - Installed
Plugin - Snapshot of an installed plugin (for CLI / introspection).
- Json
- JSON body (
application/json). - LogConfig
- Tracing install options (stdout and/or file).
- LogRecord
- Structured log event for external sinks (Elasticsearch, …).
- Matched
Route - Matched route path template (e.g.
/users/:id), set after route match. - Matched
Route Capture - 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).
- Plugin
Meta - Human-readable plugin metadata (CLI, docs, introspection).
- Plugin
SdkVersion - Semantic version of the Plugin SDK (
major.minor.patch). - Rate
Limit Identity - 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.
- Request
Id - Per-request correlation id (inbound
x-request-idor 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). - Text
- Plain text (
text/plain; charset=utf-8). - Upgrade
Permit - Holds one slot in
max_upgraded_connectionsuntil dropped. - Upload
- One uploaded file (or any multipart part with a filename).
- Upload
Rules - Per-file constraints for
Upload::validate.
Enums§
- Check
Kind - 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::fileis set. - SdkCompat
- Result of comparing a plugin’s declared SDK against core.
Constants§
- PLUGIN_
SDK_ VERSION - Current Plugin SDK version (author-facing surface, not crate semver).
Traits§
- Background
Service - Long-running work started after
on_startup, stopped after connection drain. - Into
Response - Convert a value into an HTTP response.
- Plugin
- Single extension trait for the framework.
Functions§
- add_
log_ event_ hook - Append a global log sink (DevTools, Elasticsearch, …). Multiple hooks are supported.
- after
- Run
fon the response after the rest of the chain. - around
beforethen chain thenafterunder one explain name.- before
- Run
fon the request before the rest of the chain. - check_
plugin_ sdk - Compare
pluginSDK declaration againstcore(PLUGIN_SDK_VERSION). - current_
request_ id - Request id for the current async task (set by
request_idmiddleware). - ensure_
request_ id - Set
RequestIdfromx-request-idor generate one (idempotent). - ensure_
tracing - Install a default subscriber unless one is already set or
SOVA_LOG=off. - logger
- Request logger (
method,path,status,latency_ms, optionalrequest_id). - logger_
skip_ path - Skip access-log lines for paths that equal or start with
prefix(e.g."/_devtools"matches/_devtools/config). - logger_
skip_ paths - Register several skip prefixes (see
logger_skip_path). - map_
html - After the handler: map buffered
text/htmlbodies withtransform. - parse_
log_ rotate - Parse rotate mode string (
size/daily/never). - referer_
or Refererheader value, orfallbackwhen absent/empty.- request_
id - Ensure
RequestId, echox-request-id, wrap in anhttp.serverspan. - set_
log_ event_ hook - Register a global log sink hook. Prefer
add_log_event_hookwhen multiple sinks may coexist. ReturnsErr(hook)only if an older single-hook API path reserved the slot — with the multi-hook registry this always succeeds viaadd_log_event_hook. - with_
state - Middleware with owned state — hides the
Arc::clonedance.
Type Aliases§
- LogEvent
Hook - Callback invoked for every tracing event (after the local fmt layers).
- Next
- Call the rest of the middleware / handler chain.
- Result