Expand description
maker_web - High-performance, zero-allocation HTTP server for microservices
A performance-oriented HTTP server with comprehensive configuration for memory management, connection handling, and protocol support. Designed for microservices requiring fine-grained control over resources.
ยงProtocol Support
- HTTP/1.1: Full protocol with persistent connections and chunked encoding
- HTTP/1.0: Basic protocol support for legacy clients and simple requests
- HTTP/0.9+: High-performance variant with keep-alive and query support
ยงFeatures
ยง๐ Security & Protection
- Built-in DoS/DDoS protection - enabled by default, with no performance penalty.
- Fully configurable limits and timeouts for requests, responses, and connections.
- Custom connection filtering - implement the
ConnectionFiltertrait to reject unwanted connections at the TCP level.
ยง๐ Performance & Memory
- Zero-allocation - no memory allocations after server startup.
- Pre-allocated memory for each connection - linear and transparent scaling.
ยง๐ Protocol & Management
- Full HTTP stack -
HTTP/1.1,HTTP/1.0,HTTP/0.9+with keep-alive. - Automatic protocol detection for each request - keep-alive eliminates the need for manual protocol selection.
- Storing data between requests - ability to store data between requests in a
single connection using the
ConnectionDatatrait.
ยง๐ญ Production Ready
- Graceful performance degradation - automatic 503 responses when overloaded.
- Custom error format - structured JSON (with codes/descriptions) or a plain HTTP response.
- Resource protection - automatic closure of connections exceeding set limits.
ยงQuick Start
ยง1. Installation
Add maker_web and tokio to your Cargo.toml:
cargo add maker_web tokio --features tokio/fullOr manually:
[dependencies]
maker_web = "0.1"
tokio = { version = "1", features = ["full"] }ยง2. Usage example
use maker_web::{Server, Handler, Request, Response, Handled, StatusCode};
use tokio::net::TcpListener;
struct MyHandler;
impl Handler for MyHandler {
async fn handle(&self, _: &mut (), _: &Request, resp: &mut Response) -> Handled {
resp.status(StatusCode::Ok).body("Hello World!")
}
}
#[tokio::main]
async fn main() {
Server::builder()
.listener(TcpListener::bind("127.0.0.1:8080").await.unwrap())
.handler(MyHandler)
.build()
.launch()
.await;
}For more examples including connection filtering and advanced configuration,
see the crate documentation and
examples/
directory.
ยงUse Cases
- High-throughput microservices - configurable for specific workloads
- Resource-constrained environments - predictable memory usage
- Internal APIs - security-conscious defaults
- Performance-critical applications - zero-allocation design
- Legacy system integration - HTTP/1.0 compatibility
ยง๐ Beyond the Documentation
For live statistics, deeper insights, and ongoing project thoughts, visit the project website.
Modulesยง
- limits
- Web server configuration limits and timeouts
- query
- Zero-copy URL query string parser with flexible collection support.
Structsยง
- Body
Writer - Writer for constructing the HTTP response body. Used in body_with.
- Request
- High-performance HTTP request representation.
- Response
- HTTP response builder for constructing server responses.
- Server
- An HTTP server that processes incoming connections and requests.
- Server
Builder - Builder for configuring and creating
Serverinstances. - Url
- A parsed URL representation optimized for HTTP request handling.
Enumsยง
- Method
- HTTP request methods
- Status
Code - HTTP status codes
- Version
- HTTP protocol version
Traitsยง
- Connection
Data - Managing user session data stored between requests within a single HTTP connection.
- Connection
Filter - A trait for filtering TCP connections before HTTP processing.
- Handler
- A trait for handling HTTP requests and generating responses.
- Write
Buffer - Trait for writing data to the
Responsebuffer.