What is warp?
warp is a web server framework for the Rust programming language, published as the warp crate under the MIT license. It was announced on August 1, 2018 in the introductory blog post by Sean McArthur, who presented it as a joint project with Carl Lerche, and the repository is hosted at seanmonstar/warp on GitHub. The project describes itself as a super-easy, composable web server framework. It should not be confused with the Warp terminal application, which is a separate product.
The central concept is the Filter trait. A filter extracts data from a request or rejects it, and filters are combined with methods such as and, or, map and and_then to describe routes, so path segments, headers, query strings and bodies are all expressed the same way. warp is built on hyper and runs on the Tokio runtime, which gives it HTTP/1 and HTTP/2 support and asynchronous request handling. The crate is added to a project's Cargo.toml together with Tokio; there are no binaries or hosted service, and the API reference is published on docs.rs with runnable programs in the examples folder.
The current crate version is warp 0.4.4, published on crates.io on November 13, 2026 and tagged v0.4.4 in the repository. The release marked Latest on the GitHub releases page is still v0.4.1 of August 2025, because later versions were published as tags and crates without GitHub release entries. According to the changelog, 0.4.4 strips line endings from user input passed to server-sent event types and normalizes an absent path_and_query to the root path. Version 0.4.3 of May 2026 brought back the addr::remote() filter from 0.3.x, added a reply::stream() helper and fixed a CORS error when the request-method header was missing, and 0.4.2 added support for passing a UnixListener to incoming().
Version 0.4.0, released on August 5, 2025, was a breaking release. It moved warp to version 1 of hyper, http and http-body, made the multipart and websocket features opt-in, placed warp::serve() behind a server feature and warp::test behind a test feature, and removed the tls feature and its types. Since then no Cargo feature is enabled by default, so the README dependency line is warp = { version = "0.4", features = ["server"] }. Built-in TLS is no longer part of the crate; the TLS feature is commented out in the manifest with a note that it might come back.
warp is a library rather than a full-stack framework: it includes no ORM, template engine or authentication system, and the examples show integrations such as Handlebars templates added as separate crates. Community discussion takes place on the project's Discord server and in GitHub issues. Other HTTP frameworks on iThub include Gin for Go; further frameworks are grouped under Web Frameworks & UI Libraries.
Key capabilities
- Crate installation Warp is added in
Cargo.tomlnext to Tokio, for exampletokio = { version = "1", features = ["full"] }andwarp = { version = "0.4", features = ["server"] }. The crate uses Rust edition 2021, and the result is a normal Rust binary with no separate runtime or service. - Cargo features Since 0.4.0 the default feature set is empty.
serverenableswarp::serve()and the hyper server stack,websocketadds WebSocket support through tokio-tungstenite,multipartadds multipart form parsing through multer,compressionenables gzip, deflate and Brotli filters, andtestenables the testing module. Withoutserver, the 0.4.2 release reduced the pulled-in dependencies. - Filter composition Every route is built from
Filtervalues combined withand,or,map,and_then,untuple_oneand similar combinators. Values extracted by each filter are passed as typed arguments to the handler, so a path parameter, a header and a JSON body arrive as Rust values. The crate documentation describes how unmatched filters reject a request so that the next alternative can be tried. - Path routing The
path!macro and thepathmodule match literal segments, typed parameters withparam, the end of the path withend, and the remaining path withtail,peekorfull. The README examplewarp::path!("hello" / String)matchesGET /hello/warpand passes the name to the handler. - Methods, headers, cookies and host Method filters cover GET, POST, PUT, DELETE, HEAD, OPTIONS and PATCH. Header filters extract a typed header, an optional one or a full header map, or require an exact value, with a case-insensitive variant. Cookie filters read required or optional cookies, and host filters match the request authority.
- Query strings and bodies
querydeserializes the query string into a type with serde, andquery::rawreturns it unparsed. Body filters read JSON and URL-encoded forms into serde types, return raw bytes, aggregate the body or expose it as a stream, andcontent_length_limitrejects bodies above a set size. - Multipart form data With the
multipartfeature,warp::multipart::form()parses multipart uploads into parts with names, filenames and content types. Since 0.3.4 part data is streamed rather than buffered, and the maximum length can be set or disabled withmax_length(). - Static files and directories
warp::fs::fileserves a single file andwarp::fs::dirserves a directory tree, as shown in thefile.rsanddir.rsexamples. MIME types are derived from file extensions through the mime_guess crate. - WebSockets The
ws()filter, available with thewebsocketfeature, upgrades a request and hands the connection to an async handler as a stream and sink of messages. The repository includes a basic echo example and a multi-user chat example. - Server-sent events The
ssemodule turns a stream of events into an event-stream response, withkeep_alivefor periodic comments andlast_event_idto read the reconnection header. The 0.4.4 release strips line endings from user input placed in SSE fields, and the examples include a basic SSE stream and an SSE chat. - Replies and redirects Handlers return any type that implements
Reply, including strings, JSON fromreply::json, HTML fromreply::htmland wrappers that set a status code or headers.reply::stream()was added in 0.4.3, and theredirectmodule builds 301, 302, 303, 307 and 308 responses. - Rejections and error handling When no filter matches, warp produces a
Rejection, andrecoverturns rejections into custom responses such as JSON error bodies. Custom rejection types can be defined for application errors, as shown in therejections.rsexample. - CORS
warp::cors()builds a CORS filter with allowed origins, methods, headers and credentials, and handles preflight requests. The 0.4.3 release fixed a case where an error was returned when the request-method header was missing. - Compression With the
compressionfeature, thegzip(),deflate()andbrotli()wrappers compress responses through the async-compression crate. Thecompression.rsexample applies them to file responses. - Logging and tracing
warp::logwrites access log lines through thelogcrate, andlog::customaccepts a callback with request information. Thetracefilters createtracingspans for requests or named routes, as shown in thetracing.rsexample. - Server, graceful shutdown and listeners
warp::serve(filter).run(addr)binds and serves on a socket address.bindplusgraceful(signal)adds graceful shutdown, which 0.4.1 fixed so the filter no longer has to be a future.incoming()accepts an existing listener, including aUnixListenersince 0.4.2, andaddr::remote()exposes the peer address again since 0.4.3. - Use with other hyper services
warp::service()converts a filter into a service that can be driven by hyper directly, for applications that set up their own server or combine warp routes with other services. warp re-exportshttpandhyperfor this purpose. - Testing module With the
testfeature,warp::testbuilds mock requests with a method, path, headers and body and runs them through a filter without opening a socket. It can also test WebSocket filters, which lets route logic be checked in ordinary Rust unit tests.
Where warp fits
JSON APIs
The todos.rs example builds a small REST API with list, create, update and delete routes over an in-memory store. Routes combine method filters, path parameters, query for pagination options and body::json with a content_length_limit, then return reply::json or a status code. The example also shows how shared state is passed into handlers through a filter.
Serving a static site or single-page app
The dir.rs and file.rs examples serve a directory and an index file with fs::dir and fs::file. Combined with or, a project can serve API routes under a prefix and static assets for every other path, and add the compression wrappers when the compression feature is enabled.
Real-time features with WebSockets and SSE
The websockets_chat.rs and sse_chat.rs examples implement chat rooms, one over WebSocket connections and one over server-sent events with a POST route for new messages. Both keep connected users in shared state and broadcast messages to them, and the WebSocket example needs the websocket feature.
File uploads
The multipart.rs example reads multipart form data with multipart::form() and iterates over the parts, which arrive as streams since 0.3.4. A maximum length can be set on the form, and max_length(None) removes the limit.
Request logging and diagnostics
The tracing.rs example wraps routes in warp::trace to emit spans through the tracing ecosystem, with named spans for individual routes, while warp::log produces access logs through the log crate. The rejections.rs example shows mapping rejections and custom errors to JSON responses with proper status codes.
Upgrading from 0.3 to 0.4
The 0.4.0 changelog lists the steps a 0.3 project meets when upgrading: enabling the server feature for warp::serve, adding websocket, multipart or test where those modules are used, moving to hyper 1 types, and replacing the removed built-in TLS with TLS termination outside warp. The addr::remote() filter removed in 0.4.0 returned in 0.4.3.
Reviews of warp
Be the first to share your experience with warp.
Write a review
Loading review form…
Found warp useful? Upvote it todayYour vote helps other IT teams find it in the daily ranking.
