# ADR-0001: Rust + Tokio + hyper for the data plane

URL: https://scalws.com/docs/adr/0001-rust-tokio-hyper-data-plane/
Source: `docs/adr/0001-rust-tokio-hyper-data-plane.md` in the ScalWS repository

* Status: Accepted (2026-10-05)

## Context
Requirement: Rust owns listeners, HTTP, TLS, routing, proxying and static
serving, using mature libraries and no hand-written HTTP parsers.

## Decision
* Tokio multi-threaded runtime (work-stealing) as the only async runtime.
* `hyper` 1.x for HTTP/1.1 and HTTP/2 framing; `hyper-util` auto builder to serve both
  protocols on one listener (ALPN for TLS, preface sniffing for cleartext h2c).
* No tower middleware stack initially: the pipeline is a single explicit async function,
  which keeps the hot path readable and allocation-light. Revisit if middleware count grows.
* HTTP/3 (Quinn/h3) deferred to M10.
  Update (1.0.0, 2026-11-12): HTTP/3 ships in the 1.0.0 packages, opt-in per listener (ADR-0019).

## Consequences
* Mature, fuzzed parsers; strict h1 parsing by default.
* hyper has no built-in idle timeout for HTTP/2 or write timeout; we implement connection
  idle tracking ourselves (`scalws-http::conn`). Write timeouts remain open (THREAT_MODEL).
* SO_REUSEPORT sharding / io_uring are explicitly out of scope until benchmarks justify them.
