+
+Getting started
+{ .uh-eyebrow }
+
+# Install unihttp
+
+A small core. The dependencies you choose.
+{ .uh-lead }
+
+Install an HTTP backend and a serializer, then start building your API client.
+No need to install every integration.
+
+Python **3.12–3.14** · pip or uv
+{ .uh-install-requirements }
+
+## 1. Install your stack {#choose-your-extras}
+
+Choose your HTTP library, then your model serializer. Run **one** of the two
+commands shown. If you are following the quickstart, keep **Adaptix** selected.
+Not sure which transport fits? [Compare the backends](../integrations/backends.md).
+
+
+Starting fresh? Set up an environment first.
+
+For pip, create an isolated environment with a supported Python interpreter.
+Activate it before running the installation command.
+
+=== "macOS / Linux"
+
+ ```bash
+ python3.12 -m venv .venv
+ source .venv/bin/activate
+ ```
+
+=== "Windows (PowerShell)"
+
+ ```powershell
+ py -3.12 -m venv .venv
+ .venv\Scripts\Activate.ps1
+ ```
+
+Python 3.13 or 3.14 also works; replace the interpreter version above.
+
+For a new uv project, run the following, then use `uv add` below.
+uv manages the project's environment; you do not need to activate it.
+
+```bash
+uv init --python 3.12 my-api-client
+cd my-api-client
+```
+
+More about [pip environments](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)
+and [uv projects](https://docs.astral.sh/uv/guides/projects/).
+
+
+
+
+
+Installing extras makes integrations available; it does **not** select them in
+your code. When you create a client, choose its backend class and pass
+`request_dumper` and `response_loader` explicitly.
+{ .uh-install-note }
+
+## 2. Check the installation
+
+Run this in the same environment where you installed unihttp.
+It prints the installed package version without making a network request.
+
+=== "pip"
+
+ ```bash
+ python -c "from importlib.metadata import version; print(version('unihttp'))"
+ ```
+
+=== "uv"
+
+ ```bash
+ uv run python -c "from importlib.metadata import version; print(version('unihttp'))"
+ ```
+
+
+Package not found, or an import fails?
+
+- **`PackageNotFoundError` or `No module named unihttp`:** activate the environment
+ used for installation, or run your script with `uv run python`. Check that your
+ editor uses that same interpreter.
+- **A backend or serializer module is missing:** rerun the command for the
+ combination you selected. The core package does not install optional integrations.
+- **Python version is incompatible:** use Python 3.12, 3.13, or 3.14. Check the
+ interpreter with `python --version` (or `uv run python --version`).
+- **`from unihttp import BaseMethod` fails:** public types live in submodules.
+ Use `from unihttp.method import BaseMethod`; see the
+ [method reference](../reference/methods.md).
+
+
+
+## 3. Make your first call
+
+The quickstarts use dataclasses and Adaptix with a local demo API.
+Choose the execution model that fits your application.
+
+
+
+[**Build a sync client →** HTTPX, requests, HTTPX2, niquests, zapros, or urllib.](quickstart.md)
+
+[**Build an async client →** HTTPX, aiohttp, HTTPX2, niquests, or zapros.](async.md)
+
+
+
+Using existing models? The [serialization guide](../guides/serialization.md#connect-a-serializer)
+shows Adaptix, Pydantic, and msgspec setup side by side.
+
+## Other installation options
+
+
+Core only, with custom serialization
+
+```bash
+python -m pip install unihttp
+```
+
+This installs the core package, not optional HTTP or serializer dependencies.
+Provide your own [request dumper and response loader](../reference/serializers.md).
+The urllib backend needs no HTTP extra; third-party backends need their matching
+extra or an already-installed dependency.
+
+
+
+
+Run the examples from this repository
+
+For a normal application, use a published package and keep your dependency
+version pinned or locked. To work with the same source as this documentation:
+
+```bash
+git clone https://github.com/goduni/unihttp.git
+cd unihttp
+uv sync --group docs
+uv run --group docs python examples/quickstart.py
+```
+
+This particular example uses HTTPX's mock transport, so it needs no demo server.
+See [versions and migration](../project/releases.md) for release details and
+[contributing](../project/documentation.md) to work on the library or its documentation.
+
+
+
+
diff --git a/site/getting-started/quickstart.md b/site/getting-started/quickstart.md
new file mode 100644
index 0000000..5eb6274
--- /dev/null
+++ b/site/getting-started/quickstart.md
@@ -0,0 +1,127 @@
+---
+title: Build a sync API client
+description: Run a typed unihttp client with HTTPX, requests, HTTPX2, niquests, zapros, or urllib, using dataclasses and Adaptix.
+---
+
+# Build a sync API client
+
+Choose your HTTP library below. Each tab contains its installation command and a
+complete script: the models and endpoint are the same, while the client class
+and import match your backend. All variants use Adaptix for serialization.
+
+Need aiohttp or asynchronous calls? Use the [async quickstart](async.md).
+
+## Start a local demo API {#demo-api}
+
+All tabs call the same local API, so you need no API account or credentials.
+Save the following as `demo_api.py` and run `python demo_api.py` in a separate
+terminal. Keep it running while trying the clients; stop it with Ctrl+C.
+
+
+demo_api.py — standard-library demo server
+
+```python
+--8<-- "examples/demo_api.py"
+```
+
+
+
+The server listens only on `127.0.0.1:8000` and returns
+`{"id": 1, "name": "Ada"}` for `GET /users/1`. This is a local teaching server,
+not a production API.
+
+## Choose your client
+
+In a second terminal, install the dependencies from your tab. Save its Python
+code as `quickstart.py`, then run `python quickstart.py`.
+Every variant prints `User(id=1, name='Ada')`.
+
+=== "HTTPX"
+
+ ```bash
+ pip install "unihttp[httpx,adaptix]"
+ ```
+
+ ```python
+ --8<-- "examples/backends/httpx_sync.py"
+ ```
+
+=== "requests"
+
+ ```bash
+ pip install "unihttp[requests,adaptix]"
+ ```
+
+ ```python
+ --8<-- "examples/backends/requests_sync.py"
+ ```
+
+=== "HTTPX2"
+
+ ```bash
+ pip install "unihttp[httpx2,adaptix]"
+ ```
+
+ ```python
+ --8<-- "examples/backends/httpx2_sync.py"
+ ```
+
+=== "niquests"
+
+ ```bash
+ pip install "unihttp[niquests,adaptix]"
+ ```
+
+ ```python
+ --8<-- "examples/backends/niquests_sync.py"
+ ```
+
+=== "zapros"
+
+ ```bash
+ pip install "unihttp[zapros,adaptix]"
+ ```
+
+ ```python
+ --8<-- "examples/backends/zapros_sync.py"
+ ```
+
+=== "urllib"
+
+ ```bash
+ pip install "unihttp[adaptix]"
+ ```
+
+ ```python
+ --8<-- "examples/backends/urllib_sync.py"
+ ```
+
+## What each part does
+
+- `User` is the response model.
+- `GetUser(BaseMethod[User])` declares the endpoint and its result type.
+- `user_id: Path[int]` fills `{user_id}` in the URL.
+- `bind_method(GetUser)` exposes `get_user(user_id=...)` on the client.
+- `AdaptixDumper` handles request parameters; `AdaptixLoader` builds the result.
+- `with` closes the client when the block finishes.
+
+The bound method's argument types come from the method dataclass constructor.
+Its result is `User`, not an `HTTPResponse`. Editor presentation of descriptors
+can vary; the [binding reference](../reference/methods.md) explains the contract.
+
+## Connect to a real API
+
+Replace `base_url` with your API origin, adjust the endpoint and models to its
+contract, and configure [error handling](../guides/errors.md).
+The selected client creates its underlying HTTP session automatically.
+
+Session settings such as timeouts are backend-specific; see
+[transport configuration](../integrations/backends.md#transport-configuration).
+Do not pass an HTTPX session to a requests, niquests, or other backend.
+
+## Next steps
+
+Continue with [methods and request parameters](../guides/methods.md), or choose
+your next task in the [user guide](../guides/index.md).
+The [async quickstart](async.md) is an alternative to this tutorial, not a
+required next step.
diff --git a/site/guides/errors.md b/site/guides/errors.md
new file mode 100644
index 0000000..28063a4
--- /dev/null
+++ b/site/guides/errors.md
@@ -0,0 +1,173 @@
+---
+title: Handle HTTP and response validation errors
+description: Configure HTTP status exceptions, catch request failures, handle endpoint-specific errors, and validate error bodies in unihttp.
+---
+
+# Handle HTTP and response validation errors
+
+**unihttp does not raise HTTP status errors automatically.** Without explicit
+handling, a `404` or `503` continues to response loading, which may fail because
+the error body does not match your model.
+
+Use status mapping for general HTTP errors and method hooks for endpoint-specific
+rules. Catch exceptions around the client call.
+
+## Handle an endpoint-specific error
+
+This method uses `User` from the [quickstart](../getting-started/quickstart.md).
+It treats a missing user specially and leaves other statuses to the mapper below:
+
+```python
+from dataclasses import dataclass
+
+from unihttp.http.response import HTTPResponse
+from unihttp.markers import Path
+from unihttp.method import BaseMethod
+
+--8<-- "examples/recipes.py:errors"
+```
+
+There is deliberately no catch-all `raise_for_status()` here. Letting `5xx`
+responses reach middleware allows [status-based retries](../recipes/retries.md)
+to run before an exception is raised.
+
+## Map statuses across endpoints
+
+Use `ClientError` for `4xx` and `ServerError` for `5xx`. Both inherit from
+`HTTPStatusError` and expose `.status_code` and `.response` (the unihttp
+`HTTPResponse`, not the backend's raw response).
+
+These HTTPX examples attach the mapper to the bound method. The same pattern
+works with another [client backend](../integrations/backends.md).
+
+```python
+from unihttp.bind_method import bind_method
+from unihttp.exceptions import ClientError, ServerError
+```
+
+=== "Sync"
+
+ ```python
+ from unihttp.clients.httpx import HTTPXSyncClient
+ from unihttp.middlewares import SyncErrorMapperMiddleware
+
+ --8<-- "examples/response_errors.py:sync"
+ ```
+
+=== "Async"
+
+ ```python
+ from unihttp.clients.httpx import HTTPXAsyncClient
+ from unihttp.middlewares import AsyncErrorMapperMiddleware
+
+ --8<-- "examples/response_errors.py:async"
+ ```
+
+Construct the client with your base URL and serializers as in the quickstart.
+To apply the policy to **all endpoints**, pass `middleware=[status_errors]`
+(or `[async_status_errors]`) to the client constructor instead of repeating it
+on each binding. Client-level middleware wraps method-level middleware.
+
+Mapping keys accept an integer, a range, or a tuple of integers. An exception
+class receives `(message, response)`; use a factory for another constructor,
+for example `404: lambda response: UserNotFound("User does not exist")`.
+The first matching mapping wins.
+
+The mapper only sees responses that return from the inner handler. A validation
+or error hook that has already raised bypasses status mapping. In this example,
+`404` raises `UserNotFound` in the method; other `4xx` and `5xx` reach the mapper.
+Unfollowed redirects are not covered by these `4xx`/`5xx` mappings.
+
+## Catch failures at the call site
+
+These helpers return `User | None`. They use an already configured client and
+the following imports:
+
+```python
+import logging
+
+from unihttp.exceptions import HTTPStatusError, NetworkError, RequestTimeoutError
+
+logger = logging.getLogger(__name__)
+```
+
+=== "Sync"
+
+ ```python
+ --8<-- "examples/response_errors.py:catch-sync"
+ ```
+
+=== "Async"
+
+ ```python
+ --8<-- "examples/response_errors.py:catch-async"
+ ```
+
+Only a missing user becomes `None`. Other failures propagate after logging.
+The HTTP error log includes the request ID header, when present, to help trace
+the failed call without logging its response body.
+
+The error types describe different stages:
+
+| Failure | What to handle |
+| --- | --- |
+| Network failure or timeout | `NetworkError` or `RequestTimeoutError`; do not assume an HTTP response exists. |
+| Unsuccessful HTTP status | Exceptions configured by your mapper or error hooks. |
+| API error inside a successful HTTP response | Your own exception from `validate_response`, as below. |
+| Body does not match the declared result | The configured serializer's loading exception; this is not an HTTP status error. |
+
+Avoid treating all of these as “user not found” or retrying every exception.
+
+## Validate an error inside HTTP 200
+
+Some APIs return `{"ok": false, "error": "Account disabled"}` with status `200`.
+Use `validate_response` to reject that body before model loading:
+
+```python
+--8<-- "examples/response_errors.py:validation"
+```
+
+This example checks successful statuses only, so a `503` error body can still
+reach retry middleware. On success it expects the ordinary `User` payload.
+If your API wraps successful data too, combine validation with
+[envelope unwrapping](responses.md#unwrap-a-json-envelope).
+
+For a rule shared by all endpoints, override
+`client.validate_response(response, method)` instead. The method hook only takes
+`response`. Validation and error hooks remain synchronous `def` methods on
+async clients too.
+
+## Return a fallback deliberately
+
+`on_error` is a raise-or-continue hook: its return value is ignored. Returning
+`None` there does **not** make the client call return `None`.
+
+Catch a specific exception in application code, as above, or in a regular client
+method when the fallback is part of your SDK's public API. A custom
+`make_response` can also return a fallback, but only if earlier hooks and
+middleware allow that response through.
+
+## Understand the pipeline
+
+For a buffered call:
+
+1. Enter middleware, outermost first: client middleware, then method/call middleware.
+2. Send the request and construct `HTTPResponse`.
+3. Run `client.validate_response(response, method)`, then `method.validate_response(response)`.
+4. If `response.ok` is false, run `method.on_error(response)`, then `client.handle_error(response, method)`.
+5. Return through middleware, innermost first.
+6. Call `method.make_response(response, response_loader=...)` to produce the public result.
+
+An exception interrupts the sequence and propagates through the enclosing
+middleware. The final `make_response` is outside that chain.
+
+`response.raise_for_status()` is useful inside a hook when you want immediate
+`ClientError`/`ServerError` for `4xx`/`5xx`, but doing so prevents middleware from
+retrying by status. Do not add it to the `GetUser` above when following the
+[retry recipe](../recipes/retries.md).
+
+## Return a model with response metadata
+
+For successful results with headers or status, see
+[Response data and metadata](responses.md#return-a-model-with-response-metadata).
+[Streaming](streaming.md) has a different lifecycle and no buffered validation.
diff --git a/site/guides/index.md b/site/guides/index.md
new file mode 100644
index 0000000..5c7ea07
--- /dev/null
+++ b/site/guides/index.md
@@ -0,0 +1,60 @@
+---
+title: User guide
+description: "Find unihttp guides by task: declare requests, configure clients, serialize models, and handle responses, errors, and streaming."
+---
+
+# User guide
+
+Start with the part of your client you are working on. Each guide explains the
+behavior and links to a focused example or the corresponding API reference.
+You do not need to read these pages in order.
+
+**New to unihttp?** [Install it](../getting-started/installation.md), then follow
+either the [sync](../getting-started/quickstart.md) or
+[async quickstart](../getting-started/async.md). Both build the same API client.
+
+## Requests
+
+Define what each endpoint sends.
+
+- [Methods and parameters](methods.md): URLs, HTTP verbs, path and query
+ parameters, headers, JSON bodies, and method binding.
+- [Optional fields and Omitted](../recipes/partial-updates.md): distinguish a
+ missing field from an explicit null.
+- [File uploads](../recipes/files.md): send multipart files and form fields.
+
+## Clients and middleware
+
+Choose how requests are sent and what runs around each call.
+
+- [HTTP backends](../integrations/backends.md): compare sync and async clients,
+ configure sessions, and switch transports.
+- [Middleware](middleware.md): apply behavior per client or per method and
+ understand request/response ordering.
+- [Authentication](../recipes/authentication.md): attach bearer tokens through
+ middleware.
+
+## Serialization
+
+Choose how method fields become request data and responses become Python models.
+
+- [Serialization](serialization.md): connect Adaptix, Pydantic, or msgspec;
+ customize field names and values; distinguish model conversion from JSON encoding.
+
+## Responses and errors
+
+Decide what your client returns and how it handles failures.
+
+- [Response data and metadata](responses.md): return typed results with status
+ codes and headers when needed.
+- [Error handling](errors.md): validate responses and map HTTP statuses to
+ application exceptions.
+- [Retries](../recipes/retries.md): configure bounded retries and correct
+ middleware ordering for calls that are safe to repeat.
+- [Streaming downloads](streaming.md): consume response chunks and close streams.
+
+## Need an exact signature?
+
+The [API reference](../reference/index.md) lists public types, constructor
+arguments, protocols, and hooks. Use it for symbol lookup; use these guides for
+behavior and examples.
diff --git a/site/guides/methods.md b/site/guides/methods.md
new file mode 100644
index 0000000..d710ce1
--- /dev/null
+++ b/site/guides/methods.md
@@ -0,0 +1,100 @@
+---
+title: Define methods and request parameters
+description: Map typed dataclass fields to HTTP paths, query strings, headers, JSON, forms, files, and raw request bodies.
+---
+
+# Define methods and request parameters
+
+Import from submodules, such as `unihttp.method` and `unihttp.markers`.
+The top-level `unihttp` package does not re-export these names.
+
+A method is a dataclass subclass of `BaseMethod[Result]`. Set `__url__` and
+`__method__`, then mark each parameter with its HTTP location.
+
+## JSON request bodies
+
+This excerpt defines a method returning a `User`. Import `dataclass` from
+`dataclasses`, `Body` from `unihttp.markers`, and `BaseMethod` from
+`unihttp.method`.
+
+```python
+--8<-- "examples/recipes.py:models"
+```
+
+Binding it with `create_user = bind_method(CreateUser)` gives a method that
+accepts `name="Ada"` and sends `{"name": "Ada"}`.
+
+A field `user: Body[User]` sends a **nested** object
+`{"user": {"id": 1, "name": "Ada"}}`. Do not assume it flattens the model.
+
+## Marker reference
+
+| Marker | Location | Example |
+| --- | --- | --- |
+| `Path[T]` | URL placeholder | `user_id: Path[int]` |
+| `Query[T]` | Query string | `page: Query[int] = 1` |
+| `Header[T]` | Request header | `authorization: Header[str]` |
+| `Body[T]` | JSON object field | `name: Body[str]` |
+| `Form[T]` | Form field | `caption: Form[str]` |
+| `File[T]` | Multipart file | `avatar: File[UploadFile]` |
+| `Raw[T]` | Entire raw body | `content: Raw[bytes]` |
+
+Every URL placeholder needs a matching path field. Missing placeholders fail
+when building the request. Header wire names and camelCase fields can be
+configured with [Adaptix name mapping](serialization.md#rename-fields-without-changing-python-names).
+
+`Body` cannot be combined with `Form` or `File`. `Raw` cannot be combined
+with any of those three. Use `Form` for the scalar fields of a multipart request.
+
+**Raw bodies currently require Adaptix or a custom dumper.** The Pydantic and
+msgspec dumpers do not emit a raw body. See [serialization](serialization.md).
+
+For an entire byte payload, import `Raw` from `unihttp.markers` and define:
+
+```python
+--8<-- "examples/recipes.py:raw"
+```
+
+This method sends bytes and expects a JSON acknowledgement such as
+`{"size": 7}`. `Raw` controls the **request body only**; the response still passes
+through the configured loader. Set an appropriate `Content-Type` header for the
+remote endpoint; a raw body does not imply a JSON content type.
+
+For a binary response, use [streaming](streaming.md), which bypasses response
+deserialization, or explicitly customize response processing. Declaring
+`BaseMethod[bytes]` alone is not sufficient with the default Adaptix loader:
+it expects a base64 string when loading bytes, not a raw HTTP byte payload.
+
+## Binding and custom methods
+
+Prefer `bind_method` for a direct endpoint. When you need preprocessing,
+compose a normal client method that calls
+`self.call_method(CreateUser(name=name.strip()))`.
+
+`call_method` accepts a method instance and returns the declared result.
+It is awaitable on async clients. Streaming uses
+[StreamMethod](streaming.md) and `call_method_stream`.
+
+
+
+## URL joining
+
+All built-in unihttp backends combine `base_url` with the method's URL using
+`urllib.parse.urljoin` before passing the result to the HTTP library. This is
+unihttp's URL handling, not the underlying library's `base_url` behavior.
+
+With `base_url="https://example.com/api/"`:
+
+- `/users` resolves to `https://example.com/users`, replacing the `/api/` prefix.
+- `users` resolves to `https://example.com/api/users`, preserving the prefix.
+
+To preserve a path prefix, keep the trailing slash on `base_url` and omit the
+leading slash from the method's URL. Without the trailing slash,
+`https://example.com/api` combined with `users` resolves to
+`https://example.com/users`.
+
+## Optional fields
+
+Use [Omitted](../recipes/partial-updates.md) to distinguish an absent parameter
+from an explicit `None`. Query encoding of booleans and lists is
+backend-dependent; verify it against the target API.
diff --git a/site/guides/middleware.md b/site/guides/middleware.md
new file mode 100644
index 0000000..b15601f
--- /dev/null
+++ b/site/guides/middleware.md
@@ -0,0 +1,203 @@
+---
+title: Configure and write middleware
+description: Write sync and async unihttp middleware, attach it to a client or an individual call, and understand execution order.
+---
+
+# Configure and write middleware
+
+Middleware adds behavior around a request without changing your endpoint
+definitions. Use it to attach authentication, measure request time, retry a
+failure, or inspect a response.
+
+## Write a middleware
+
+Let's measure how long a request takes and log its status code.
+The middleware calls `next_handler(request)` to continue the request, then
+works with the response before returning it to the client.
+
+=== "Sync"
+
+ ```python
+ import logging
+ from time import perf_counter
+
+ from unihttp.http.request import HTTPRequest
+ from unihttp.http.response import HTTPResponse
+ from unihttp.middlewares import Handler, Middleware
+
+ logger = logging.getLogger("unihttp.timing")
+
+
+ --8<-- "examples/middleware_sync.py:19:30"
+ ```
+
+=== "Async"
+
+ ```python
+ import logging
+ from time import perf_counter
+
+ from unihttp.http.request import HTTPRequest
+ from unihttp.http.response import HTTPResponse
+ from unihttp.middlewares import AsyncHandler, AsyncMiddleware
+
+ logger = logging.getLogger("unihttp.timing")
+
+
+ --8<-- "examples/middleware_async.py:20:33"
+ ```
+
+The code before `next_handler` runs on the way out; the code after it runs on
+the way back. Return the response so the client can finish processing it.
+For async clients, use `AsyncMiddleware` and await the handler.
+
+This example logs only requests for which the inner handler returns a response.
+If the transport or a response hook raises, the exception passes through
+unchanged. It does not log credentials, URLs, or response bodies.
+
+## Attach it to a client
+
+Continue with `UserClient` from the [sync quickstart](../getting-started/quickstart.md)
+or [async quickstart](../getting-started/async.md), using the matching middleware
+above. Import the serializers alongside your other imports:
+
+```python
+from unihttp.serializers.adaptix import DEFAULT_RETORT, AdaptixDumper, AdaptixLoader
+```
+
+Pass your API's base URL to `main`; the default below points to the local demo API:
+
+=== "Sync"
+
+ ```python
+ --8<-- "examples/middleware_sync.py:54:63"
+ ```
+
+=== "Async"
+
+ ```python
+ --8<-- "examples/middleware_async.py:57:66"
+ ```
+
+Every call through this client now passes through the timing middleware.
+It works with any backend that supports the selected sync or async mode.
+
+If your application has not configured logging, enable INFO messages once at
+startup with `logging.basicConfig(level=logging.INFO)`. An example message is
+`GET → 200 in 42.1 ms`; the measured time will vary.
+
+## Choose where it runs
+
+Use the client constructor for behavior shared by every endpoint. To apply
+middleware to just one call, pass it to `call_method` instead:
+
+=== "Sync"
+
+ ```python
+ user = client.call_method(
+ GetUser(user_id=1),
+ middleware=[TimingMiddleware()],
+ )
+ ```
+
+=== "Async"
+
+ ```python
+ user = await client.call_method(
+ GetUser(user_id=1),
+ middleware=[AsyncTimingMiddleware()],
+ )
+ ```
+
+These snippets use the quickstart's `GetUser` and an open client. Per-call
+middleware is **added to**, not substituted for, client-level middleware.
+Do not register the timing middleware at both levels unless you want two
+measurements.
+
+To run it whenever a particular bound method is called, add it to that binding:
+
+=== "Sync"
+
+ ```python
+ get_user = bind_method(GetUser, middleware=[TimingMiddleware()])
+ ```
+
+=== "Async"
+
+ ```python
+ get_user = bind_method(GetUser, middleware=[AsyncTimingMiddleware()])
+ ```
+
+Replace the `get_user` declaration inside your client class with this line.
+A direct `client.call_method(GetUser(...))` does not use middleware attached to
+the binding. The same per-call mechanism is available on `call_method_stream`.
+
+## Scope and ordering
+
+Middleware runs in list order on the request and in reverse order on the
+response. Client-level middleware wraps per-call or bound-method middleware:
+
+```text
+Request: client middleware → call/binding middleware → transport
+Response: client middleware ← call/binding middleware ← transport
+```
+
+For a list `[A, B]`, A runs first and receives B's response. This matters when
+combining [retries](../recipes/retries.md) with
+[error mapping](errors.md#map-statuses-across-endpoints): an outer error mapper can act
+on the final response after an inner retry middleware has finished.
+
+Response validation and error hooks run inside the chain. The final
+`make_response` step, which loads the declared return type, runs after
+middleware returns. For streaming calls, timing ends when the stream is
+returned, not when the caller has consumed the download.
+
+## Built-in middleware
+
+You do not need to write your own middleware for these common tasks:
+
+| Purpose | Sync | Async |
+| --- | --- | --- |
+| Status mapping | `SyncErrorMapperMiddleware` | `AsyncErrorMapperMiddleware` |
+| Retries | `RetryMiddleware` | `AsyncRetryMiddleware` |
+| Logging | `LoggingMiddleware` | `AsyncLoggingMiddleware` |
+
+Import these from `unihttp.middlewares`. See [error handling](errors.md) and
+[retries](../recipes/retries.md) for configuration, or
+[authentication](../recipes/authentication.md) for a middleware that adds a token.
+
+When modifying headers, use `request.header` (singular) for the outgoing
+request and `response.headers` (plural) for the response. Avoid logging
+credentials or sensitive payloads.
+
+## Run the standalone examples
+
+The repository's middleware examples each contain their own model, method,
+client, and entry point. They do not import another example. Install
+`unihttp[httpx,adaptix]`, then start the demo API in a separate terminal:
+
+```bash
+python examples/demo_api.py
+```
+
+Run either timing example:
+
+=== "Sync"
+
+ ```bash
+ python examples/middleware_sync.py
+ ```
+
+=== "Async"
+
+ ```bash
+ python examples/middleware_async.py
+ ```
+
+Each prints the user and logs the request's status and elapsed time.
+
+For a concrete scoping example, run `python examples/middleware_scope.py`.
+It adds a fresh `X-Request-ID` to every request and sets `Cache-Control: no-cache`
+only on the bound method and the explicit call that opts in. A direct call
+without that middleware receives only the request ID. `no-cache` asks caches
+to revalidate a stored response; it does not prohibit storing it.
diff --git a/site/guides/responses.md b/site/guides/responses.md
new file mode 100644
index 0000000..a649b60
--- /dev/null
+++ b/site/guides/responses.md
@@ -0,0 +1,148 @@
+---
+title: Work with response data and metadata
+description: Return typed models and lists, unwrap JSON envelopes, and include HTTP status codes and headers in unihttp results.
+---
+
+# Work with response data and metadata
+
+A regular, buffered call returns your declared Python result. You work with a
+`User` or `list[User]`, rather than an HTTP response object.
+
+This page builds on the [quickstart](../getting-started/quickstart.md). Configure
+[HTTP error handling](errors.md#map-statuses-across-endpoints) before loading
+responses: unihttp does not raise for unsuccessful statuses by default.
+
+## Return a typed model or list
+
+Given a response model:
+
+```python
+from dataclasses import dataclass
+
+--8<-- "examples/response_metadata.py:model"
+```
+
+A `BaseMethod[User]` returns a `User`. For a JSON array such as
+`[{"id": 1, "name": "Ada"}]`, declare `list[User]` instead:
+
+```python
+from unihttp.method import BaseMethod
+
+--8<-- "examples/response_metadata.py:list"
+```
+
+Bind it with `list_users = bind_method(ListUsers)` on your client:
+
+=== "Sync"
+
+ ```python
+ users = client.list_users()
+ for user in users:
+ print(user.name)
+ ```
+
+=== "Async"
+
+ ```python
+ users = await client.list_users()
+ for user in users:
+ print(user.name)
+ ```
+
+The configured response loader converts the body into the declared type.
+See [serialization](serialization.md) for model support and field conversions.
+Changing the return type does not change what the remote API sends.
+
+## Unwrap a JSON envelope
+
+If the API returns `{"data": {"id": 1, "name": "Ada"}}`, but callers should
+receive just `User`, configure the response serializer once. With Adaptix, add
+a loader that extracts `data` before normal model loading:
+
+```python
+from operator import itemgetter
+
+from adaptix import Chain, loader
+from unihttp.serializers.adaptix import DEFAULT_RETORT, AdaptixLoader
+
+--8<-- "examples/response_metadata.py:envelope-loader"
+```
+
+Pass `response_loader=envelope_loader` when constructing the client. Keep your
+request dumper unchanged. `Chain.FIRST` passes the extracted payload to Adaptix's
+existing `User` loader, preserving its field conversion and validation.
+
+The method only declares the result type; it does not need `make_response`:
+
+```python
+from unihttp.markers import Path
+
+--8<-- "examples/response_metadata.py:envelope"
+```
+
+Bind `GetWrappedUser` as usual. The same response loader works with sync and async
+clients and any method returning this wrapped `User`.
+
+The rule targets **the type, not a particular endpoint**: every `User` loaded
+by this Retort must have a `data` wrapper, including users nested in other models
+or lists. It does not unwrap an envelope around an entire `list[User]`. If the
+same API also returns plain users, use a separate response type for wrapped users
+or a separate client/loader configuration. The plain array example above uses
+the default loader, not `envelope_loader`.
+
+This loader changes loading only; it does not add a wrapper when dumping `User`.
+For the underlying mechanism, see Adaptix's
+[provider chaining](https://adaptix.readthedocs.io/en/latest/loading-and-dumping/tutorial.html#provider-chaining).
+Handle API-specific error envelopes with
+[`validate_response`](errors.md#validate-an-error-inside-http-200) before loading.
+
+## Return a model with response metadata
+
+When callers need the status or a header alongside the body, declare a wrapper
+as the method's result. Unlike a JSON envelope, HTTP metadata is not part of the
+body passed to the serializer, so this is a use case for `make_response`.
+Here the API returns plain user JSON and the client uses the default response
+loader from the quickstart, without the envelope recipe above:
+
+```python
+from unihttp.http.response import HTTPResponse
+from unihttp.serialize import ResponseLoader
+
+--8<-- "examples/response_metadata.py:metadata"
+```
+
+The hook loads the body into `User`, then adds the status and `X-Request-ID`
+header. A missing header becomes `None`. After binding this `GetUser`:
+
+=== "Sync"
+
+ ```python
+ result = client.get_user(user_id=1)
+ print(result.user.name, result.status_code, result.request_id)
+ ```
+
+=== "Async"
+
+ ```python
+ result = await client.get_user(user_id=1)
+ print(result.user.name, result.status_code, result.request_id)
+ ```
+
+`HTTPResponse` also exposes `.cookies` and `.data`; see
+[HTTP types](../reference/http.md) for all fields.
+
+## How custom response loading works
+
+`make_response` remains a regular `def`, even on async clients. Keep the parameter
+name `response_loader`: the client passes it by keyword.
+
+This hook runs after validation, error handling, and the middleware chain.
+Exceptions from the final conversion propagate to the caller; middleware does
+not intercept or retry them. See [the response pipeline](errors.md#understand-the-pipeline)
+for the complete order.
+
+## When the response is a stream
+
+Streaming calls return `HTTPResponse` directly, with a stream in `.data`.
+They do not call `make_response` or the buffered response loader. See
+[streaming downloads](streaming.md) for reading and closing them safely.
diff --git a/site/guides/serialization.md b/site/guides/serialization.md
new file mode 100644
index 0000000..98c52ff
--- /dev/null
+++ b/site/guides/serialization.md
@@ -0,0 +1,231 @@
+---
+title: Serialization
+description: Choose Adaptix, Pydantic, or msgspec for unihttp. Configure field names, custom value conversion, typed responses, and the HTTP JSON codec.
+---
+
+# Serialization
+
+**Adaptix is the recommended serializer for new unihttp clients.** It works
+with plain dataclasses and TypedDicts, keeps conversion rules outside your
+models, and supports field-name mapping and raw request bodies.
+
+If your application already uses Pydantic or msgspec models, reuse them with
+the matching integration. Adaptix is a recommendation, not an automatic default:
+you explicitly configure a `request_dumper` and a `response_loader`.
+
+| Integration | Choose it when |
+| --- | --- |
+| **Adaptix — recommended** | You want dataclasses or TypedDicts and configurable request/response conversion. |
+| Pydantic | You already use `BaseModel` response models and their validation rules. |
+| msgspec | You already use `msgspec.Struct` response models. |
+
+## Connect a serializer
+
+The **dumper** converts a method instance into request components such as
+query parameters and body fields. The **loader** converts a parsed response
+body into the method's declared result type.
+
+Choose the serializer extra alongside your HTTP backend in
+[Installation](../getting-started/installation.md). The following alternatives
+all describe the same endpoint: send a user name and receive a typed `User`.
+Method declarations remain dataclasses in every variant.
+
+=== "Adaptix"
+
+ ```python
+ --8<-- "examples/serialization/adaptix.py:setup"
+ ```
+
+=== "Pydantic"
+
+ ```python
+ --8<-- "examples/serialization/pydantic.py:setup"
+ ```
+
+=== "msgspec"
+
+ ```python
+ --8<-- "examples/serialization/msgspec.py:setup"
+ ```
+
+Pass `request_dumper` and `response_loader` to your client constructor, as in
+the [quickstart](../getting-started/quickstart.md). You can bind `CreateUser`
+with `bind_method` or pass an instance to `call_method`.
+
+In all three variants:
+
+- `CreateUser(user_name="Ada")` produces the body fields `{"user_name": "Ada"}`.
+- A response `{"id": 1, "user_name": "Ada"}` becomes a `User` instance.
+- The serializer choice does not depend on the HTTP backend or sync/async mode.
+
+
+
+## Customize Adaptix
+
+A **retort** holds Adaptix's loading and dumping rules. Start from unihttp's
+`DEFAULT_RETORT`: it includes support for request markers, omitted fields,
+uploads, and raw request bodies. By default it also ignores extra response
+fields, so your DTO can model only the data your application needs.
+
+Use `DEFAULT_RETORT.extend(recipe=[...])` to add rules while retaining these
+integrations. It returns a new retort without modifying the original.
+Create it once during client setup and reuse it for subsequent calls.
+
+The examples below use `User` and `CreateUser` from the **Adaptix** tab above.
+
+### Rename fields without changing Python names
+
+Suppose the API uses `userName`, but your Python fields use `user_name`.
+Import `name_mapping` from `adaptix` and configure both directions:
+
+```python
+--8<-- "examples/serialization/customization.py:global-mapping"
+```
+
+Now `CreateUser(user_name="Ada")` produces `{"userName": "Ada"}`, and
+`{"id": 1, "userName": "Ada"}` loads as `User(id=1, user_name="Ada")`.
+
+This rule applies to every model and method field named `user_name` handled
+by that retort. If only these two types use the API's spelling, scope the rule:
+
+```python
+--8<-- "examples/serialization/customization.py:scoped-mapping"
+```
+
+Use `AdaptixDumper(scoped_retort)` and `AdaptixLoader(scoped_retort)` with this
+variant. Mapping the response model alone does not rename fields declared on
+the request method: both classes need a rule.
+
+### Transform a value before sending it
+
+You can also change a field's value without changing the method definition.
+For example, trim surrounding whitespace from a user name before sending it.
+Import `P` and `dumper` from `adaptix`:
+
+```python
+--8<-- "examples/serialization/customization.py:normalize"
+```
+
+`P[CreateUser].user_name` selects that field on that method only.
+The new retort extends the name-mapping example, so
+`CreateUser(user_name=" Ada ")` produces `{"userName": "Ada"}`.
+
+The method instance is not mutated. This is a dumping rule: it does not trim
+names when loading a response. Use a `loader` rule for input conversion.
+
+### Read and write a custom wire format
+
+Suppose an events API sends Unix timestamps, while your Python code uses
+timezone-aware `datetime` values. Add these imports:
+
+```python
+from datetime import UTC, datetime
+
+from adaptix import P, dumper, loader
+```
+
+Define the response model and request method using the Python type:
+
+```python
+--8<-- "examples/serialization/customization.py:event-models"
+```
+
+Then configure the response field's loader and the request field's dumper:
+
+```python
+--8<-- "examples/serialization/customization.py:timestamps"
+```
+
+| Direction | Input | Converted value |
+| --- | --- | --- |
+| Response → model | `{"id": 1, "starts_at": 1704067200}` | `Event(id=1, starts_at=datetime(2024, 1, 1, tzinfo=UTC))` |
+| Method → body | `CreateEvent(starts_at=datetime(2024, 1, 1, tzinfo=UTC))` | `{"starts_at": 1704067200.0}` |
+
+Use aware datetimes so the timestamp does not depend on the machine's local
+timezone. Custom conversion functions are responsible for accepting and
+validating the API's wire format; these rules do not change unrelated fields.
+
+For more recipes and selection rules, see the official
+[Adaptix loading and dumping tutorial](https://adaptix.readthedocs.io/en/latest/loading-and-dumping/tutorial.html)
+and [name-mapping reference](https://adaptix.readthedocs.io/en/latest/loading-and-dumping/extended-usage.html#name-mapping).
+
+## What is shared, and what differs
+
+### Optional and nested fields
+
+All three integrations support ordinary marked request fields. With the
+documented `Omittable[T] = Omitted()` pattern, they omit the field instead of
+sending the sentinel. See [Optional fields and Omitted](../recipes/partial-updates.md)
+for query, header, and body examples; omission is not specific to PATCH.
+
+A field such as `user: Body[User]` produces a nested `user` object.
+It does not flatten the model into the outer request body.
+
+### Validation errors
+
+Response model validation or conversion errors propagate from the chosen
+serialization library. A successful HTTP status does not guarantee that the
+response matches your model. See [error handling](errors.md) for where
+validation and response loading occur in the request pipeline.
+
+
+
+### Pydantic specifics
+
+The loader uses Pydantic's `TypeAdapter` to validate the declared response
+type, including your `BaseModel` configuration. The request dumper uses
+the method dataclass's field names as request keys. An alias on a response
+model does not rename a separate method field.
+
+See [Pydantic's documentation](https://docs.pydantic.dev/latest/) for model
+validation and aliases.
+
+
+
+### msgspec specifics
+
+The request dumper converts field values with `msgspec.to_builtins`; the loader
+uses `msgspec.convert` to construct your declared response type.
+Selecting these classes does not switch the HTTP client's JSON codec to
+`msgspec.json`.
+
+See [msgspec's documentation](https://jcristharif.com/msgspec/) for model
+configuration and conversion behavior.
+
+### Raw request bodies
+
+Adaptix supports `Raw` fields. The Pydantic and msgspec dumpers currently
+populate path, query, header, body, file, and form data, but not `raw`.
+For raw payloads, use Adaptix or implement your own
+[request dumper](../reference/serializers.md).
+
+## Unwrap a response envelope
+
+If an API wraps its payload in `data`, configure an Adaptix loader with
+`Chain.FIRST` to extract it before model loading. This keeps the transformation
+in the Retort instead of repeating it in each method's `make_response`.
+See [Unwrap a JSON envelope](responses.md#unwrap-a-json-envelope) for the recipe,
+client configuration, and type-scoping considerations.
+
+## JSON codec versus model serialization
+
+`json_dumps` and `json_loads` control the HTTP transport's JSON encoding and
+decoding. They do not replace the dumper that extracts request fields or the
+loader that constructs your response model.
+
+For example, install `orjson`, import it, and add these arguments to your
+existing client constructor:
+
+```python
+--8<-- "examples/json_codec.py:codec"
+```
+
+Keep the same `request_dumper` and `response_loader`. The dump callable must
+return a string, which is why the example decodes the bytes returned by
+`orjson.dumps`.
+
+An empty response may be represented as `None`, and non-JSON response handling
+depends on the backend. Make your method's response handling match the API;
+choosing a JSON codec does not turn arbitrary response bytes into a typed model.
+For binary downloads, use [streaming](streaming.md). For response headers and
+status alongside a model, see [Response data and metadata](responses.md).
diff --git a/site/guides/streaming.md b/site/guides/streaming.md
new file mode 100644
index 0000000..4369131
--- /dev/null
+++ b/site/guides/streaming.md
@@ -0,0 +1,117 @@
+---
+title: Stream HTTP response bodies
+description: Consume unihttp downloads incrementally, reject failed responses, and close sync or async streams even when reading fails.
+---
+
+# Stream HTTP response bodies
+
+Use `StreamMethod` to consume a response without loading the whole body into
+memory. The call returns an `HTTPResponse` with status and headers available;
+`.data` is a `ChunkStream` or `AsyncChunkStream` of bytes.
+
+## Define a download method
+
+Handle unsuccessful statuses in the method so a failed download cannot silently
+look like an empty successful response:
+
+```python
+from dataclasses import dataclass
+
+from unihttp.exceptions import HTTPStatusError
+from unihttp.http.response import HTTPResponse
+from unihttp.markers import Path
+from unihttp.method import StreamMethod
+
+--8<-- "examples/response_streaming.py:method"
+```
+
+`on_error` runs only for non-2xx responses. `raise_for_status()` raises
+`ClientError` for `4xx` and `ServerError` for `5xx`; the final raise also rejects
+other unsuccessful statuses, including an unfollowed redirect.
+
+Bind the method with `download_file = bind_method(DownloadFile)` on your sync
+`FileClient` or async `AsyncFileClient`. Import `bind_method` from
+`unihttp.bind_method`; it chooses the streaming path automatically. Configure
+the client as in the [quickstart](../getting-started/quickstart.md) and keep it
+open until reading finishes.
+
+## Read and close a stream
+
+For example, calculate a download's SHA-256 checksum one chunk at a time.
+These functions take an already configured, open client:
+
+```python
+from hashlib import sha256
+```
+
+=== "Sync"
+
+ ```python
+ --8<-- "examples/response_streaming.py:sync"
+ ```
+
+=== "Async"
+
+ ```python
+ --8<-- "examples/response_streaming.py:async"
+ ```
+
+The stream context manager closes the underlying response when reading finishes,
+raises, or exits early. Use it even if you only need the first few chunks.
+The functions return a checksum only after the whole stream has been read;
+request and read failures propagate to the caller.
+
+Keep the separate `response` variable when you also need `.headers` or
+`.status_code`. For file downloads, your consumer can write each chunk to a file;
+only publish the completed file after the entire read succeeds. Async consumers
+should avoid blocking file I/O on the event loop.
+
+## Choose the chunk size
+
+Pass `__chunk_size__=8192` when calling the bound method or constructing
+`DownloadFile(file_id=1, __chunk_size__=8192)`. The default is 65536 bytes.
+
+For an explicit unbound call, use
+`client.call_method_stream(DownloadFile(file_id=1))`, awaiting it on an async
+client. Do not use the buffered `call_method` for a `StreamMethod`.
+
+## Errors and parsing
+
+There are two places a download can fail: opening the response and consuming
+its body. A `try/except` must cover both, not just `client.download_file(...)`.
+For the helpers above, catch around the entire `download_checksum(...)` call
+(or its awaited async equivalent):
+
+- `HTTPStatusError` covers rejected statuses, including the `ClientError` and
+ `ServerError` subclasses raised by this method.
+- `NetworkError` and `RequestTimeoutError` can occur while opening or reading.
+- Exceptions from your own consumer also propagate; the stream context still
+ closes the response.
+
+Import these exceptions from `unihttp.exceptions`. See
+[Error handling](errors.md#catch-failures-at-the-call-site) for catch patterns.
+
+### Error bodies are not buffered
+
+Streaming skips `validate_response`, `make_response`, and the response loader.
+For any non-2xx status, the client closes the stream **before** calling
+`method.on_error` and `client.handle_error`. Those hooks can inspect status and
+headers, but cannot read the error body from the closed stream.
+
+The default hooks do not raise: without the explicit handling above, a `404`
+can return a stream yielding no chunks. If you need to parse an API's error
+body, use a buffered method instead.
+
+### Chunks are not messages
+
+Chunks contain bytes, not complete JSON documents, lines, or SSE events. A chunk
+boundary can even split a multi-byte character. Incremental decoding and message
+framing belong in your consumer.
+
+### Retries do not resume a download
+
+The [buffered retry recipe](../recipes/retries.md) cannot resume an interrupted
+download and should not be attached to this method. A retry strategy needs to
+close the previous response and decide whether to restart or resume using a
+mechanism supported by the server. Discard partial output unless your consumer
+explicitly supports resuming it.
diff --git a/site/index.md b/site/index.md
new file mode 100644
index 0000000..7ff6e86
--- /dev/null
+++ b/site/index.md
@@ -0,0 +1,210 @@
+---
+title: unihttp – modern library for creating declarative API clients
+description: Build declarative Python API clients with unihttp, typed methods, sync and async HTTP backends, and your preferred serializer.
+hide:
+ - toc
+ - path
+---
+
+
+
+
+
+Python API clients, thoughtfully structured.
+{ .uh-eyebrow }
+
+# unihttp – modern library for creating declarative API clients
+
+Describe an endpoint once. Call it as a typed Python method.
+Keep your HTTP transport and response models separate.
+{ .uh-lead }
+
+
+
+[Build your first client](getting-started/quickstart.md){ .md-button .md-button--primary }
+[Installation & extras →](getting-started/installation.md){ .uh-secondary }
+
+
+
+## An endpoint you can read.
+
+The URL, parameters, and result type live together in a small dataclass.
+`bind_method` exposes it on your client with a typed call signature.
+
+1. **Declare the result.** `User` describes the response your code receives.
+2. **Describe the request.** `Path[int]` places `user_id` in the URL.
+3. **Bind the method.** `get_user(user_id=1)` returns a `User` with the configured response loader; await the call with async clients.
+
+Choose an HTTP library in the tabs. The models stay the same; the client changes.
+These excerpts omit shared imports and configuration. See the complete
+[sync](getting-started/quickstart.md) or [async](getting-started/async.md) example
+to run against a local demo API. aiohttp is async-only.
+{ .uh-caption }
+
+
+
+## Your API contract. Your stack.
+
+Method definitions describe the API, not the transport. Choose an HTTP client
+for your application and a serializer for your models.
+
+
+
+
+
+### HTTP transport
+
+HTTPX, aiohttp, requests, niquests, zapros, or the standard-library urllib.
+Use a sync or async client where supported by the backend.
+
+[Compare HTTP backends →](integrations/backends.md)
+
+
+
+
+
+### Model serialization
+
+Use dataclasses with Adaptix, or integrate your Pydantic and msgspec models.
+Configure request dumping and response loading explicitly.
+
+[Choose a serializer →](guides/serialization.md)
+
+
+
+
+
+
+
+
+
+## Build beyond the first request.
+
+
+
+[**Define your API** Map query parameters, JSON bodies, headers, and files.→](guides/methods.md)
+
+[**Go asynchronous** Use async clients, context managers, and middleware.→](getting-started/async.md)
+
+[**Handle failures** Choose how HTTP errors become application exceptions.→](guides/errors.md)
+
+[**Add authentication** Apply a bearer token through request middleware.→](recipes/authentication.md)
+
+[**Stream a response** Read downloads incrementally and close streams safely.→](guides/streaming.md)
+
+[**Look up the API** Find exact signatures, types, and extension points.→](reference/index.md)
+
+
+
+[Browse the user guide →](guides/index.md)
+
+
+
+
+
+**When unihttp fits**
+
+Use it for a reusable API client or SDK with explicit endpoint contracts.
+For a one-off request, calling your HTTP library directly may be sufficient.
+
+
+
+
diff --git a/site/integrations/backends.md b/site/integrations/backends.md
new file mode 100644
index 0000000..bf02014
--- /dev/null
+++ b/site/integrations/backends.md
@@ -0,0 +1,48 @@
+---
+title: Choose an HTTP backend
+description: Compare unihttp sync and async client classes and installation extras for HTTPX, aiohttp, requests, niquests, zapros, and urllib.
+---
+
+# Choose an HTTP backend
+
+The endpoint dataclasses are independent of the HTTP client. Select a backend
+that fits your application and install its extra alongside your serializer.
+
+| Backend module | Sync class | Async class | HTTP extra |
+| --- | --- | --- | --- |
+| `unihttp.clients.httpx` | `HTTPXSyncClient` | `HTTPXAsyncClient` | `httpx` |
+| `unihttp.clients.httpx2` | `HTTPX2SyncClient` | `HTTPX2AsyncClient` | `httpx2` |
+| `unihttp.clients.aiohttp` | — | `AiohttpAsyncClient` | `aiohttp` |
+| `unihttp.clients.requests` | `RequestsSyncClient` | — | `requests` |
+| `unihttp.clients.niquests` | `NiquestsSyncClient` | `NiquestsAsyncClient` | `niquests` |
+| `unihttp.clients.zapros` | `ZaprosSyncClient` | `ZaprosAsyncClient` | `zapros` |
+| `unihttp.clients.urllib` | `UrllibSyncClient` | — | None |
+
+HTTPX is used in the tutorials because it supports both sync and async clients
+and an in-process mock transport. Use aiohttp in an existing aiohttp application,
+or retain requests when integrating with a synchronous requests-based codebase.
+
+The urllib transport uses the standard library. That removes an HTTP dependency,
+but model serialization may still require a serializer dependency.
+
+## Transport configuration
+
+Backend-specific constructor arguments are listed in the
+[client reference](../reference/clients.md). Where a session argument is
+available, use it for backend configuration such as connection limits and
+timeouts. Do not assume every backend accepts identical session parameters or
+supports identical HTTP protocol versions.
+
+HTTPX clients close supplied sessions as well as internally created sessions.
+Check the selected client's lifecycle before sharing a session with other code.
+
+## Switching backends
+
+Keep method definitions, then change the client base class, installed extra,
+and any backend-specific session setup. When moving between sync and async,
+also change context managers, awaits, and middleware variants.
+
+The shared API does not make all wire behavior identical. In particular,
+verify query encoding, multipart uploads, exception translation, and streaming
+against your API. The repository's integration tests cover common behavior;
+they are not a guarantee for every transport option.
diff --git a/site/project/agent-skills.md b/site/project/agent-skills.md
new file mode 100644
index 0000000..9a6c319
--- /dev/null
+++ b/site/project/agent-skills.md
@@ -0,0 +1,35 @@
+---
+title: unihttp agent skills
+description: Find the repository's unihttp guidance and SDK-generation skills for coding agents, with version-aware API documentation.
+---
+
+# unihttp agent skills
+
+The repository includes two skills:
+
+- [unihttp](https://github.com/goduni/unihttp/tree/master/.agents/skills/unihttp):
+ conventions for imports, method declarations, serializers, middleware, and
+ client lifecycle.
+- [unihttp-client](https://github.com/goduni/unihttp/tree/master/.agents/skills/unihttp-client):
+ instructions for generating a typed client package from an OpenAPI description
+ or an API description.
+
+Each skill is a directory containing a `SKILL.md` and supporting references.
+Install it using your agent's supported skill mechanism. For a project-local
+installation, copy the selected directories from `.agents/skills/` into the
+skill directory used by your agent.
+
+A skill is guidance for a coding agent; it is not an automatic runtime feature
+of unihttp. Review generated clients against the API contract and run their
+tests.
+
+## Version-aware context
+
+Use skills and documentation from the same revision as your library whenever
+possible. Development guidance can refer to features absent from an older
+release.
+
+The published site also provides `llms.txt` and a Markdown representation of
+each page under `markdown/`. These are generated from the rendered
+documentation, including expanded code snippets and API reference text.
+They are convenient inputs for agents, not a promise of search visibility.
diff --git a/site/project/documentation.md b/site/project/documentation.md
new file mode 100644
index 0000000..d42d856
--- /dev/null
+++ b/site/project/documentation.md
@@ -0,0 +1,144 @@
+---
+title: Contributing to unihttp
+description: Set up unihttp for development, add regression tests, run code checks, and submit a pull request to the library.
+---
+
+# Contributing to unihttp
+
+Help improve unihttp with a bug fix, a clearer type signature, a backend or
+serializer improvement, or a better example. Small, focused contributions are
+welcome; documentation changes follow the same pull-request workflow as code.
+
+## Before you start
+
+Check [existing issues](https://github.com/goduni/unihttp/issues) and
+[pull requests](https://github.com/goduni/unihttp/pulls) for related work.
+For a new feature or a change to the public API, open an issue first to discuss
+the use case, proposed interface, and alternatives.
+
+For a bug report, include:
+
+- A minimal example that reproduces the problem.
+- Expected and actual behavior, including a relevant traceback.
+- Python and unihttp versions, plus the HTTP backend and serializer in use.
+
+Remove credentials and private response data from reports. For a suspected
+vulnerability, follow the [security policy](https://github.com/goduni/unihttp/blob/master/.github/SECURITY.md)
+instead of opening a public issue. Follow the project's
+[code of conduct](https://github.com/goduni/unihttp/blob/master/.github/CODE_OF_CONDUCT.md)
+in discussions and reviews.
+
+## Set up your environment
+
+You need Git, uv, and Python 3.12–3.14. Fork the repository on GitHub, then
+replace `YOUR-USERNAME` with your account name:
+
+```bash
+git clone https://github.com/YOUR-USERNAME/unihttp.git
+cd unihttp
+git switch -c fix/describe-your-change
+uv sync --group dev --group docs
+```
+
+The `dev` group installs the supported optional integrations, test tools, Ruff,
+and mypy. The `docs` group adds the documentation builder and its checks.
+Run the commands below from the repository root.
+
+## Find the right place
+
+- `src/unihttp/` — method definitions, binding, markers, and shared HTTP types.
+- `src/unihttp/clients/` — sync and async HTTP backend adapters.
+- `src/unihttp/serializers/` — Adaptix, Pydantic, and msgspec integrations.
+- `src/unihttp/middlewares/` — middleware interfaces and implementations.
+- `tests/test_core/`, `tests/test_clients/`, and `tests/test_features/` — focused
+ tests for the corresponding parts of the library.
+- `tests/test_integration/` — tests that exercise components together.
+- `examples/` and `site/` — runnable examples and public documentation.
+
+Start with nearby implementations and tests. Keep changes scoped to the issue;
+avoid unrelated refactoring or formatting in the same pull request.
+
+## Add tests for the change
+
+For a bug fix, add a regression test that fails before the fix. For new behavior,
+cover the expected result and relevant failure cases. If a change affects a
+shared contract, check the applicable sync/async clients or serializers, not
+just the integration used in your first example.
+
+Run a focused test while iterating, for example:
+
+```bash
+uv run --group docs pytest tests/test_core/test_method.py -q
+```
+
+Use mocks or a local test server where practical. Tests should not depend on
+private credentials or a third-party API being available.
+
+## Run the checks
+
+Before opening a pull request, run the checks used by the library's CI:
+
+```bash
+uv run --group docs ruff check
+uv run --group docs ruff format --check
+uv run --group docs mypy
+uv run --group docs pytest --cov src --cov-fail-under=80
+```
+
+CI runs the library checks on Python 3.12, 3.13, and 3.14 and requires at least
+80% test coverage. Including `--group docs` locally also enables the documentation
+tests instead of skipping them when their dependencies are absent.
+
+For local library tests across all three Python versions, use the Nox sessions
+configured in `noxfile.py`:
+
+```bash
+uv run --group docs nox
+```
+
+Nox creates separate test environments. The Python interpreters need to be
+available; run the checks on your current interpreter first for faster feedback.
+
+## Documentation
+
+Update the relevant guide, API docstring, or example when changing public
+behavior. Public pages live in `site/`, runnable examples in `examples/`, and
+navigation in `zensical.toml`. Internal notes under `docs/` are not published.
+
+Preview the site locally:
+
+```bash
+uv run --group docs zensical serve
+```
+
+Open `http://localhost:8000`. To validate the complete site and its examples:
+
+```bash
+uv run --group docs pytest tests/test_docs_examples.py tests/test_docs_serialization.py tests/test_docs_responses.py tests/test_docs_build.py -q
+uv run --group docs python scripts/build_docs.py
+```
+
+The full build checks links, anchors, and API reference output, then generates
+Markdown exports and `llms.txt`. Output goes to `.build/docs/`; do not edit
+generated files or use `site/` as the output directory.
+
+Give each page a title, description, and one top-level heading. Keep existing
+URLs where possible. Include tested examples from `examples/` instead of
+copying code into Markdown. Use the existing backend tabs for client-specific
+alternatives, with consistent library labels across pages.
+
+## Open a pull request
+
+Push your branch to your fork and open a pull request against `master` in
+[goduni/unihttp](https://github.com/goduni/unihttp). In the description:
+
+1. Explain the problem and the change; link the relevant issue.
+2. Include a small usage example if the public interface changes.
+3. Describe the tests you added and the checks you ran.
+4. Call out breaking changes and any migration steps explicitly.
+
+Review your diff and complete the repository's pull-request checklist. If you
+change dependencies in `pyproject.toml`, run `uv sync --group dev --group docs`
+and re-run the relevant checks. The generated `uv.lock` stays local and is not
+committed. Watch CI and respond to review feedback; keep follow-up changes
+focused on the same task.
diff --git a/site/project/releases.md b/site/project/releases.md
new file mode 100644
index 0000000..8dfa99a
--- /dev/null
+++ b/site/project/releases.md
@@ -0,0 +1,44 @@
+---
+title: Versions and migration
+description: Understand unihttp development documentation, release documentation, and how to check API changes before upgrading.
+---
+
+# Versions and migration
+
+The `latest` Read the Docs version tracks `master`. It may document changes
+that have not been published to PyPI. The package version in the source metadata
+alone does not establish that every change is already released.
+
+Use [GitHub releases](https://github.com/goduni/unihttp/releases) and
+[PyPI](https://pypi.org/project/unihttp/) to identify published versions.
+Compare the installed version with `python -m pip show unihttp`.
+
+## Match documentation to your installation
+
+Use documentation for your installed release when that version is available.
+`stable`, when available, describes the current published release; `latest`
+describes the development branch. Older releases may not have a documentation
+site, so consult the README and source at their Git tag.
+
+The current source supports Python 3.12–3.14. For another release, check that
+release's package metadata rather than assuming the same Python requirements.
+HTTP backends and serializers are optional dependencies with their own version
+requirements.
+
+## Upgrade checklist
+
+Before upgrading, read the release notes and check the client backend,
+serialization behavior, and any overridden response hooks. Run your API contract
+tests, including errors and streaming cleanup.
+
+When checking your client code, pay particular attention to these contracts:
+
+- Pass `AdaptixDumper(DEFAULT_RETORT)` and `AdaptixLoader(DEFAULT_RETORT)`
+ explicitly, not the retort itself.
+- `call_method` returns the declared model, not an HTTP response wrapper.
+- Returning a value from `on_error` does not replace the method's result.
+- Extend Adaptix using `DEFAULT_RETORT.extend(recipe=[...])`.
+
+These describe current behavior, not a list of changes introduced in a specific
+release. Version-specific changes belong to the linked release notes. See
+[errors](../guides/errors.md) and [serialization](../guides/serialization.md) for examples.
diff --git a/site/recipes/authentication.md b/site/recipes/authentication.md
new file mode 100644
index 0000000..ef3fec4
--- /dev/null
+++ b/site/recipes/authentication.md
@@ -0,0 +1,30 @@
+---
+title: Add bearer authentication
+description: Attach bearer tokens to unihttp requests with a typed middleware and keep credentials out of method declarations.
+---
+
+# Add bearer authentication
+
+Use middleware to attach a token to every request. This excerpt needs
+`HTTPRequest` from `unihttp.http.request`, `HTTPResponse` from
+`unihttp.http.response`, and `Handler, Middleware` from
+`unihttp.middlewares.base`.
+
+```python
+--8<-- "examples/recipes.py:auth"
+```
+
+Pass `middleware=[BearerAuth(token)]` to your client constructor, where
+`token` comes from your application's configuration or credential provider.
+For a reusable SDK, accept the token in its client constructor and attach the
+middleware there.
+
+For async clients, subclass `AsyncMiddleware`, use `AsyncHandler`, make
+`handle` async, and return `await next_handler(request)`.
+
+For authentication on a single endpoint, bind that method with its own
+middleware. See [scope and ordering](../guides/middleware.md).
+
+This recipe attaches a token; it does not implement OAuth token refresh.
+If refresh is needed, design expiry, synchronization, and replay behavior
+around the remote API's authentication contract.
diff --git a/site/recipes/files.md b/site/recipes/files.md
new file mode 100644
index 0000000..252bfc6
--- /dev/null
+++ b/site/recipes/files.md
@@ -0,0 +1,52 @@
+---
+title: Upload files with multipart forms
+description: Send a file and form fields with unihttp File, Form, and UploadFile, including filenames and content types.
+---
+
+# Upload files with multipart forms
+
+Use `File` for the binary payload and `Form` for associated scalar fields.
+With `User` as the response model, define:
+
+```python
+--8<-- "examples/recipes.py:upload"
+```
+
+The declaration above needs these imports, plus the `User` response model from
+the [quickstart](../getting-started/quickstart.md):
+
+```python
+from dataclasses import dataclass
+
+from unihttp.bind_method import bind_method
+from unihttp.http import UploadFile
+from unihttp.markers import File, Form, Path
+from unihttp.method import BaseMethod
+```
+
+Bind it as
+`upload_avatar = bind_method(UploadAvatar)`.
+
+With a configured client:
+
+```python
+from unihttp.http import UploadFile
+
+user = client.upload_avatar(
+ user_id=1,
+ caption="portrait",
+ avatar=UploadFile(
+ b"image bytes",
+ filename="ada.png",
+ content_type="image/png",
+ ),
+)
+```
+
+For real files, open the input in binary mode and keep it open until the
+request completes. Use a valid payload matching your declared content type.
+
+Do not combine `Body` with `File`: use `Form` for multipart metadata.
+Allow the transport to set the multipart boundary instead of hard-coding a
+`Content-Type` header. Confirm file representations supported by your
+[backend](../integrations/backends.md).
diff --git a/site/recipes/partial-updates.md b/site/recipes/partial-updates.md
new file mode 100644
index 0000000..4292330
--- /dev/null
+++ b/site/recipes/partial-updates.md
@@ -0,0 +1,106 @@
+---
+title: Optional fields and Omitted
+description: Omit optional query parameters, headers, and body fields with unihttp Omittable and Omitted, independently of the HTTP method.
+---
+
+
+
+# Optional fields and Omitted
+
+Use `Omitted()` when a request field should not be sent. It is independent of
+the HTTP method: an optional GET filter, a POST body field, and a PATCH update
+all use the same mechanism. The field's marker determines its location;
+`Omitted()` determines whether it is included.
+
+## Omitted is not None
+
+`Omittable[T]` is an alias for `T | Omitted`. It allows the sentinel as a value;
+the default `= Omitted()` also lets callers leave the argument out.
+
+- `Omittable[str]` accepts a string or omission; it does not include `None`.
+- `Omittable[str | None]` additionally allows an explicit `None`.
+- `str | None` alone allows null, but does not express omission.
+
+For a JSON body field, `None` becomes JSON `null`, while `Omitted()` leaves the
+key out. An empty string or zero is still a supplied value, not omission.
+Whether the server applies a default, clears a value, or rejects an absent or
+null field is part of the endpoint's contract, not determined by unihttp.
+
+## Optional query parameters and headers
+
+These examples share the following imports and response model:
+
+```python
+--8<-- "examples/optional_fields.py:setup"
+```
+
+For a GET endpoint, make filters and per-request headers omittable:
+
+```python
+--8<-- "examples/optional_fields.py:query"
+```
+
+`ListUsers()` adds no query parameters or method-level headers.
+`ListUsers(name="Ada", limit=10, accept="application/json")` includes both
+filters and the `Accept` header. Middleware or the HTTP session may still add
+headers of their own.
+
+Use `Omitted()`, not `None`, to leave out query parameters and headers. These
+locations have no JSON null representation: the HTTP backend may encode or
+reject `None` differently. Required URL placeholders still need concrete
+`Path` values; omission does not make a path segment optional.
+
+## Optional JSON body fields
+
+The same pattern works for a POST endpoint. Here `name` is required, while
+`nickname` can be omitted, set to a string, or explicitly set to null:
+
+```python
+--8<-- "examples/optional_fields.py:body"
+```
+
+| Method instance | Serialized body fields |
+| --- | --- |
+| `CreateUser(name="Ada")` | `{"name": "Ada"}` |
+| `CreateUser(name="Ada", nickname=None)` | `{"name": "Ada", "nickname": null}` |
+| `CreateUser(name="Ada", nickname="Countess")` | `{"name": "Ada", "nickname": "Countess"}` |
+
+These method definitions are backend-independent and work with sync or async
+clients. Bind them with `bind_method` or pass an instance to `call_method`, as
+described in [methods and parameters](../guides/methods.md#binding-and-custom-methods).
+
+## Example: partial updates with PATCH
+
+PATCH is one application of omission, not a requirement for it. For an API
+that treats missing fields as unchanged and null as clearing a value, an
+update method can look like this. Import `Path` from `unihttp.markers` and use
+the imports and `User` model above:
+
+```python
+--8<-- "examples/recipes.py:partial"
+```
+
+| Call arguments | Serialized body fields |
+| --- | --- |
+| `user_id=1, name="Ada"` | `{"name": "Ada"}` |
+| `user_id=1, name=None` | `{"name": null}` |
+| `user_id=1` | No body fields |
+
+The `User` response model above has a non-nullable `name`; make it nullable
+if this endpoint returns null after clearing the name.
+
+An entirely empty body dictionary may become no request body at the transport
+layer, rather than a literal JSON `{}`. Check what your API accepts.
+
+## Serializer setup
+
+The examples work with `AdaptixDumper(DEFAULT_RETORT)`, `PydanticDumper()`, and
+`MsgspecDumper()`. Omission is handled during request serialization, before the
+HTTP backend sends the request. A custom dumper must implement omission itself.
+
+Use the direct `= Omitted()` default for consistency across integrations;
+do not substitute `field(default_factory=Omitted)`, which Adaptix's omission
+provider does not treat as the same default. When customizing Adaptix, extend
+`DEFAULT_RETORT` to retain its omission support.
+
+See [serialization](../guides/serialization.md) for serializer configuration.
diff --git a/site/recipes/retries.md b/site/recipes/retries.md
new file mode 100644
index 0000000..5ce4b40
--- /dev/null
+++ b/site/recipes/retries.md
@@ -0,0 +1,101 @@
+---
+title: Retry transient failures
+description: Safely scope unihttp retries to a buffered GET, combine them with HTTP error handling, and configure backoff for sync and async clients.
+---
+
+# Retry transient failures
+
+Retry a call only when the remote operation is safe to repeat. The built-in
+middleware does **not** filter by HTTP method: attaching it to an entire client
+also retries POSTs and other operations that may create duplicate resources.
+
+## Add retries to one GET method
+
+This example reuses `GetUser`, `status_errors`, and `async_status_errors` from
+[Error handling](../guides/errors.md). `GetUser.on_error` only raises for `404`;
+it leaves server errors for middleware. `CreateUser` is the POST method from
+[methods and parameters](../guides/methods.md).
+
+The mapper is outermost and retry is inside it. Only `get_user` gets retries;
+`create_user` still gets status handling, but is sent once.
+
+```python
+from unihttp.bind_method import bind_method
+from unihttp.exceptions import NetworkError, RequestTimeoutError
+```
+
+=== "Sync"
+
+ ```python
+ from unihttp.clients.httpx import HTTPXSyncClient
+ from unihttp.middlewares import RetryMiddleware
+
+ --8<-- "examples/response_retries.py:sync"
+ ```
+
+=== "Async"
+
+ ```python
+ from unihttp.clients.httpx import HTTPXAsyncClient
+ from unihttp.middlewares import AsyncRetryMiddleware
+
+ --8<-- "examples/response_retries.py:async"
+ ```
+
+Construct the client with your base URL and serializers as usual. Calls keep
+their normal signatures: `client.get_user(user_id=1)`, or await that call on
+an async client. You can also scope middleware to
+[one explicit call](../guides/middleware.md).
+
+With this configuration:
+
+- `503 → 503 → 200` returns the loaded user after three attempts.
+- Three `503` responses raise `ServerError` after the last attempt.
+- `404` immediately raises `UserNotFound`; it is not retried.
+- A configured network failure or timeout is retried up to the same limit.
+- A failed `create_user` is not repeated.
+
+## Keep error handling outside retries
+
+Middleware lists are outermost-first. `[status_errors, RetryMiddleware(...)]`
+lets retry inspect each response before the mapper turns the final status into
+an exception. Reversing that order raises too early for status-based retries.
+
+Method and client hooks run inside the request handler. If they call
+`raise_for_status()` on a `503`, retry receives a `ServerError`, not a response.
+Prefer the mapper arrangement above for HTTP errors. If an existing hook must
+raise, configure the specific exception types you intend to retry instead;
+do not indiscriminately retry `ClientError`, `HTTPStatusError`, or `Exception`.
+
+Validation exceptions can also interrupt an attempt. The final model conversion
+runs outside middleware and is not retried. See
+[the response pipeline](../guides/errors.md#understand-the-pipeline).
+
+## Configure attempts and delays
+
+`retries=2` means **up to three attempts**, including the original request.
+The default is three retries, or four attempts total.
+
+By default, status retries cover `500`, `502`, `503`, and `504`. Pass a non-empty
+`status_codes` list to choose another set. Exceptions are not retried unless
+included in `exceptions`; the example opts into `NetworkError` and
+`RequestTimeoutError`.
+
+The delay before retry number `attempt + 1` is `backoff * 2**attempt`, starting
+at `attempt = 0`. Here the base delays are 0.5 and 1 second. With `jitter=True`,
+each delay gets an additional random value between 0 and 1 second.
+
+`429` is not retried by default, and the middleware does not interpret
+`Retry-After`. If you need server-directed delays, this configuration alone
+does not implement them.
+
+## Retry only calls you can safely repeat
+
+A timeout does not prove the server did nothing. Before enabling retries for a
+write, check the API's idempotency guarantees and use its idempotency mechanism
+where available. The request body must also be replayable: retry middleware
+does not rewind file objects or consumed request streams for you.
+
+Do not attach this buffered-call recipe to streaming downloads. It cannot
+resume a partially consumed response, and opening another response can require
+additional cleanup. See [streaming](../guides/streaming.md#errors-and-parsing).
diff --git a/site/reference/clients.md b/site/reference/clients.md
new file mode 100644
index 0000000..0f847ac
--- /dev/null
+++ b/site/reference/clients.md
@@ -0,0 +1,36 @@
+---
+title: Clients
+description: Public sync and async client constructors and request lifecycle hooks.
+---
+
+# Clients
+
+Install the appropriate backend extra before importing its module. The base classes describe the shared lifecycle; concrete constructors list backend-specific settings. HTTPX clients close supplied sessions. See [HTTP backends](../integrations/backends.md) before switching transports.
+
+::: unihttp.clients.base.BaseClient
+
+::: unihttp.clients.base.BaseSyncClient
+
+::: unihttp.clients.base.BaseAsyncClient
+
+::: unihttp.clients.httpx.HTTPXSyncClient
+
+::: unihttp.clients.httpx.HTTPXAsyncClient
+
+::: unihttp.clients.httpx2.HTTPX2SyncClient
+
+::: unihttp.clients.httpx2.HTTPX2AsyncClient
+
+::: unihttp.clients.aiohttp.AiohttpAsyncClient
+
+::: unihttp.clients.requests.RequestsSyncClient
+
+::: unihttp.clients.niquests.NiquestsSyncClient
+
+::: unihttp.clients.niquests.NiquestsAsyncClient
+
+::: unihttp.clients.zapros.ZaprosSyncClient
+
+::: unihttp.clients.zapros.ZaprosAsyncClient
+
+::: unihttp.clients.urllib.UrllibSyncClient
diff --git a/site/reference/http.md b/site/reference/http.md
new file mode 100644
index 0000000..1405451
--- /dev/null
+++ b/site/reference/http.md
@@ -0,0 +1,18 @@
+---
+title: HTTP types
+description: Request, response, upload, and stream types used by unihttp hooks and middleware.
+---
+
+# HTTP types
+
+`HTTPRequest.header` is singular; `HTTPResponse.headers` is plural. Buffered `call_method` returns the loaded body, whereas streaming calls expose `HTTPResponse` directly. These types are available to middleware and response hooks. See [response metadata](../guides/responses.md) for a wrapper example and [streaming](../guides/streaming.md) for cleanup requirements.
+
+::: unihttp.http.request.HTTPRequest
+
+::: unihttp.http.response.HTTPResponse
+
+::: unihttp.http.files.UploadFile
+
+::: unihttp.http.stream.ChunkStream
+
+::: unihttp.http.stream.AsyncChunkStream
diff --git a/site/reference/index.md b/site/reference/index.md
new file mode 100644
index 0000000..f534912
--- /dev/null
+++ b/site/reference/index.md
@@ -0,0 +1,23 @@
+---
+title: API reference
+description: Find unihttp public client classes, method binding, parameter markers, HTTP types, serializer protocols, middleware, and exceptions.
+---
+
+# API reference
+
+Public signatures and types, generated from the library source.
+For explanations and worked examples, use the [user guide](../guides/index.md).
+For your first request, start with a [quickstart](../getting-started/quickstart.md).
+
+| Looking for | Reference | Usage guide |
+| --- | --- | --- |
+| `BaseMethod`, `StreamMethod`, `bind_method` | [Methods and binding](methods.md) | [Declare requests](../guides/methods.md) |
+| Client constructors and lifecycle hooks | [Clients](clients.md) | [Choose an HTTP backend](../integrations/backends.md) |
+| `Path`, `Query`, `Body`, `Omitted` | [Markers and omitted values](markers.md) | [Optional fields](../recipes/partial-updates.md) |
+| `HTTPRequest`, `HTTPResponse`, uploads and streams | [HTTP types](http.md) | [Response metadata](../guides/responses.md), [streaming](../guides/streaming.md) |
+| `RequestDumper`, `ResponseLoader`, integrations | [Serializers](serializers.md) | [Serialization](../guides/serialization.md) |
+| Handlers, retries, logging and exceptions | [Middleware and exceptions](middleware.md) | [Middleware](../guides/middleware.md), [errors](../guides/errors.md) |
+
+Import symbols from their documented submodules, not from the top-level
+`unihttp` package. Install the matching optional dependency before importing a
+backend or serializer integration.
diff --git a/site/reference/markers.md b/site/reference/markers.md
new file mode 100644
index 0000000..b1879b8
--- /dev/null
+++ b/site/reference/markers.md
@@ -0,0 +1,14 @@
+---
+title: Markers and omitted values
+description: Typed aliases for request locations and the sentinel used to omit fields.
+---
+
+# Markers and omitted values
+
+Import aliases from `unihttp.markers`: `Path`, `Query`, `Header`, `Body`, `Form`, `File`, and `Raw`. Each is an `Annotated[T, Marker]` alias, so its Python value remains of type `T`. See the [wire-location table](../guides/methods.md#marker-reference). `Raw` currently requires Adaptix or a custom dumper.
+
+Import `Omittable` and `Omitted` from `unihttp.omitted`. `Omittable[T]` means `T | Omitted`; use `Omitted()` as the default. [Optional fields and Omitted](../recipes/partial-updates.md) explains omission versus null, independently of the HTTP method.
+
+::: unihttp.markers.Marker
+
+::: unihttp.omitted.Omitted
diff --git a/site/reference/methods.md b/site/reference/methods.md
new file mode 100644
index 0000000..c10554c
--- /dev/null
+++ b/site/reference/methods.md
@@ -0,0 +1,16 @@
+---
+title: Methods and binding
+description: Public method definitions, response hooks, and typed client binding.
+---
+
+# Methods and binding
+
+Bind a method dataclass with `bind_method` to expose its constructor arguments on a client. Buffered calls return the declared model; streaming calls return an HTTP response containing a stream. Runtime-bound signatures depend on the supplied dataclass, so the generic signatures below describe the binding machinery rather than every generated endpoint.
+
+::: unihttp.method.RequestMethod
+
+::: unihttp.method.BaseMethod
+
+::: unihttp.method.StreamMethod
+
+::: unihttp.bind_method.bind_method
diff --git a/site/reference/middleware.md b/site/reference/middleware.md
new file mode 100644
index 0000000..314c26d
--- /dev/null
+++ b/site/reference/middleware.md
@@ -0,0 +1,28 @@
+---
+title: Middleware and exceptions
+description: Middleware handlers, retry and status-mapping configuration, logging, and the unihttp exception hierarchy.
+---
+
+# Middleware and exceptions
+
+Sync `Handler` and async `AsyncHandler` are callable aliases exported by `unihttp.middlewares`. Match the middleware variant to the client. See [middleware ordering](../guides/middleware.md) and [retry behavior](../recipes/retries.md).
+
+`HTTPStatusError` exposes `response` and `status_code`. Status errors require explicit handling; default response hooks do not raise automatically. Network exception normalization depends on the transport.
+
+::: unihttp.middlewares.base.Middleware
+
+::: unihttp.middlewares.base.AsyncMiddleware
+
+::: unihttp.middlewares.error_mapper.SyncErrorMapperMiddleware
+
+::: unihttp.middlewares.error_mapper.AsyncErrorMapperMiddleware
+
+::: unihttp.middlewares.retry.RetryMiddleware
+
+::: unihttp.middlewares.retry.AsyncRetryMiddleware
+
+::: unihttp.middlewares.logging.LoggingMiddleware
+
+::: unihttp.middlewares.logging.AsyncLoggingMiddleware
+
+::: unihttp.exceptions
diff --git a/site/reference/serializers.md b/site/reference/serializers.md
new file mode 100644
index 0000000..3e02a18
--- /dev/null
+++ b/site/reference/serializers.md
@@ -0,0 +1,24 @@
+---
+title: Serializers
+description: RequestDumper and ResponseLoader protocols and built-in Adaptix, Pydantic, and msgspec implementations.
+---
+
+# Serializers
+
+A request dumper produces request parts; a response loader converts parsed data into the declared type. Both are explicitly supplied to the client. See [serialization](../guides/serialization.md) for compatibility limits. `DEFAULT_RETORT` is exported from `unihttp.serializers.adaptix` and should be extended with a keyword `recipe` to preserve unihttp providers.
+
+::: unihttp.serialize.RequestDumper
+
+::: unihttp.serialize.ResponseLoader
+
+::: unihttp.serializers.adaptix.serialize.AdaptixDumper
+
+::: unihttp.serializers.adaptix.serialize.AdaptixLoader
+
+::: unihttp.serializers.pydantic.serialize.PydanticDumper
+
+::: unihttp.serializers.pydantic.serialize.PydanticLoader
+
+::: unihttp.serializers.msgspec.serialize.MsgspecDumper
+
+::: unihttp.serializers.msgspec.serialize.MsgspecLoader
diff --git a/site/stylesheets/installation.css b/site/stylesheets/installation.css
new file mode 100644
index 0000000..8d1afae
--- /dev/null
+++ b/site/stylesheets/installation.css
@@ -0,0 +1,128 @@
+/* Installation keeps the documentation TOC and native, linked content tabs. */
+.md-typeset .uh-install h1 {
+ margin: .5rem 0 .8rem;
+ color: var(--md-default-fg-color);
+ font-size: clamp(1.8rem, 1.5rem + 1.5cqi, 2.2rem);
+ font-weight: 650;
+ letter-spacing: -.035em;
+ line-height: 1.15;
+}
+
+.md-typeset .uh-install h2 {
+ margin: 2rem 0 .8rem;
+ padding-top: 1.2rem;
+ border-top: 1px solid var(--uh-line);
+ font-size: 1.2rem;
+ font-weight: 600;
+ letter-spacing: -.02em;
+}
+
+.md-typeset .uh-install .uh-lead {
+ margin-bottom: .6rem;
+}
+
+.uh-install-requirements {
+ color: var(--uh-muted);
+ font-size: .75rem;
+}
+
+.md-typeset .uh-install-help {
+ margin-block: 1rem;
+ padding: 0;
+ border: 1px solid var(--uh-line);
+ border-radius: .25rem;
+ background: transparent;
+ box-shadow: none;
+ font-size: .8rem;
+}
+
+.md-typeset .uh-install-help > summary {
+ display: list-item;
+ margin: 0;
+ padding: .7rem .8rem;
+ min-height: 2.2rem;
+ border: 0;
+ background: transparent;
+ font-weight: 500;
+ cursor: pointer;
+ list-style-position: inside;
+}
+
+.md-typeset .uh-install-help > summary::before,
+.md-typeset .uh-install-help > summary::after {
+ display: none;
+}
+
+.uh-install-help[open] > :not(summary) {
+ margin-inline: .8rem;
+}
+
+.uh-install summary:focus-visible,
+.uh-install a:focus-visible {
+ outline: 2px solid var(--uh-accent);
+ outline-offset: 2px;
+}
+
+.uh-install-picker {
+ margin-top: 1.5rem;
+}
+
+.md-typeset .uh-install-label {
+ margin: 1rem 0 .25rem;
+ color: var(--uh-muted);
+ font-size: .7rem;
+ font-weight: 600;
+}
+
+.md-typeset .uh-install-mode {
+ margin: .75rem 0 1rem;
+ color: var(--uh-accent);
+ font-size: .75rem;
+}
+
+.uh-install-picker .tabbed-set {
+ min-width: 0;
+}
+
+.md-typeset .uh-install-note {
+ margin-top: 1.2rem;
+ color: var(--uh-muted);
+ font-size: .75rem;
+ line-height: 1.7;
+}
+
+.uh-install-next {
+ display: grid;
+ gap: .8rem;
+ margin-block: 1.2rem;
+}
+
+.md-typeset .uh-install-next p {
+ margin: 0;
+}
+
+.md-typeset .uh-install-next a {
+ display: block;
+ padding-block: .5rem;
+ color: var(--uh-accent);
+ text-decoration: none;
+}
+
+.uh-install-next a:hover strong {
+ text-decoration: underline;
+ text-underline-offset: .2em;
+}
+
+.uh-install-next span {
+ display: block;
+ margin-top: .35rem;
+ color: var(--uh-muted);
+ font-size: .75rem;
+}
+
+@container (min-width: 28rem) {
+ .uh-install-next {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 1.5rem;
+ }
+}
diff --git a/site/stylesheets/overview.css b/site/stylesheets/overview.css
new file mode 100644
index 0000000..3946664
--- /dev/null
+++ b/site/stylesheets/overview.css
@@ -0,0 +1,257 @@
+/* Shared page tokens; all layout rules remain scoped to their page components. */
+.uh-overview,
+.uh-install {
+ --uh-accent: #855019;
+ --uh-on-accent: #fffaf3;
+ --uh-muted: #595d65;
+ --uh-line: color-mix(in srgb, var(--md-default-fg-color) 16%, var(--md-default-bg-color));
+ container-type: inline-size;
+}
+
+[data-md-color-scheme="slate"] .uh-overview,
+[data-md-color-scheme="slate"] .uh-install {
+ --uh-accent: #e4b879;
+ --uh-on-accent: #27221b;
+ --uh-muted: #b1b5be;
+}
+
+.md-typeset .uh-overview h1,
+.md-typeset .uh-overview h2,
+.md-typeset .uh-overview h3 {
+ color: var(--md-default-fg-color);
+ font-weight: 650;
+ text-wrap: balance;
+}
+
+.md-typeset .uh-overview h1 {
+ max-width: 28ch;
+ margin: .6rem 0 1.2rem;
+ font-size: clamp(1.65rem, 1.2rem + 2.1cqi, 2.5rem);
+ line-height: 1.13;
+ letter-spacing: -.035em;
+}
+
+.md-typeset .uh-overview h2 {
+ margin: 0 0 .8rem;
+ font-size: 1.3rem;
+ line-height: 1.25;
+ letter-spacing: -.02em;
+}
+
+.md-typeset .uh-overview h3 {
+ margin: 0 0 .6rem;
+ font-size: .9rem;
+}
+
+.uh-hero {
+ padding: .4rem 0 2.4rem;
+}
+
+.md-typeset .uh-eyebrow {
+ margin: 0;
+ color: var(--uh-accent);
+ font-size: .7rem;
+ font-weight: 600;
+ letter-spacing: .025em;
+}
+
+.md-typeset .uh-lead {
+ max-width: 56ch;
+ margin: 0 0 1.4rem;
+ font-size: 1rem;
+ line-height: 1.65;
+}
+
+.uh-actions > p {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: .5rem 1.2rem;
+}
+
+.md-typeset .uh-actions .md-button--primary {
+ border-color: var(--uh-accent);
+ background: var(--uh-accent);
+ color: var(--uh-on-accent);
+ padding: .6em 1.15em;
+}
+
+.md-typeset .uh-actions .md-button--primary:hover {
+ background: var(--uh-on-accent);
+ color: var(--uh-accent);
+}
+
+.md-typeset .uh-overview a:not(.md-button):not(.headerlink) {
+ color: var(--uh-accent);
+}
+
+.md-typeset .uh-secondary {
+ display: inline-flex;
+ align-items: center;
+ min-height: 2.2rem;
+}
+
+.md-typeset .uh-overview a:focus-visible {
+ outline: 2px solid var(--uh-accent);
+ outline-offset: 4px;
+}
+
+.md-typeset .uh-summary,
+.md-typeset .uh-caption {
+ color: var(--uh-muted);
+ font-size: .7rem;
+ line-height: 1.7;
+}
+
+.md-typeset .uh-summary {
+ margin: 1rem 0 0;
+}
+
+.uh-example,
+.uh-stack,
+.uh-next {
+ border-top: 1px solid var(--uh-line);
+ padding-block: 2rem;
+}
+
+.uh-example,
+.uh-stack-options {
+ display: grid;
+ gap: 1.2rem;
+}
+
+.uh-example > *,
+.uh-stack-options > * {
+ min-width: 0;
+}
+
+.md-typeset .uh-example ol {
+ margin: 1.2rem 0 1.2rem 1rem;
+}
+
+.md-typeset .uh-example li {
+ margin: 0 0 .8rem;
+ padding-left: .2rem;
+}
+
+.uh-example li::marker {
+ color: var(--uh-accent);
+ font-weight: 600;
+}
+
+.uh-code {
+ align-self: start;
+ overflow: hidden;
+ border: 1px solid var(--uh-line);
+ border-radius: .3rem;
+ background: var(--md-code-bg-color);
+}
+
+.md-typeset .uh-code-label {
+ margin: 0;
+ padding: .65rem .8rem;
+ border-bottom: 1px solid var(--uh-line);
+ color: var(--uh-muted);
+ font-size: .65rem;
+ font-weight: 600;
+}
+
+.md-typeset .uh-code .highlight,
+.md-typeset .uh-code pre {
+ margin: 0;
+}
+
+.md-typeset .uh-code .tabbed-set {
+ margin: 0;
+}
+
+.md-typeset .uh-overview .uh-code .tabbed-labels a {
+ color: inherit;
+}
+
+.md-typeset .uh-code pre > code {
+ padding: .9rem;
+ font-size: .7rem;
+ line-height: 1.65;
+}
+
+.uh-stack > p {
+ max-width: 64ch;
+}
+
+.uh-stack-options {
+ margin-top: 1.4rem;
+}
+
+.uh-stack-options a {
+ display: inline-flex;
+ align-items: center;
+ min-height: 2.2rem;
+}
+
+.md-typeset .uh-routes > p {
+ margin: 0;
+ border-bottom: 1px solid var(--uh-line);
+}
+
+.md-typeset .uh-routes a {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ gap: .2rem .8rem;
+ padding: .9rem .2rem;
+ text-decoration: none;
+}
+
+.uh-routes a > span:first-of-type {
+ grid-column: 1;
+ color: var(--uh-muted);
+ font-size: .75rem;
+}
+
+.uh-routes a > span[aria-hidden] {
+ grid-column: 2;
+ grid-row: 1 / 3;
+ align-self: center;
+}
+
+.uh-routes a:hover strong {
+ text-decoration: underline;
+ text-underline-offset: .2em;
+}
+
+.md-typeset .uh-fit {
+ max-width: 66ch;
+ padding-bottom: 1rem;
+ color: var(--uh-muted);
+ font-size: .75rem;
+}
+
+.md-typeset .uh-fit p {
+ margin: 0 0 .4rem;
+}
+
+@container (min-width: 36rem) {
+ .uh-example {
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
+ gap: 2rem;
+ }
+
+ .uh-stack-options {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 2rem;
+ }
+
+ .md-typeset .uh-routes a {
+ grid-template-columns: 10rem minmax(0, 1fr) auto;
+ align-items: baseline;
+ }
+
+ .uh-routes a > span:first-of-type {
+ grid-column: 2;
+ }
+
+ .uh-routes a > span[aria-hidden] {
+ grid-column: 3;
+ grid-row: 1;
+ }
+}
diff --git a/tests/test_docs_build.py b/tests/test_docs_build.py
new file mode 100644
index 0000000..17fc148
--- /dev/null
+++ b/tests/test_docs_build.py
@@ -0,0 +1,368 @@
+"""Verify deployment metadata and that exported docs contain usable content."""
+
+import pytest
+
+pytest.importorskip("markdownify")
+BeautifulSoup = pytest.importorskip("bs4").BeautifulSoup
+
+from scripts import build_docs
+
+
+@pytest.fixture
+def rendered_site(tmp_path, monkeypatch):
+ monkeypatch.setattr(build_docs, "OUTPUT", tmp_path)
+ return tmp_path
+
+
+def write_page(root, relative="index.html", content="