# API Reference

> Quick-reference index of all major public types in rust-web-server, grouped by area.

Source: https://rws8.tech/docs/reference/api/ · Last updated 2026-11-10

Full rustdoc documentation is published at [docs.rs/rust-web-server](https://docs.rs/rust-web-server).

This page is a quick-reference index — click through to docs.rs for the complete method-level API. Module paths are relative to `rust_web_server::`; a feature in parentheses means the item is compiled only with that Cargo feature.

## Application layer

| Type / Trait | Module | Description |
|---|---|---|
| `Application` | `application` | Trait implemented by all app types: `execute(&Request, &ConnectionInfo) -> Result<Response, String>`. `runs_inline(request, connection)` (default `false`) lets the async servers run a request on the event loop instead of the blocking pool — only for work that never waits. `registered_routes()` / `middleware_names()` (default empty, 18.28.0) describe the app for tools; wrappers forward them. See [Async handlers](/building-apps/async-handlers/) |
| `AsyncResponse` | `application` (`http2`) | Return type of the optional `Application::execute_async`, awaited on the connection's task instead of holding a blocking-pool thread |
| `Controller` | `controller` | Trait with `is_matching(request, connection)` and `process(request, response, connection)`. See [Controllers](/building-apps/controllers/) |
| `App` | `app` | Zero-config application with all built-in controllers. `App::with_config(ServerConfig)` pins it to a fixed config (no env reads per request — the lock-free pattern for parallel tests) |
| `AppWithState<S>` | `state` | State-aware app with `.get/.post/.put/.patch/.delete` route builders; state shared as `Arc<S>`. Entry point `App::with_state(S)`; `.with_config(ServerConfig)` pins the fallback `App`. See [State](/building-apps/state/) |
| `AsyncAppWithState<S>` | `async_state` (`http2`) | Same with `async fn` handlers. Entry point `App::with_async_state(S)` |
| `Middleware` | `middleware` | Layer trait: `handle(request, connection, next)`. `runs_inline` / `is_passthrough` (default `false`) declare a layer non-blocking or a no-op for a request. `layer_name()` (default: the type's name, 18.28.0) is how tools list it. See [Middleware](/building-apps/middleware/) |
| `WithMiddleware<A>` | `middleware` | Wraps any `Application` with a layer stack; `app.wrap(layer)`, first-pushed is outermost |
| `k8s::client` / `k8s::config::ConfigWatch` / `k8s::config::resolve` | `k8s` (`k8s`) | A Kubernetes client (in-cluster or kubeconfig); a ConfigMap's or Secret's data kept current by a watch (`get`, `on_change`, `apply_to_env`); `k8s://ns/name#key` secrets (18.35.0). See [Using the Kubernetes API](/deployment/kubernetes-api/) |
| `k8s::discovery::service_endpoints` / `k8s::leader::LeaderElector` | `k8s` (`k8s`) | A Service's ready endpoints as a `BackendPool`; leader election over a Lease (`handle`, `wait_until_leader`, `release`) (18.35.0) |
| `k8s::controller::{Controller, Operator, Context}` | `k8s` (`k8s`) | Controllers (`reconcile`, `owns`, `finalizer`, `on_error`) run by an `Operator` (leader election, metrics, readiness); `Context::patch_status`, `apply_owned`, `event` (18.35.0). See [Operators](/deployment/kubernetes-operators/) |
| `k8s::webhook::{Webhooks, WebhookCertificate}` | `k8s` (`k8s`) | Validating, mutating and conversion webhooks as an rws app; a CA + serving certificate, `install`, `patch_ca_bundle` (18.35.0) |
| `k8s::manifests` (`Rbac`, `Rule`, `crd`, `webhook_configuration`, `to_yaml`, `print_on_request`) | `k8s` (`k8s`) | CRDs, RBAC and webhook configurations from the code (18.35.0) |
| `k8s::testing::{TestCluster, TestNamespace, eventually}` | `k8s` (`k8s`) | Tests against a real API server from `RWS_TEST_KUBECONFIG`, a namespace per test (18.35.0) |
| `generator::plan_deploy` / `DeploySpec` | `generator` | `rws gen deploy`: Kubernetes manifests for the app (18.35.0). See [Generate the manifests](/deployment/kubernetes/#generate-the-manifests) |
| `health` (`Probe`, `Registry`, `Report`) | `health` | Liveness, readiness and startup checks for `/livez`, `/readyz`, `/startupz`: `readiness(name, f)`, `liveness`, `startup`, `register_async`, `database(name, pool)`, `report`, `set_timeout` (18.35.0). See [Health checks](/deployment/kubernetes/#health-checks) |
| `Container` | `di` | `TypeId`-keyed dependency injection container: `register::<T>`, `provide::<dyn Trait>`, `*_named`, `get`. Pass it directly to `App::with_state(container)` — not `into_arc()`, which double-wraps. See [Dependency injection](/building-apps/dependency-injection/) |
| `Lifecycle` | `di` | `start`/`stop` for services registered with `Container::register_managed`; `Container::on_start`/`on_stop`/`start`/`stop`/`is_started` (18.35.0). See [Lifecycle hooks](/building-apps/dependency-injection/#lifecycle-hooks) |
| `ErrorPages` | `error_pages` | Middleware: panics and app errors as a detailed page / problem details in `dev`/`test`, a bare `500` in `prod` (`from_env`, `detailed`) (18.35.0). See [Error pages](/building-apps/error-handling/#error-pages) |
| `ValueCache<V>` | `cache` | In-memory values with per-entry TTL: `fetch_or`, `try_fetch_or`, `fetch_or_async`, `invalidate_prefix` (18.35.0). See [Caching values](/features/caching/#caching-values-fetch_or) |
| `AppManifest` | `app_manifest` | `rws.app.toml`, parsed: `name`, `paths`, `file`, `warnings`; `load(dir)` (conventional when absent; name from `Cargo.toml`), `parse(text)` / `FromStr`, `conventional(name)`, `layout(dir)` (18.28.0). See [Project layout](/building-apps/project-layout/) |
| `Generate` / `plan` / `Plan` | `generator` | `rws gen model|route|migration|test` as a library (18.29.0): `Generate::{Model, Route, Migration, Test}` (`Model`'s `timestamps` / `soft_delete`, 18.30.0), `plan(dir, &request)` reads the project and answers a `Plan` (`changes`, `notes`, `status()`, `has_conflicts()`, `render(diffs)`, `to_json(written)`), `Plan::apply(dir)` writes it — never overwriting a file; `run(args, out, err)` is the command line (`EXIT_OK`/`EXIT_CONFLICT`/`EXIT_USAGE`). See [Generators](/building-apps/generators/) |
| `plan_model_migration` / `ExistingColumns` | `generator` | The additive migration from the models to a database's tables and columns: `rws gen migration <name> --from-models` (18.35.0). See [Migrations from the models](/building-apps/generators/#migrations-from-the-models) |
| `db_cli::run` / `run_with_seeders` / `requested` | `db_cli` | `rws db migrate|rollback [N]|status|seed|schema` (18.30.0): `run(args, out, err)` answers the exit code (`EXIT_OK`, `EXIT_FAILED`, `EXIT_USAGE`); `--database-url` / `DATABASE_URL` / `RWS_DB_*`, `--dir`, `--migrations`, `--seeds`, `--json`; `run_with_seeders(args, &Seeders, out, err)` for an app's own binary, whose `db seed` runs Rust seeders after the SQL files. See [`rws db`](/database/migrations/#from-the-command-line-rws-db) |
| `FileChange` / `ChangeKind` / `GenError` | `generator` | One file of a plan (`path`, `kind` — `Create`, `Edit`, `Unchanged`, `Conflict` — `content`, `original`, `diff`); why a generator refused (`usage`, `message`, `to_json()`) |
| `Field` / `FieldType` / `BaseType` / `Db` / `RouteAction` | `generator` | `name:type` (`Field::parse`, `parse_fields`; types `i64`, `i32`, `f64`, `bool`, `String`, `Option<T>`); the database a migration is written for (`sqlite`, `postgres`, `mysql`); the routes `gen route` writes (`List`, `Show`, `Create`, `Update`, `Remove`; `parse_list("list,show")`) |
| `AppPaths` / `LayoutEntry` / `EntryKind` / `ManifestError` | `app_manifest` | Where each part lives (`main`, `lib`, `routes`, `models`, `jobs`, `migrations`, `templates`, `tests`, `static_files`; `Default` = the conventional layout; `entries()`, `get(role)`); one role as found on disk (`role`, `path`, `kind` file/dir, `exists`); a parse error (`line`, `message`) |
| `TeraEngine` | `template` (`tera`) | Jinja2-style templates: `from_dir`, `from_raw`; global `template::init(dir)` / `template::render(name, &ctx)` / `template::reload()` (also run on `SIGHUP`); view helpers `url_for`, `vite`, `vite_asset` and `template::page_context(request)` (flash, CSRF field, path; 18.35.0). See [Templates](/building-apps/templates/) |

## Macros

| Item | Module | Description |
|---|---|---|
| `routes!` | `macros` | Declarative routing table — builds `AppWithState`, `AsyncAppWithState` or `Router` from `METHOD "path" => handler` lines. See [Routing](/building-apps/routing/) |
| `#[route]`, `#[get]`, `#[post]`, `#[put]`, `#[patch]`, `#[delete]` | crate root (`macros`) | On a classic handler, a `Route:` doc comment; on one with extractor arguments (18.28.0), a unit struct implementing `handler::Handler`/`AsyncHandler`/`RouteSpec`, registered with `.route(h)`, the pattern's parameters checked against the `Path` argument at compile time. See [Routing](/building-apps/routing/#typed-handlers-get-with-extractors) |
| `#[derive(FromPath)]` | crate root (`macros`) | `handler::FromPath` for a struct with one `FromStr` field per route parameter, by name (18.28.0) |
| `#[derive(FromRequest)]` | crate root (`macros`) | Derives `FromRequest` for a named-field struct, extracting fields in order and stopping at the first error |
| `#[derive(JsonSchema)]` | crate root (`macros`) | Derives `schema::JsonSchema` for a named-field struct or unit enum, following its `#[serde]` renames (18.0.0). See [Typed tools](/mcp/tools/#typed-tools) |
| `#[derive(Validate)]` | crate root (`macros`) | Derives `Validate` from `#[validate(length, range, email, required, url)]` field annotations |
| `#[derive(Config)]` | crate root (`macros`) | Typed env-var binding: generates `load() -> Result<Self, String>`; `#[config(env, default, prefix)]`. See [Config binding](/features/config-binding/) |
| `#[derive(Model)]` | crate root (`macros` + a `model-*` feature) | Maps a struct to a table (`#[table]`, `#[primary_key(auto_increment)]`, `#[column]`, `#[ignore]`) and generates `T::repository(&pool)` / `T::query(&pool)` |
| `#[derive(Factory)]` | crate root (`macros` + a `model-*` feature) | Beside `Model`: `test_client::factory::Factory` and `T::factory()` for tests (18.29.0, rws-macros 17.30). See [Factories](/testing/database/#factories) |

## HTTP primitives

| Type / Trait | Module | Description |
|---|---|---|
| `Request` | `request` | Parsed HTTP request: method, URI, version, headers, body bytes. `request.header(name)` is a case-insensitive, allocation-free lookup; `Request::is_supported_method` checks a method token |
| `Response` | `response` | HTTP response: status code, headers, body as `Vec<ContentRange>`. `Response::json(status, bytes)` / `Response::text(status, &str)` are one-line builders; `response.header(name)` looks a header up |
| `STATUS_CODE_REASON_PHRASE` | `response` | Every HTTP status code as a typed constant |
| `Header` | `header` | Name/value pair (`Cow<'static, str>` fields since 18.0.0; build with `Header::new(name, value)`, read via deref); constants for all standard header names. See [Migrating to 18.0](/reference/migrating-18/) |
| `HTTP` | `http` | Version constants; `HTTP::is_supported_version` |
| `MimeType` | `mime_type` | MIME type constants and detection from a file extension |
| `Range` / `ContentRange` | `range` | Byte ranges and the body parts of a `Response` (bytes, files, multipart) |
| `URL` | `url` | Parse and build URLs; percent-encode/decode |
| `FormUrlEncoded` | `body::form_urlencoded` | Parses `application/x-www-form-urlencoded` bodies. See [Forms & uploads](/building-apps/forms-uploads/) |
| `FormMultipartData` | `body::multipart_form_data` | Parses `multipart/form-data` uploads |
| `Json<T>` | `json` (`serde`) | Serde JSON extractor and responder. See [JSON](/building-apps/json/) |
| `CookieJar` | `cookie` | Parses the `Cookie` request header. See [Cookies](/building-apps/cookies/) |
| `SetCookie` | `cookie` | Builds `Set-Cookie` values with all RFC 6265 attributes |
| `signed_cookie` / `verify_signed_cookie` | `cookie` (`crypto`) | HMAC-SHA256 tamper-evident cookie value `"<value>.<hex-signature>"`; verification returns `None` on tampering |
| `encrypted_cookie` / `decrypt_cookie` | `cookie` (`crypto`) | AES-256-GCM confidential cookie value; fresh nonce per call, `None` on tampering or wrong key |

## Routing

| Type / Trait | Module | Description |
|---|---|---|
| `Router` | `router` | Path-pattern router with `:param` and `*wildcard`; `.with_host(name)` restricts it to one virtual host; `.matches(request, connection)` tells whether `handle()` would run a handler |
| `Group<S>` / `Resource<S>` | `group` | Routes under a path prefix sharing guards and middleware (`app.group(prefix, \|g\| …)`), and a collection's conventional routes (`app.resource(path, \|r\| …)`: `index`, `new_form`, `create`, `show`, `edit`, `update`, `destroy`, `extra`) (18.35.0). See [Groups and guards](/building-apps/routing/#groups-and-guards) |
| `AsyncGroup<S>` / `AsyncResource<S>` | `group` (`http2`) | The same for `AsyncAppWithState` (guards, no per-group middleware) |
| `url_for` / `name_route` / `named_routes` / `build_path` | `router` | Named routes (`.name("post")` after a route) and their paths with parameters filled in (18.35.0). See [Named routes](/building-apps/routing/#named-routes-and-url_for) |
| `Flash` / `FlashLayer` / `Redirect` | `flash` | Flash messages in the `rws_flash` cookie, shown once; `Redirect::to(path).notice(…)` (303), `found`, `permanent`, `to_route` (18.35.0). See [Flash messages](/building-apps/forms-uploads/#flash-messages-and-redirects) |
| `Hub` | `channels` | Named topics pushed to SSE and WebSocket clients: `publish`, `sse`, `serve_websocket`, `subscribe` (18.35.0). See [Channels](/features/channels/) |
| `Vite` | `vite` (`serde`) | Tags for a Vite entry from its manifest or dev server; `vite::install` for the `vite` template function (18.35.0). See [Vite](/building-apps/templates/#vite) |
| `Attachment` | `attachment` (`storage-*`) | A model field whose bytes are in a `Storage` backend, stored as one `TEXT` column; `store`, `store_stream`, `from_multipart`, `url`, `read`, `delete` (18.35.0). See [Attachments](/building-apps/forms-uploads/#attachments-on-models) |
| `PathParams` | `router` | Extracted path parameters; `.get(name) -> Option<&str>` |
| `RouteConflict` / `RouteConflictKind` | `router` | A route that never runs because an earlier one with the same method matches every path it does (`Duplicate`, `Shadowed`); `route_conflicts()` on `Router`, `AppWithState`, `AsyncAppWithState`, also printed once when registered (18.28.0). See [Route conflicts](/building-apps/routing/#route-conflicts) |
| `Handler<S>` / `AsyncHandler<S>` / `RouteSpec` | `handler` | What the route macros generate for a typed handler: `handle(request, params, connection, &Arc<S>)`, `handle_async(…)` → `HandlerFuture`, `METHOD`/`PATTERN`; `.route(h)` registers one (18.28.0) |
| `ConnectionInfo` | `server` | Client/server IP, port, and SNI hostname per connection |
| `VirtualHostConfig` | `virtual_host` | Per-domain certificate config `{ domain, cert_file, key_file }` for SNI. See [Virtual hosting](/features/virtual-hosting/) |

## Typed extractors and errors

| Type / Trait | Module | Description |
|---|---|---|
| `FromRequest` | `extract` | Trait for typed extraction from a request, returning a ready error response on failure. See [Extractors](/building-apps/extractors/) |
| `FromRequestParts<S>` / `RequestParts` | `handler` | A typed handler argument, built from the request, route parameters, connection and state; every `FromRequest` type is one (18.28.0). See [Extractors as handler arguments](/building-apps/extractors/#extractors-as-handler-arguments) |
| `Path<T>` / `FromPath` | `handler` | Route parameters, percent-decoded and parsed: a scalar, a tuple of `FromStr` values, or a `#[derive(FromPath)]` struct; `400` when one doesn't parse (18.28.0) |
| `Query<T>` / `Form<T>` | `handler` (`serde`) | Query string / `application/x-www-form-urlencoded` body as a `Deserialize` struct; `400`, or `415`/`400`/`422` for a form (18.28.0) |
| `State<S>` | `handler` | The app's state as a handler argument (a clone of its `Arc`) (18.28.0) |
| `Body` | `extract` | Raw request body bytes (never fails) |
| `Storage::put_stream` / `S3_PART_SIZE` | `storage` | Store a `Read` stream: S3 multipart upload (8 MiB parts), local temp file + rename; default buffers (18.0.0) |
| `request::Body` | `request` | `Request.body` (18.0.0): bytes, or a stream (`Body::stream`, `body_bytes()`, `into_reader()`); derefs to `&[u8]`. Not the `extract::Body` extractor |
| `BodyText` | `extract` | UTF-8 request body (returns 400 on invalid UTF-8) |
| `Query` | `extract` | Parsed query string as `HashMap<String, String>` |
| `RequestHeaders` | `extract` | All request headers with case-insensitive `.get(name)` |
| `RequestId` | `extract` / `request_id` | The ID `RequestIdLayer` put on the request; empty string without it (never fails) |
| `openapi_tools::tools` | `mcp` | OpenAPI 3.0/3.1 operations as MCP tools (`OpenApiTool`: schemas, annotations, `request(arguments)` → `ToolRequest`); `ToolOptions` (prefix, include, exclude); `McpServer::openapi_tools(app, spec, options)` runs them in-process against an `Application`; `AppWithState::openapi_spec` (`openapi`) gives the document. See [Tools from OpenAPI](/mcp/openapi-tools/) |
| `DevTools` / `DevMcp` / `DevMcpExt` | `dev_mcp` | `app.dev_mcp()` / `.dev_mcp_with(DevTools)`: an MCP endpoint for a coding agent — `routes` (with middleware), `config` (secrets hidden), `layout` (`rws.app.toml`, `.app_dir(dir)`), `recent_requests` / `recent_errors`, `models` (`.model::<T>()`), `db_schema` and migrations (`model-*`); only with `RWS_ENV=dev` or a token. `ops_tools(server, routes, cache)`: the `rws` binary's 25 operations tools (18.28.0). The generators `gen_model`, `gen_route`, `gen_migration`, `gen_test` (`GEN_TOOLS`, unless `.read_only()`, 18.29.0). See [Let a coding agent inspect your app](/mcp/dev-tools/) |
| `RwsEnv` | `entry_point` (also `dev_mcp`) | `RWS_ENV`: `Dev`, `Test` or `Prod` (default); `RwsEnv::current()`, `parse`, `as_str` (18.28.0). See [environment variables](/configuration/env-vars/#environment-kind) |
| `A2aServer` | `a2a` | A2A 1.0 agent (JSON-RPC): Agent Card, `SendMessage`, `GetTask`, `ListTasks`, `CancelTask`; `on_message`, `at`, `wrap`. See [A2A agents](/mcp/a2a/) |
| `AgentCard` / `Skill` | `a2a` | The agent's card at `/.well-known/agent-card.json` and the skills on it |
| `A2aContext` / `A2aReply` | `a2a` | What a message handler gets (task, context, the continued task) and returns (a message or a task) |
| `Message` / `Part` / `Task` / `Artifact` / `TaskState` | `a2a` | The A2A 1.0 data model |
| `AcceptLanguage` | `i18n` | `Accept-Language` preferences (also an extractor); `parse`, `negotiate(&available)` (RFC 4647 lookup). See [Translations](/building-apps/i18n/) |
| `Catalogs` | `i18n` | Message catalogs per language plus a default; `from_dir`, `add`, `for_request`, `for_language`, `negotiate` |
| `Catalog` | `i18n` | One language's messages (flat TOML subset); `parse`, `get` |
| `Translator` | `i18n` | Messages in the chosen language: `t`, `t_with`, `plural`, `plural_with`, `locale`, `localize(response)` |
| `plural_category` | `i18n` | CLDR plural category (`one`/`few`/`many`/`other`) of a count in a language |
| `IntoResponse` | `error` | Trait for mapping error enums to `Response` values; also implemented by `Result<T, E>`, `String`, `&'static str`, `Json<T>` and `(&StatusCodeReasonPhrase, T)` (18.28.0). See [Error handling](/building-apps/error-handling/) |
| `AppError` | `error` | Built-in error variants: `BadRequest`, `NotFound`, `Internal`, etc. |
| `Validate` | `validate` | Field-level validation trait. See [Validation](/building-apps/validation/) |
| `ValidationErrors` | `validate` | Collects every validation failure before returning |
| `Validated<T>` | `validate` | Extractor that extracts then validates: 400 on extraction failure, 422 with a JSON error body on validation failure |
| `is_email` / `is_url` | `validate` | Format checks used by the derive; callable directly |

## Server and configuration

| Type / Trait | Module | Description |
|---|---|---|
| `Server` | `server` | TCP listener, thread pool, TLS acceptor, and request loop. `Server::continue_response` / `expectation_failed_response` implement `Expect: 100-continue` / 417 on HTTP/1.1 |
| `server::REQUEST_HEAD_TIMEOUT` | `server` | 30 s: a request head must complete within this of its first byte, else `408` |
| `ServerConfig` | `server_config` | Typed snapshot of per-instance config (CORS, CSP, `client_hints`, `static_cache_control`, log format). `ServerConfig::current()` is the shared per-request snapshot; call `server_config::invalidate()` after a direct `std::env::set_var` |
| `LogPrivacy`, `AnonymizeIp` | `server_config::log_privacy` | The access log's privacy settings (18.33.0): IP anonymisation (`truncate`, keyed `hash`), header and query-parameter redaction; `ServerConfig::log_privacy`. See [Anonymised addresses](/deployment/observability/#anonymised-addresses-and-redaction) |
| `ConfigSnapshot` | `config_reload` | Hot-reloadable values, read with `config_reload::current()`. See [Hot reload](/features/hot-reload/) |
| `config_reload::reload` / `config_reload::on_reload` | `config_reload` | Re-read `rws.config.toml` (also on `SIGHUP` and `POST /admin/config/reload`); register a closure run after every reload |
| `ConfigReport` | `config_check` | Result of `config_check::check_file` / `check_str` (what `rws --check` runs): `errors`, `warnings`, `.is_ok()`, `.render(path)`, `.render_json(path)`. See [Config file](/configuration/config-file/) |
| `get_max_body_size` | `entry_point` | Reads `RWS_CONFIG_MAX_BODY_SIZE_IN_BYTES` (default `0`, unlimited); larger requests get `413` before buffering |
| `get_spa_fallback` / `get_spa_fallback_exclude_prefixes` | `entry_point` | Read `RWS_CONFIG_SPA_FALLBACK*`. See [Static files](/features/static-files/) |
| `FromEnvStr` | `config_binding` | Implement for custom field types used with `#[derive(Config)]` |
| `secrets::resolve` / `resolve_env_vars` | `secrets` (`secrets`) | Resolve `vault://`, `aws-sm://` and `azkv://` references; `Server::setup()` rewrites matching `RWS_*` env vars at startup and fails hard on errors. See [Secrets](/features/secrets/) |
| `SecretsError` | `secrets` (`secrets`) | Error type for secret resolution |
| `StaticResourceController::STREAM_THRESHOLD` | `app::controller::static_resource` | 256 KiB: larger static files are streamed from disk instead of read into memory |
| `StaticResourceController::render_directory_listing` | `app::controller::static_resource` | Renders the listing `App` serves for a directory without `index.html` |
| `DirectoryListingAssetsController` | `app::controller::directory_listing` | Serves the listing's CSS/JS at `/rws-directory-listing.{css,js}` (same-origin, so the default CSP allows them); a file on disk overrides the built-in |

## Middleware

| Type / Trait | Module | Description |
|---|---|---|
| `RateLimiter` | `rate_limit` | Sliding-window per-key limiter; `rate_limit::global()` for the singleton; `.retry_after()` / `.limits()`. See [Rate limiting](/features/rate-limiting/) |
| `RedisRateLimiter` | `rate_limit` | Fixed-window limiter shared across instances through Redis; `from_env()` |
| `RateLimitLayer` | `middleware` | Enforces the global rate limiter per client IP; `429` with `Retry-After` |
| `CacheLayer` | `cache` | In-memory TTL response cache for GET (`CacheLayer::memory(n).ttl(s).vary_by_header(h)`); skips `no-store`/`private`/`no-cache`, `Range` and out-of-key `Vary` responses. See [Caching](/features/caching/) |
| `Purge` / `cache::registry` | `cache` | What `CacheLayer::purge` removes (`All`, `Exact(target)`, `Prefix(target)`), and the named caches the admin API lists and purges (18.11.0). See [Purging](/features/caching/#purging) |
| `MetricsLayer` | `metrics` | Per-route Prometheus counters and latency histograms. See [Metrics](/features/metrics/) |
| `RewriteLayer` | `rewrite` | Request/response header, URI, body, and status rewriting; `.request_uri_regex_rewrite` needs `rewrite-regex`. See [Rewrite](/features/rewrite/) |
| `AuthFlows` | `auth_flows` (`crypto` + `mailer` + `serde`) | Sign-up, login, logout, password reset and email confirmation as one middleware, JSON or forms; signed stateless sessions and links (18.35.0). See [Sign-up and login](/features/auth-flows/) |
| `CurrentUser` / `signed_in` / `signed_in_or_redirect` | `auth_flows` | The signed-in account as a handler argument, and route guards (18.35.0) |
| `UserStore` / `AuthUser` / `MemoryUserStore` / `DbUserStore` | `auth_flows` (`DbUserStore`: a `model-*` feature) | Where accounts live: your own table, memory, or `rws_users` (18.35.0) |
| `BasicAuthLayer` | `auth` (`auth`) | HTTP Basic authentication via a closure or `from_htpasswd_file` (plain or rws's `{SHA256}` scheme — not Apache `{SHA}`/`$apr1$`/bcrypt). See [Auth](/features/auth/) |
| `JwtLayer` | `auth` (`auth`) | HS256 Bearer JWT validation; `::rs256`/`::es256` verify against a static public key (`auth-asymmetric`) |
| `Identity` / `with_identity` / `scope_identity` | `authz` | The authenticated caller (`user:alice`), set by every authenticator for the rest of the request — not a header; `Identity::current()` (18.14.0). See [Authorization](/features/authorization/) |
| `Authorizer` / `Schema` / `Tuple` / `TupleStore` / `MemoryStore` | `authz` | Relationship-based access control: a schema of relations (`user \| group#member \| owner \| parent->viewer`), tuples (`doc:42#editor@user:alice`), `check` / `explain` with depth and read limits (18.14.0). See [Authorization](/features/authorization/#relationships) |
| `SqlStore` | `authz::sql` (`model-*`) | Relationship tuples in SQLite / Postgres / MySQL (`rws_authz_tuples`), 1 s read cache, own runtime (18.14.0). See [Authorization](/features/authorization/#storing-tuples-in-a-database) |
| `AuthzLayer` / `ObjectTemplate` | `authz` | Middleware: the caller needs a relation on an object named from the request (`doc:{path:2}`, `{query:k}`, `{header:H}`); 401 / 403 (18.14.0). See [Authorization](/features/authorization/#protecting-routes) |
| `ForwardAuthLayer` | `auth::forward` (`auth`) | Delegates allow/deny to an external HTTP service; verbatim pass-through on non-2xx, 502 if unreachable |
| `IpFilter` | `ip_filter` | IPv4/IPv6 address or CIDR allowlist/denylist; `ip_filter::is_valid_entry` checks an entry; `ip_filter::client_ip` / `request_scheme` give the client's address and scheme behind a trusted proxy. See [IP filter](/features/ip-filter/) |
| `Blocklist` | `blocklist` | Runtime IP blocklist: `blocklist::global().block(ip)` / `.unblock` / `.is_blocked` / `.list` / `.clear` |
| `BlocklistLayer` | `blocklist` | Answers `403` for blocked client IPs |
| `MaintenanceLayer` / `MAINTENANCE_MODE` | `maintenance` | While the `AtomicBool` is `true`, answers `503` for everything but `/healthz` and `/readyz` |
| `RequestLog` | `request_log` | In-memory buffer of recent requests (`request_log::global()`, capacity 1000); `.recent(n)` / `.recent_errors(n)` |
| `LogLayer` | `request_log` | Records each request into `RequestLog` |
| `EarlyHintsLayer` / `early_hints::send` | `early_hints` | `103 Early Hints` with `Link` values before the response, on HTTP/2 and HTTP/3 (HTTP/1.1 opt-in) (18.12.0). See [Early Hints](/features/early-hints/) |
| `traffic::classify` / `Class` / `Kind` / `Group` | `traffic` | Who a client is from its address, User-Agent and path: person (browser), AI (training, search, assistant), bot (search engine, SEO, monitoring, preview, scanner, spoofed crawler, tool); crawler networks verified by their published IP ranges (18.15.0) |
| `traffic::device::parse` / `Device` | `traffic` | A browser's family, operating system and device class from its `User-Agent` and client hints (18.31.0) |
| `traffic::TrafficScriptLayer` | `traffic` | Serves the first-party traffic script (`/_rws/t.js`) and takes its reports (`/_rws/t`) when `[traffic] script` is on; passes every other request through (18.31.0) |
| `traffic::geo::country` | `traffic` | The country of an address from the built-in DB-IP Lite table (`geo` feature) or `[traffic] geo_db` (18.31.0) |
| `traffic::hosting::provider` | `traffic` | The cloud or server hosting provider of an address (`"AWS"`, `"other hosting"`) from the built-in DB-IP ASN Lite table (`geo` feature); browsers from one count as bots (18.35) |
| `traffic::apps::detect` / `App` / `set_apps` / `configured` | `traffic` | A native app or browser extension from its `User-Agent` and `Origin`: a configured `[traffic] apps` name, or a platform name (Apple or Android networking, Electron, extension origins); counted as **Apps**, not bots (18.35) |
| `traffic::owner` (`in_networks`, `has_cookie`, `key`, `is_admin_call`) | `traffic` | Whether a request is the site owner's: a successful admin API call, `[traffic] owner_networks`, or the `rws_me` cookie set by `/_rws/me?k=<key>`; the owner's visits are counted apart (18.35) |
| `traffic::configure_sites` / `traffic::record::set_configured_hosts` | `traffic` | The sites the configuration's routes match, counted separately and listed first on the Traffic page (18.35) |
| `RequestIdLayer` | `request_id` | Correlation-ID middleware — echoes or generates `X-Request-Id` (`generate_request_id()`, UUID-v4-shaped, not crypto-random). See [Request ID](/features/request-id/) |
| `CsrfLayer` | `csrf` (`csrf`) | Double-submit cookie CSRF protection; 403 on mismatch. See [CSRF](/features/csrf/) |
| `CsrfToken` | `csrf` (`csrf`) | Extractor for the current token in a GET handler; implements `Display` |
| `TimeoutLayer` | `timeout` | Wraps a whole `Application` with a deadline (`504`). See [Timeouts](/features/timeouts/) |
| `with_timeout` / `with_timeout_state` / `with_timeout_async` | `timeout` | Per-handler timeouts. The sync ones bound the client's wait but can't cancel the work; `with_timeout_async` (`http2`) cancels the future |
| `FeatureStore` | `feature` | Runtime feature toggles: `feature::global().set(name, bool)` / `.is_enabled` / `.list` |

## Authentication and crypto

| Type / Trait | Module | Description |
|---|---|---|
| `build_jwt` / `verify_jwt` | `auth` (`auth`) | Sign and verify HS256 JWTs |
| `Claims` | `auth` (`auth`) | Decoded JWT claims: `sub`, `exp`, raw JSON payload |
| `verify_jwt_rs256` / `verify_jwt_es256` | `auth` (`auth-asymmetric`) | Standalone RS256/ES256 verification backing `JwtLayer::rs256`/`::es256` |
| `Decoder`, `Alphabet`, `DecodeError` | `core::base64` | The one base64 decoder: `Decoder::STANDARD` / `URL_SAFE` / `EITHER`, `.skip_whitespace()`, `.decode(input)` (padding optional; errors carry the byte position). `Base64::encode`/`decode` keep the standard-alphabet API |
| `RsaPublicKey` | `rsa_key` (`auth-asymmetric` / `sso`) | In-crate RSA public key (PEM, SPKI/PKCS#1 DER or components; 2048–8192 bits); `.verify_pkcs1v15_sha256(message, signature)` |
| `hash_password` / `verify_password` | `crypto` (`crypto`) | Argon2id hashing (PHC string, salt embedded) and constant-time verification |
| `generate_token` | `crypto` (`crypto`) | CSPRNG hex token for reset links and API keys |
| `CryptoError` | `crypto` (`crypto`) | Error type for password hashing |
| `verify_webhook_signature` | `webhook` (`webhook`) | Verifies an inbound webhook HMAC for a `WebhookProvider`. See [Webhooks](/features/webhooks/) |
| `WebhookProvider` | `webhook` (`webhook`) | `GitHub`, `Shopify`, `Stripe` (300 s default replay tolerance) |
| `verify_github_signature` / `verify_shopify_signature` / `verify_stripe_signature` / `verify_stripe_signature_with_tolerance` | `webhook` (`webhook`) | Per-provider functions when the provider is known at the call site |

## SSO

| Type / Trait | Module | Description |
|---|---|---|
| `OidcAuth` | `sso` (`sso`) | OAuth2/OIDC middleware: intercepts `/auth/login`, `/auth/callback`, `/auth/logout`; `OidcAuth::claims(req)` reads the claims. See [SSO](/features/sso/) |
| `OidcConfig` | `sso` (`sso`) | Client configuration; presets `google`, `microsoft`, `github`, `okta`, `auth0`, `keycloak`, and `from_env()` |
| `OidcProvider` | `sso` (`sso`) | Provider endpoints; same presets plus `OidcProvider::discover(issuer)` |
| `OidcClaims` | `sso` (`sso`) | Standard OIDC claims from a verified `id_token` or UserInfo response (no `groups`) |
| `JwksCache` | `sso` (`sso`) | JWKS key cache; `verify_jwt(token, &VerifyOptions)` checks RS256/ES256 signature, `exp`, `iss`, `aud`; refetches once on a key miss |
| `VerifyOptions` | `sso` (`sso`) | `audience`, `issuer`, `leeway_secs` for `JwksCache::verify_jwt` |
| `OidcClient` | `sso` (`sso`) | `authorization_url`, `exchange_code`, `fetch_user_info` |
| `TokenResponse` | `sso` (`sso`) | Token endpoint response returned by `exchange_code` |
| `PkceVerifier` | `sso` (`sso`) | RFC 7636 code verifier; `.challenge()` |
| `PkceChallenge` | `sso` (`sso`) | S256 code challenge for the authorization URL |
| `AuthServer` | `sso` (`sso-server`) | rws as an OAuth 2.0 Authorization Server (`/oauth/token`, `/oauth/authorize`, discovery). Tokens are HS256, so `jwks.json` is always empty; `/oauth/authorize` trusts an existing app session, with no built-in login page |
| `AuthServerConfig` | `sso` (`sso-server`) | `issuer`, `signing_secret`, access/refresh token lifetimes, `clients` |
| `ClientStore` | `sso` (`sso-server`) | Registry of OAuth clients: `ClientStore::new().add(client).get(id)` (no `from_env`) |
| `OAuthClient` | `sso` (`sso-server`) | One client; `client_secret: None` is a public PKCE-only client |
| `GrantType` | `sso` (`sso-server`) | `ClientCredentials`, `AuthorizationCode`, `RefreshToken` |
| `SamlSp` | `sso::saml` (`sso-saml`) | SAML 2.0 Service Provider middleware (`/saml/metadata`, `/saml/login`, `/saml/acs`, `/saml/logout`). Verifies RSA-SHA256 signatures byte-exact against the transmitted XML (not full C14N — fails closed), requires exactly one `Assertion`, rejects `EncryptedAssertion`; unsigned HTTP-POST `AuthnRequest`s; local-only logout. See [SAML](/features/saml/) |
| `SamlConfig` | `sso::saml` (`sso-saml`) | `sp_entity_id`, `sp_acs_url`, `idp_metadata`, `sessions` |
| `SamlIdpMetadata` | `sso::saml` (`sso-saml`) | Parsed IdP metadata (`entity_id`, `sso_url`, `signing_key`); `from_file` / `from_url` / `from_str` |
| `AttributeMap` | `sso::saml` (`sso-saml`) | Maps IdP attribute names to claim fields |
| `SamlClaims` | `sso::saml` (`sso-saml`) | `name_id` plus `attributes: HashMap<String, String>`; read with `SamlSp::claims` / `name_id` / `attr` |

## Sessions

| Type / Trait | Module | Description |
|---|---|---|
| `SessionStore` | `session` | In-memory TTL session store; helpers `session_id_from_request`, `session_cookie`, `destroy_cookie`. See [Sessions](/features/sessions/) |
| `Session` | `session` | One session's data |
| `DbSessionStore` | `session` (a `model-*` feature) | Persistent store on the model-layer `DbPool` (`rws_sessions` table); async methods |
| `RedisSessionStore` | `session` | Persistent store on Redis; `new(addr, password, ttl)` or `from_env()` |

## Real-time protocols

| Type / Trait | Module | Description |
|---|---|---|
| `Sse` | `sse` | `Sse::stream()` → a streaming response and its `SseSender`; `Sse::new()` builds a buffered `text/event-stream` body. See [SSE](/features/sse/) |
| `SseStream` | `sse` | Options for a streaming response: `.buffer(events)`, `.keep_alive(interval)`, `.start()` |
| `SseSender` / `SseClosed` | `sse` | Feeds a streaming response: `send` (waits for room), `try_send`, `send_async` (`http2`), `data`, `comment`; `Err(SseClosed)` once the client is gone |
| `SseEvent` | `sse` | One event: data plus optional `event`, `id`, `retry` |
| `WebSocket` | `websocket` | RFC 6455: `WebSocket::upgrade(request, handler)` for a route, plus the handshake and frame read/write. See [WebSocket](/features/websocket/) |
| `WebSocketConnection` / `WebSocketSender` / `Message` | `websocket` | An upgraded connection: `recv()` → whole `Message::Text`/`Binary` (pings, fragments and the close handshake handled); `sender()` for other threads |
| `Frame` | `websocket` | A WebSocket frame: `Text`, `Binary`, `Ping`, `Pong`, `Close`, `Continuation` |

## MCP

| Type / Trait | Module | Description |
|---|---|---|
| `DictionaryEncoding` / `dictionary::{encode, decode, negotiate, available_dictionary}` | `compression::dictionary` | `dcz` / `dcb` dictionary compression (RFC 9842) and `Available-Dictionary` parsing (18.12.0). See [Dictionary compression](/features/compression/#dictionary-compression) |
| `Encoding` / `Level` | `compression` | Content codings (`gzip`, `br`, `zstd`) and levels; `negotiate(request, preference)`, `encode`, `apply_compression` (18.1.0). See [Compression](/features/compression/) |
| `JsonSchema` / `ObjectSchema` | `schema` | A type's JSON Schema as text (primitives, `Option`, collections, smart pointers built in); `ObjectSchema` builds an object schema (18.0.0) |
| `McpGateway` / `Upstream` | `mcp::gateway` | One MCP endpoint federating upstream MCP servers: `prefix__tool` names, per-caller `allow` rules, upstream credentials kept server-side (18.0.0). See [MCP gateway](/mcp/gateway/) |
| `LlmProxy` / `Provider` / `Api` | `llm` | One endpoint in front of OpenAI-compatible and Anthropic providers: virtual keys, provider fallback before the first byte, token budgets (memory or Redis), `rws_llm_*` metrics (18.9.0). See [LLM proxy](/proxy/llm-proxy/) |
| `Mirror` / `MirrorLayer` | `proxy::mirror` | Copy a share of requests to other backends, fire-and-forget, through a bounded queue (18.11.0). See [Request mirroring](/proxy/config-driven/#request-mirroring) |
| `AdminApi` / `AdminConfig` | `admin` | The admin API on its own listener behind a bearer token: `start(&config)`, or drive `AdminApi` as an `Application` (18.10.0). See [Admin API](/deployment/admin/) |
| `admin::access::ChainReport`, `verify_chain`, `chain_line`, `line_hash` | `admin` | The audit log's hash chain: each file line's `prev`/`hash`, and its check (18.33.0). See [A tamper-evident audit log](/deployment/admin/#a-tamper-evident-audit-log) |
| `WasmLayer` | `wasm_plugin` | WebAssembly middleware: a core module with no imports, fuel and memory limits, request and response hooks (`wasm-plugins` feature, 18.10.0). See [WebAssembly plugins](/features/wasm-plugins/) |
| `UsageParser` / `Usage` | `llm` | Token usage out of a provider response fed in pieces, JSON or event stream (18.9.0) |
| `InputRequired` / `PromptReply` | `mcp` | MCP 2026-07-28 multi round-trip requests: what a tool (`McpContent::input_required`) or prompt (`.prompt_with_context`) needs from the client — `.elicit`, `.sample`, `.list_roots`, `.state` (signed). See [Asking the client for input](/mcp/tools/#asking-the-client-for-input-mcp-2026-07-28) |
| `TaskContext` / `TaskError` | `mcp` | The MCP Tasks extension: what `McpContext::start_task`'s work runs with (`input`, `is_cancelled`, `status_message`) and how it ends. See [Long-running work: tasks](/mcp/tools/#long-running-work-tasks-mcp-tasks-extension) |
| `McpServer` / `McpIcon` | `mcp` | MCP Streamable HTTP server (`POST /mcp`, JSON-RPC 2.0, plus `GET /mcp` SSE); `.tool` / `.typed_tool` (`serde`) / `.resource` / `.prompt`, `.require_bearer`, `.require_bearer_tokens`, `.require_oauth` (`sso`), `.tool_filter`, `.session_ttl` / `.max_sessions` / `.max_sse_clients`. Entry point `McpServer::new(name, version)` or `app.mcp(name, version)`. See [MCP](/mcp/overview/) |
| `McpContent` | `mcp` | Tool result content: `text`, `json`, `image`, `embedded` |
| `McpContext` | `mcp` | Per-session context for `.tool_with_context` handlers: client info, `auth_claims`, progress, cancellation, `sample`, `list_roots` |
| `ToolAnnotations` | `mcp` | `read_only_hint`, `destructive_hint`, `idempotent_hint`, `open_world_hint` for `.tool_annotated` |

## Proxy

| Type / Trait | Module | Description |
|---|---|---|
| `ReverseProxy` | `proxy` | HTTP/1.1 reverse proxy middleware: round-robin with failover (502 when all fail), pooled connections, unbuffered streaming of SSE/chunked/large bodies; `.with_circuit_breaker(Arc<dyn Breaker>)`. See [Reverse proxy](/proxy/reverse-proxy/) |
| `LoadBalancing` | `proxy` | Strategy enum passed to `ReverseProxy::strategy()` |
| `ConnPool` / `Pool<S>` | `proxy` | Per-backend idle-connection pool (`ConnPool = Pool<TcpStream>`); `ConnPool::new(max_idle, idle_timeout)`, share with `ReverseProxy::with_pool`. A pooled connection the backend has closed is skipped before reuse (any method); one that fails before any response byte is retried once only for idempotent methods |
| `UpstreamTls` | `proxy` | TLS settings for upstreams: a PEM CA file instead of WebPKI and/or a client certificate (`UpstreamTls::new(ca, client)`; `tls_ca_file`, `tls_client_cert` on `ReverseProxy`/`H2ReverseProxy`/`GrpcProxy`, `[[upstream]] tls_ca_file`/`tls_client_cert_file`/`tls_client_key_file`); unloadable → 502 |
| `H3ReverseProxy` | `proxy` (`http3`) | HTTP/3 (QUIC) upstream proxy for `https://` backends: pooled multiplexed connections, bodies streamed both ways, trailers; falls back to TCP for a backend QUIC can't reach (`rws_upstream_h3_fallbacks_total`) (18.13.0). See [HTTP/3 backends](/proxy/reverse-proxy/#http3-backends) |
| `H2ReverseProxy` | `proxy` (`http2`) | HTTP/2 upstream proxy: `h2://` plain, `h2s://`/`https://` TLS; pooled connections, bodies streamed both ways, trailers kept (18.3.0) |
| `Trailers` | `response` | Trailer fields sent after a body (`Response::trailers`, HTTP/2 and HTTP/3): a shared slot a streamed body's producer fills before it ends (18.3.0) |
| `GrpcWebLayer` | `proxy` (`http2`) | Translates gRPC-web (`application/grpc-web[-text]`) to gRPC for the layers after it and the response back, trailers as the body's last frame (18.3.0). See [gRPC-web](/proxy/grpc-proxy/#grpc-web-from-browsers) |
| `GrpcProxy` | `proxy` (`http2`) | gRPC proxy (wraps `H2ReverseProxy`, filters on `application/grpc*`). See [gRPC proxy](/proxy/grpc-proxy/) |
| `TcpProxy` | `tcp_proxy` | Standalone L4 TCP proxy with round-robin backends. See [TCP proxy](/proxy/tcp-proxy/) |
| `UdpProxy` | `udp_proxy` | Standalone request-reply UDP proxy. See [UDP proxy](/proxy/udp-proxy/) |
| `WsProxy` | `ws_proxy` | WebSocket proxy, `ws://` and `wss://` (`http-client` or `http2`); `with_live_backends` for health-aware selection (503 when empty). See [WebSocket proxy](/proxy/websocket-proxy/) |
| `CanaryLayer` | `canary` | Weighted traffic splitting (smooth weighted round-robin); `Clone` shares state, `.update()` changes weights live. See [Canary](/proxy/canary/) |
| `WeightedBackend` | `canary` | One weighted backend URL |
| `WeightedPool` | `canary` | A weighted group whose members come from a `BackendPool` |
| `CircuitBreaker` | `circuit_breaker` | Per-backend Closed/Open/HalfOpen breaker in memory; `circuit_breaker::global()`. See [Circuit breaker](/proxy/circuit-breaker/) |
| `RedisCircuitBreaker` | `circuit_breaker` | Same state machine shared through Redis; methods return `Result`; `from_env()` |
| `Breaker` | `circuit_breaker` | Object-safe trait over both breakers, taken by `ReverseProxy::with_circuit_breaker` |
| `RetryLayer` | `circuit_breaker` | Re-dispatches a request whose status is retryable (default 502/503/504); push it before the proxy |
| `BackendPool` | `service_discovery` | Backend list refreshed by a background thread. See [Service discovery](/proxy/service-discovery/) |
| `DiscoverySource` | `service_discovery` | `Static`, `EnvPrefix`, `File`, `Dns`, `DnsSrv`, `Consul`, `Docker`, `EtcdWatch` |
| `KubernetesIngressWatcher` | `ingress` | Resyncs and watches Ingress resources; `.from_service_account()` connects in-cluster (`http-client`/`http2`). See [Kubernetes Ingress](/deployment/kubernetes-ingress/) |
| `IngressRouter` | `ingress` | `Application` routing requests by the watched Ingress rules |
| `IngressRule` | `ingress` | One parsed Ingress rule |
| `PathType` | `ingress` | `Exact`, `Prefix`, `ImplementationSpecific` |
| `ProxyConfig` | `proxy_config` | Parsed `[[route]]`/`[[upstream]]` config; `ProxyConfig::is_proxy_mode()`, `.validate(&mut ConfigReport)`. See [Config-driven proxy](/proxy/config-driven/) |
| `ConfigDrivenApp` | `proxy_config` | The app `proxy_config::build_from_file()` returns: first-match router with per-route middleware and per-upstream `strategy` (`round_robin`, `random`, `ip_hash`, `least_connections`); `.with_config(ServerConfig)` |
| `StickyConfig`, `BreakerConfig`, `RetryConfig` | `proxy_config` | An `[[upstream]]`'s `[upstream.sticky]`, `[upstream.circuit_breaker]` and `[upstream.retry]` (fields of `UpstreamConfig`, beside `weights`). See [Weights, stickiness, retries and the circuit breaker](/proxy/config-driven/#weights-stickiness-retries-and-the-circuit-breaker) |
| `UpstreamHost` | `proxy_config` | The `Host` a proxy route sends upstream (`ActionConfig::Proxy::upstream_host`): `Backend` (default), `Client` (`preserve_host = true`), `Fixed(name)` (`upstream_host`). See [proxy action](/configuration/config-file/#routeaction--proxy) |
| `ReloadOutcome` | `proxy_config` | Result of `ConfigDrivenApp::reload_from_str` / `reload_from_file` (validated first; the running routes stay on errors) |

## HTTP client

| Type / Trait | Module | Description |
|---|---|---|
| `Client` | `http_client` | Synchronous HTTP/1.1 client; follows redirects, 30 s default timeout. HTTPS needs `http-client` or `http2`. See [HTTP client](/building-apps/http-client/) |
| `RequestBuilder` | `http_client` | `.header`, `.body`, `.body_text`, `.body_json`, `.form`, `.timeout_ms`, `.send()` |
| `Response` | `http_client` | `.status()`, `.is_success()`, `.header(name)`, `.bytes()`, `.text()`, `.json::<T>()` (`serde`) |
| `AsyncClient` | `http_client` (`http2`) | Async client with `.send().await` |
| `AsyncRequestBuilder` | `http_client` (`http2`) | Async request builder (same methods, including `.form`) |
| `HttpClientError` | `http_client` | Error type; implements `std::error::Error` |

## Observability

| Type / Trait | Module | Description |
|---|---|---|
| `Log` | `log` | Access log lines: `Log::json` / `Log::combined` return one line; `Log::log_access` buffers per thread; `Log::flush_access_log()` writes now. See [Observability](/deployment/observability/) |
| `log::syslog::Sender`, `log::syslog::Target` | `log` | Access-log lines to syslog as RFC 5424 messages over UDP, TCP (octet counting) or a Unix socket (18.33.0). See [Syslog](/deployment/observability/#syslog) |
| `OtelLayer` | `otel` | HTTP server root span, W3C `traceparent` propagation, stdout or OTLP export. See [Tracing](/features/tracing/) |
| `otel::setup` / `setup_from_env` / `setup_with_exporter` | `otel` | Initialize the global tracer once at startup (`OTEL_SERVICE_NAME`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_TRACES_SAMPLER_ARG`) |
| `otel::shutdown` / `otel::flush` | `otel` | Flush buffered spans; call `shutdown()` before exit |
| `otel::span` / `otel::client_span` | `otel` | Start an Internal / Client child span under the active span |
| `otel::current_traceparent` | `otel` | `traceparent` of the innermost active span, for outbound calls |
| `Baggage`, `otel::current_baggage` / `set_baggage` | `otel` | W3C Baggage: parse/format the header; read and extend the current request's. See [Baggage](/features/tracing/#baggage) |
| `otel::propagation_headers`, `otel::is_tracing` | `otel` | `traceparent` + `baggage` for the current span; whether a traced request is current |
| `Context`, `ContextGuard` | `otel` | Capture the current span and baggage; `attach()` it on another thread |
| `DetachedSpan`, `otel::detached_span` | `otel` | A `Send` span for async work, parented where it starts; `.enter(f)` |
| `Span` | `otel` | RAII child span: `.set_attribute`, `.set_error`, `.record_error`, ends on drop |
| `SpanKind` | `otel` | `Internal`, `Server`, `Client` |
| `AttributeValue` | `otel` | `String`, `Int`, `Float`, `Bool`, with `From` impls |
| `TracingConfig` | `otel` | Service name, exporter, sample rate, batch size |
| `ExporterConfig` | `otel` | Built-in exporter choice |
| `otel::metrics::MetricsExportConfig`, `otel::metrics::start` / `start_from_env` | `otel` | Push `http.server.request.duration` over OTLP/HTTP every interval. See [OTLP metrics export](/deployment/observability/#otlp-metrics-export) |
| `otel::logs::LogsExportConfig`, `otel::logs::start` / `start_from_env`, `otel::logs::TraceIds` | `otel` | Access-log records as OTLP/HTTP JSON logs, with the request's trace and span ids (18.33.0). See [OTLP logs](/deployment/observability/#otlp-logs) |
| `otel::parse_headers`, `otel::traces_configured` | `otel` | `OTEL_EXPORTER_OTLP_HEADERS` syntax; whether the environment asks for trace export |
| `metrics::http::observe` | `metrics` | Record a request in `http_server_request_duration_seconds` (the server core does it for every request) |
| `metrics::exposition::protobuf` / `accepts_protobuf` | `metrics` | Prometheus protobuf exposition (native histograms) and its `Accept` negotiation |
| `Exporter` | `otel` | Trait for span exporters, accepted by `setup_with_exporter` |
| `StdoutExporter` / `OtlpHttpExporter` | `otel` | Built-in exporters; `OtlpHttpExporter::new(endpoint, service_name, service_version)` |
| `TraceContext` | `otel` | Parsed `traceparent`: `TraceContext::parse`, `.as_header(span_id)` |
| `SpanData` | `otel` | A finished span ready for export |

## Database / ORM

All model-layer types need `model-sqlite`, `model-postgres` or `model-mysql` (each implies `http2`; they combine).

| Type / Trait | Module | Description |
|---|---|---|
| `DbPool` | `model` | Async `sqlx` pool, one variant per compiled-in backend: `new(DbConfig)`, `from_env()`, `memory()` (SQLite `:memory:`), `connect(url)` (sqlx URLs, 18.30.0); `execute`, `query`, `begin`, `transaction`, `migrate`, `seed(dir)` (18.30.0); `with_replicas(primary, replicas)`, `primary()`, `replica()`, `replicas()`, `close()`, `seed_with(dir, &Seeders)`, `schema()` (18.30.0). See [Database](/database/overview/) |
| `Replicas` | `model` | The pools of `DbPool::Replicated` (a primary and its read replicas): `primary()`, `replicas()`; reads go to a replica round robin, writes and transactions to the primary; `RWS_DB_REPLICA_URLS` for `DbPool::from_env` (18.30.0). See [Read replicas](/database/overview/#read-replicas) |
| `DbSchema` / `TableSchema` / `ColumnSchema` / `IndexSchema` / `ForeignKeySchema` | `model` (`model::db_schema`) | The connected schema from `DbPool::schema()`: tables with columns, primary key, indexes and foreign keys; `table(name)`, `column(name)`, `to_json()` (what `rws db schema --json` and the dev MCP `db_schema` tool answer) (18.30.0). See [The schema as data](/database/migrations/#the-schema-as-data) |
| `Seeder` / `Seeders` | `model` (`model::seed`) | Seeds written in Rust: `Seeders::new().add(name, \|pool\| async move { … })`, `.seeder(impl Seeder)`, `run(&pool)`; `DbPool::seed_with` runs them after `seeds/*.sql`, `db_cli::run_with_seeders` gives an app's binary `db seed` with them (18.30.0). See [Seeds in Rust](/database/migrations/#seeds-in-rust) |
| `DbTls` / `DbSslMode` | `model` | TLS for PostgreSQL / MySQL pools: mode (`disable` … `verify-full`), CA file, client certificate; `DbTls::from_env()` reads `RWS_DB_SSL_*`; used by `DbPool::new_with_tls` and `DbPool::from_env`. See [Database TLS](/database/overview/#tls) |
| `DbTransaction` | `model` | Open transaction from `DbPool::begin`; `commit` / `rollback` |
| `DbConfig` | `model` | Connection settings; `from_env()` reads `RWS_DB_*` |
| `Backend` | `model` | `Sqlite`, `Postgres`, `MySql` (compiled-in only); `Backend::parse`; pick it explicitly only with several backends compiled in |
| `Repository<T, ID>` | `model` | Async CRUD trait (`find_by_id`, `find_all`, `save`, `delete_by_id`, `count`, …). See [Repository](/database/repository/) |
| `ModelRepository<T, ID>` | `model` | `Repository` implementation from `T::repository(&pool)`, for `ID` = `i64`, `i32`, `String`, `Uuid` (18.30.0); `save` inserts when an auto-increment key is 0 or another key isn't in the table, else updates; `insert`, `query()`, and for soft-delete models `restore`, `force_delete_by_id`, `find_by_id_with_deleted`. See [Keys, timestamps, soft delete, locking](/database/conventions/) |
| `PrimaryKey` | `model` | The key types `ModelRepository` implements `Repository` for: `i64`, `i32`, `String`, `Uuid` (sealed, 18.30.0) |
| `Timestamp` | `model` | A UTC instant in microseconds: `now()`, `parse`, `to_rfc3339`, `to_value(backend)`, `FromColumn`/`ToColumn`, `serde` as RFC 3339; the type of `#[timestamps]` / `#[soft_delete]` fields (18.30.0). See [Timestamps](/database/conventions/#timestamps) |
| `Uuid` | `model` | 16-byte UUID for keys: `now_v7()`, `new_v4()`, `parse`, `NIL` (`save` replaces it with a v7), stored as text (18.30.0). See [Primary keys](/database/conventions/#primary-keys) |
| `DbError` / `DbErrorKind` | `model` | The model layer's error (its message in `.0`); `kind()` — `StaleVersion` (a `#[version]`ed `save` of a stale copy), `NotFound`, `Other` — and `is_stale_version()` / `is_not_found()` (18.30.0). See [Optimistic locking](/database/conventions/#optimistic-locking) |
| `QueryBuilder<T>` | `model` | Fluent query builder: `where_eq`, `filter`, `order_by`, `limit`, `fetch_all`, `count`, `paginate`, `paginate_after`; `with_deleted`, `only_deleted`, `force_delete`, `restore` for soft-delete models; `where_in`, `where_null`, `where_not_null`, `scope(f)`, `with(relation)` (18.30.0). See [Query builder](/database/query-builder/) and [Scopes](/database/query-builder/#scopes) |
| `HasMany<T>` / `HasOne<T>` / `BelongsTo<O>` | `model` | Explicit-load relations with `.load(&pool).await` — no hidden N+1. See [Relations](/database/relations/) |
| `BelongsToMany<T>` / `SyncChanges` | `model` | One owner's many-to-many links through a join table: `load`, `ids`, `attach`, `detach`, `detach_all`, `sync` (answers the `SyncChanges`: `attached`, `detached`) (18.30.0). See [Many-to-many](/database/relations/#many-to-many-belongstomany) |
| `Relation<O, R>` / `RelationKind` | `model` (`model::eager`) | How `O` reaches `R`: `has_many(fk)`, `has_one(fk)`, `belongs_to(fk)`, `belongs_to_many(join, owner_key, related_key)`; `load(&pool, &owner)`, `load_for(&pool, &owners)` — one query per 500 keys (18.30.0). See [Eager loading](/database/relations/#eager-loading-with-with) |
| `EagerQuery<T>` / `Loaded<T>` | `model` (`model::eager`) | From `QueryBuilder::with(relation)`: `.with(…)` more, `fetch_all` / `fetch_one` / `paginate` answer `Loaded<T>` — derefs to the model; `related(&rel)`, `one(&rel)`, `take(&rel)`, `is_loaded(&rel)`, `into_inner()` (18.30.0) |
| `Nested<R>` | `model` | The relations to load for a relation's rows: `with_nested(relation, \|n\| n.with(…))` on `QueryBuilder`/`EagerQuery`; read with `Loaded::related_loaded` (18.35.0). See [Nested relations](/database/relations/#nested-relations) |
| `ModelAdmin` | `model_admin` (a `model-*` feature) | Middleware: list, search, create, edit and delete rows of registered tables, from the live schema; `allow(check)` required (18.35.0). See [Model admin](/database/model-admin/) |
| `MigrationStatus` | `model` | Applied/pending state from `DbPool::migration_status`. See [Migrations](/database/migrations/) |
| `ModelInfo` | `model` | What a `Model` type maps to — `type_name`, `table`, `columns`, `primary_key`, `auto_increment`; `ModelInfo::of::<T>()`, `short_name()` (18.28.0). What `DevTools::model::<T>()` reports. See [dev tools](/mcp/dev-tools/) |
| `Page<T>` | `pagination` (re-exported from `model`) | Offset page: totals, `has_next`/`has_prev`, `.map(f)`, `.link_header(base_url)`; usable without the model layer. See [Pagination](/database/pagination/) |
| `CursorPage<T>` | `pagination` (re-exported from `model`) | Keyset page with `next_cursor`, `.link_header(base_url, cursor_param)` |

## Background work

| Type / Trait | Module | Description |
|---|---|---|
| `Scheduler` | `scheduler` | Recurring tasks: `.every(d, f)`, `.after(d, f)`, `.cron(expr, f)`. See [Scheduler](/features/scheduler/) |
| `CronSchedule` | `scheduler` | Parsed six-field cron expression (`sec min hour day month weekday`); `next_after(epoch)` gives the next matching second (18.35.0) |
| `Job` | `jobs` (`jobs`) | Job trait, implemented for `Fn() -> Result<(), String> + Send` closures. See [Jobs](/features/jobs/) |
| `JobQueue` | `jobs` (`jobs`) | In-memory worker pool with retry and exponential backoff; not crash-safe |
| `PersistentJobQueue` | `jobs` (`jobs` + a `model-*` feature) | Crash-safe queue in a `rws_jobs` table; `(job_type, payload)` jobs dispatched to registered handlers |
| `EnqueueOptions` | `jobs` (`jobs` + a `model-*` feature) | Per-job `run_at`/`run_in`, `queue`, `priority`, `unique(key)`, `max_retries` for `PersistentJobQueue::enqueue_with` (18.35.0). See [Jobs](/features/jobs/#when-where-and-how-often) |
| `JobInfo` | `jobs` (`jobs` + a `model-*` feature) | A job's row (`jobs`, `failed_jobs` — the dead-letter list; `retry`, `delete`, `on_dead`) (18.35.0) |
| `EventBus` / `SubscriptionId` | `events` | Typed in-process events: `subscribe(\|e: &E\| …)`, `publish(&event)`, `forward_to_mcp`, `forward_to_channel` (18.35.0). See [Events](/features/events/) |

## Storage and mail

| Type / Trait | Module | Description |
|---|---|---|
| `Storage` | `storage` | Trait: `put`, `get`, `delete`, `url`. See [Storage](/features/storage/) |
| `StorageError` | `storage` | Error type for storage backends |
| `LocalStorage` | `storage` (`storage-local`) | Files under a root directory; rejects `..`; `.with_base_url(prefix)` |
| `S3Storage` | `storage` (`storage-s3`) | S3-compatible storage with SigV4, no AWS SDK; static keys or IRSA / ECS / IMDSv2 credentials |
| `S3Config` | `storage` (`storage-s3`) | Bucket, region, endpoint, credentials; `from_env()` |
| `AzureBlobStorage` | `storage` (`storage-azure`) | Azure Blob Storage with Shared Key signing or Managed Identity, no Azure SDK |
| `AzureBlobConfig` | `storage` (`storage-azure`) | Account, container, endpoint, credentials; `from_env()` |
| `GcsStorage` | `storage` (`storage-gcs`) | Google Cloud Storage over its JSON API, no Google SDK; Application Default Credentials (token, service account or gcloud file, metadata server) |
| `GcsConfig` | `storage` (`storage-gcs`) | Bucket and endpoint; `from_env()` reads `RWS_GCS_BUCKET`, `RWS_GCS_ENDPOINT` |
| `Mailer` | `mailer` (`mailer`; STARTTLS/SMTPS also need `http-client` or `http2`) | SMTP client; `Mailer::from_env()` reads `RWS_SMTP_*`; `.send(&email)`. See [Email](/features/email/) |
| `Email` | `mailer` (`mailer`) | An RFC 5322 message; `Email::builder()` |
| `EmailBuilder` | `mailer` (`mailer`) | `.to`, `.cc`, `.bcc`, `.reply_to`, `.subject`, `.text`, `.html`, `.build()` (`multipart/alternative` when both bodies are set) |
| `SmtpTls` | `mailer` (`mailer`) | `None` (25), `Starttls` (587, default), `Smtps` (465) |
| `MailerError` | `mailer` (`mailer`) | `MissingConfig`, `Io`, `Smtp`, `Build` |
| `Mail` / `MailAttachment` | `mailer` (`mailer`) | An `Email` with attachments: `Mailer::send_mail`, `deliver_later(&JobQueue, transport)`, `enqueue(&PersistentJobQueue, options)`, `to_payload`/`from_payload` (18.35.0). See [Email](/features/email/#attachments) |
| `Deliver` / `TestMailbox` | `mailer` (`mailer`) | What sends a `Mail` (`Mailer`, or your own); `TestMailbox` keeps it instead (`sent`, `last`, `last_to`) (18.35.0) |
| `MailPreviews` | `mailer` (`mailer`) | Middleware showing sample emails at `/_mail` — development only (18.35.0). See [Previews](/features/email/#previews) |

## Other

| Type / Trait | Module | Description |
|---|---|---|
| `TestClient` | `test_client` | In-process test client — dispatches requests without a TCP socket. `.send_async().await` for `AsyncAppWithState` (18.29.0). See [TestClient](/testing/test-client/) |
| `TestRequest` / `TestResponse` | `test_client` | A request being built (`.header`, `.body_*`, `.send()`); its result (`status`, `header`, `body_text`, `is_streamed`, `take_stream`, `sse()`, `sse_events(n, timeout)` — 18.29.0) |
| `TestWebSocketRequest` / `TestWebSocket` | `test_client` | `client.websocket(path).connect()`: the route's upgrade handler over an in-memory duplex; `send_text`, `send_binary`, `recv`, `recv_text`, `close` (18.29.0). See [WebSocket and SSE](/testing/websocket-sse/) |
| `TestSse` / `SseFrame` / `SseParser` | `test_client` | An event stream read from a test response (`next_event`, `events(n, timeout)`); one event (`event`, `data`, `id`, `retry`); the bounded incremental parser (18.29.0) |
| `assert_openapi_snapshot` / `assert_json_snapshot` / `OpenApiSource` | `test_client` | Compare a document with a committed file, normalized, failing with a diff; `RWS_UPDATE_SNAPSHOTS=1` rewrites it (18.29.0). See [OpenAPI snapshots](/testing/snapshots/) |
| `TestDb` / `TestDbBuilder` | `test_client` (a `model-*` feature) | A database per test: in-memory SQLite with migrations, or a rolled-back transaction on PostgreSQL/MySQL (`postgres_from_env`, `mysql_from_env`) (18.29.0). See [Test databases](/testing/database/) |
| `Factory` / `ModelFactory<T>` / `FactoryValue` | `test_client::factory` (a `model-*` feature) | `T::factory()` from `#[derive(Factory)]`: `.with(…)`, `.build()`, `.create(&pool)`, `*_many`; per-type defaults (18.29.0). See [Factories](/testing/database/#factories) |
| `OpenApiConfig` / `build_spec` | `openapi` (`openapi`) | OpenAPI 3.1 from registered routes; `AppWithState::openapi(config)` adds `/openapi.json` and `/docs`; `.operation(method, pattern, Operation)` adds bodies, responses and parameters. See [OpenAPI](/features/openapi/) |
| `tower::mount`, `TowerApp` | `tower` (`tower`) | A Tower service (tonic, tower-http, axum) as an rws `Application`, under a path prefix or alone. See [Tower interop](/features/tower/) |
| `TowerLayer`, `tower::Next` | `tower` (`tower`) | A Tower layer as rws middleware; `Next` is the rest of the stack it wraps |
| `TowerService` | `tower` (`tower`) | An rws app as a Tower `Service<http::Request<B>>`; `.connection(...)` |
| `tower::Body`, `to_http_request` / `from_http_request` / `to_http_response` / `from_http_response` | `tower` (`tower`) | The `http_body::Body` both ways, and the conversions |
| `Operation` | `openapi` (`openapi`) | One operation's summary, request body, responses, query and path parameters, with schemas from `JsonSchema` types |
| `AcmeConfig` | `acme` (`acme`) | ACME / Let's Encrypt settings; `AcmeConfig::from_env()` reads `RWS_CONFIG_ACME_*`. See [ACME](/features/acme/) |
| `AcmeManager` | `acme` (`acme`) | HTTP-01 provisioning and renewal: `.provision_until_ready().await`, `.run_renewal_loop()` |

:::note[Feature flags]
Items marked with a feature in parentheses compile only with that Cargo feature. See [Features](/getting-started/features/) and `Cargo.toml` for the full list.
:::
