πŸ‘¨β€πŸ’» From the Author

I started maker_web without a clear plan, simply wanting to create something useful. The result is a tool that embodies freedom, speed, and security. I don't strive for "convenience" at the expense of freedom. And I love how it turned out.

You'll see the PHILOSOPHY.md file in the project soon :)

πŸ”’ Security & Protection Built-in DoS/DDoS protection β€” zero performance cost
πŸ”— ConnectionFilter Trait Reject unwanted connections at the TCP level before processing
🌐 Full HTTP Stack HTTP/1.1, HTTP/1.0, HTTP/0.9+ with keep‑alive support
πŸ’Ύ ConnectionData Trait Store data between requests in a single connection
🏭 Graceful Degradation Automatic 503 responses during overload conditions
βš™οΈ Configurable Limits & Timeouts Fully configurable for requests, responses, and connections

πŸ“š Usage examples

🌐

Hello world

Basic example
use maker_web::{Handled, Handler, Request, Response, Server, StatusCode};
use tokio::net::TcpListener;

struct HelloWorld;

impl Handler for HelloWorld {
    async fn handle(&self, _: &mut (), _: &Request, resp: &mut Response) -> Handled {
        resp.status(StatusCode::Ok)
            .header("Content-Type", "text/plain")
            .body("Hello, world!")
    }
}

#[tokio::main]
async fn main() {
    Server::builder()
        .listener(TcpListener::bind("127.0.0.1:8080").await.unwrap())
        .handler(HelloWorld)
        .build()
        .launch()
        .await;
}
🌐

Routing

API routing
use maker_web::{Handled, Handler, Request, Response, Server, StatusCode};
use tokio::net::TcpListener;

struct MyHandler;

impl Handler for MyHandler {
    async fn handle(&self, _: &mut (), req: &Request, resp: &mut Response) -> Handled {
        match req.url().path_segments_str() {
            ["api", user, "name"] => {
                resp.status(StatusCode::Ok).body(user)
            }
            ["api", user, "name", "len"] => {
                resp.status(StatusCode::Ok).body(user.len())
            }
            ["api", "echo", text] => {
                resp.status(StatusCode::Ok).body(text)
            }
            _ => resp.status(StatusCode::NotFound).body("qwe"),
        }
    }
}

#[tokio::main]
async fn main() {
    Server::builder()
        .listener(TcpListener::bind("127.0.0.1:8080").await.unwrap())
        .handler(MyHandler)
        .build()
        .launch()
        .await;
}

πŸ“’ Share maker_web

Copy this link to share with friends:

πŸ“¦ Download maker_web

Choose one option:
Run in terminal
cargo add maker_web tokio --features tokio/full
Add to your Cargo.toml
[dependencies]
maker_web = "0.1"
tokio = { version = "1", features = ["full"] }
Clone from Github
git clone https://github.com/AmakeSashaDev/maker_web